mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Minor improvements
This commit is contained in:
parent
86f8d5a3eb
commit
98ec5885e7
@ -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"))
|
||||
|
||||
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
<br/>
|
||||
|
||||
<span class="button" onclick="scrobbleNew(event)">Scrobble!</span>
|
||||
<span class="button" onclick="repeatLast()">Last Manual Scrobble</span>
|
||||
<span class="button" onclick="repeatLast()">↻</span>
|
||||
|
||||
<br/>
|
||||
|
||||
|
@ -16,15 +16,17 @@
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
Kazuma, Aqua, Darkness and Megumin have been dispatched to deal with this situation.<br/><br/>
|
||||
{% if adminmode %}
|
||||
You are only seeing this information because you are in admin mode:
|
||||
<br/><br/>
|
||||
<div style="white-space: pre-wrap; font-family: monospace;">{% autoescape true -%}
|
||||
{{ traceback }}
|
||||
{%- endautoescape %}</div>
|
||||
{% else %}
|
||||
Kazuma, Aqua, Darkness and Megumin have been dispatched to deal with this situation.
|
||||
<br/><br/>
|
||||
If you think this shouldn't have happened, consider
|
||||
<a class='textlink' href="https://github.com/krateng/maloja/issues/new">opening an issue</a>
|
||||
describing the situation.
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user