diff --git a/maloja/malojatime.py b/maloja/malojatime.py index e78a67d..3355399 100644 --- a/maloja/malojatime.py +++ b/maloja/malojatime.py @@ -486,25 +486,25 @@ def timestamp_desc(t,short=False): timeobj = datetime.fromtimestamp(t,tz=TIMEZONE) - if short: - difference = int(datetime.now().timestamp() - t) + if not short: return timeobj.strftime(get_settings("TIME_FORMAT")) - thresholds = ( - (10,"just now"), - (2*60,f"{difference} seconds ago"), - (2*60*60,f"{difference/60:.0f} minutes ago"), - (2*24*60*60,f"{difference/(60*60):.0f} hours ago"), - (5*24*60*60,f"{timeobj.strftime('%A')}"), - (31*24*60*60,f"{difference/(60*60*24):.0f} days ago"), - (12*31*24*60*60,f"{timeobj.strftime('%B')}"), - (math.inf,f"{timeobj.strftime('%Y')}") - ) + difference = int(datetime.now().timestamp() - t) + + thresholds = ( + (10,"just now"), + (2*60,f"{difference} seconds ago"), + (2*60*60,f"{difference/60:.0f} minutes ago"), + (2*24*60*60,f"{difference/(60*60):.0f} hours ago"), + (5*24*60*60,f"{timeobj.strftime('%A')}"), + (31*24*60*60,f"{difference/(60*60*24):.0f} days ago"), + (12*31*24*60*60,f"{timeobj.strftime('%B')}"), + (math.inf,f"{timeobj.strftime('%Y')}") + ) + + for t,s in thresholds: + if difference < t: return s - for t,s in thresholds: - if difference < t: return s - else: - return timeobj.strftime(get_settings("TIME_FORMAT")) diff --git a/maloja/web/jinja/admin_manual.jinja b/maloja/web/jinja/admin_manual.jinja index 6815bd7..8e91a02 100644 --- a/maloja/web/jinja/admin_manual.jinja +++ b/maloja/web/jinja/admin_manual.jinja @@ -31,7 +31,7 @@
Scrobble! - Last Manual Scrobble +
diff --git a/maloja/web/jinja/error.jinja b/maloja/web/jinja/error.jinja index f393cab..3654bd3 100644 --- a/maloja/web/jinja/error.jinja +++ b/maloja/web/jinja/error.jinja @@ -16,15 +16,17 @@ - + Kazuma, Aqua, Darkness and Megumin have been dispatched to deal with this situation.

{% if adminmode %} You are only seeing this information because you are in admin mode:

{% autoescape true -%} {{ traceback }} {%- endautoescape %}
- {% else %} - Kazuma, Aqua, Darkness and Megumin have been dispatched to deal with this situation. +

+ If you think this shouldn't have happened, consider + opening an issue + describing the situation. {% endif %}