Willy-JL / F95Checker

GNU General Public License v3.0
101 stars 16 forks source link

Last Updated field shows all zero's time if time component is part of the format. #104

Closed FaceCrap closed 5 months ago

FaceCrap commented 7 months ago

In the interface settings you can specify both a separate Time Format and a Date Format. If you also add the Time Format to the Date Format field, Addon On and Last Played also shows the time these events happened. Last Updated however always shows 00:00:00 or 00:00, although sometimes I've seen 01:00:00, depending on what you used as format. This is because the forum never adds a time to this value.

FaceCrap commented 6 months ago

proposed 'fix'

def trim_zerotime(datestr: str):
    datestr = datestr.replace("00:00","")
    datestr = datestr.replace("01:00","")
    datestr = datestr.replace(":00","")
    datestr = datestr.replace(" ","")
    return datestr

to be used like below wherever Last updated is shown

    dateshort = utils.trim_zerotime(game.last_updated.display)
    imgui.text(f"{dateshort}" or "Unknown")
Willy-JL commented 5 months ago

this seems more of a workaround... the date format exists exactly for elements that are no supposed to have a time.

where exactly would you benefit from having the time too, where currently it uses the datestamp format? the solution would be to make that one use the timestamp format, not change datestamps to support time

just-Addict commented 5 months ago

the date format exists exactly for elements that are no supposed to have a time.

But then the question becomes, which elements are supposed to show a time? I haven't seen the time used anywhere but in the context menu of the tray icon in BG mode, and there it's always showing in the %H:%M format, regardless of the specified format.

Making it part of the date format field was the only way I could make a time show up (which is where I figured it would be used). And that then leads to the situation as described. Granted, I don't think many people will use it in this way, but for the ones who do, it would just be wasted space if it always shows as 00:00 or 00:00:00 (although I had one or two that actually showed 01:00:00)

Willy-JL commented 5 months ago

Right, I remember now. Those fields use the datestamp because they're supposed to have day precision, not minute or second. For last updated because it's what we have from the threads, and also for all 3 of them (last updated, last played, added on) if they were any more precise, you would not be able to multisort. Multisort will sort one way, then use the next passes to sort the items next to each other. If you have minute precision, it sorts all of them by that time value, and the next sorts will do nothing, since they're all already in distinct time values. Instead with day precision, games that fall into the same days will be able to be further sorted based on second and third criteria For example, say you want sorting by last updated, and within each day sort alphabetically. With day precision, first you sort alphabetically, then sort by last updated, and when you find that two items next to each other have the same last updated value, you don't swap them, therefore keeping alphabetical order within each day. If there was minute precision, unless multiple games were updated within the same minute, you'd lose the auxiliary sort.

last played and added on were meant to be the same way, they are marked as datestamps, but apparently it doesn't correctly round the value to the full day

just-Addict commented 5 months ago

Now that is a situation I actually didn't think of. But you're right, including the time would make subsequent sorting on another column within the same day impossible.

That only leaves me to wonder, why do we have a time format field?

Willy-JL commented 5 months ago

Currently just the last successful refresh text in the sidebar. Though the code for timestamps is shared with datestamps, just the formatting is split