1
0
mirror of https://github.com/TheFunny/ArisuAutoSweeper synced 2025-12-16 22:05:12 +00:00

perf: use more friendly record time on dashboard

This commit is contained in:
YoursFunny 2023-11-21 20:27:19 +08:00
parent eb9af42f38
commit b4f18f78ff
Signed by: YoursFunny
GPG Key ID: 207EDC3CD5B40F9C

View File

@ -89,12 +89,15 @@ def readable_time(before: str) -> str:
elif diff < 60:
# < 1 min
return t("Gui.Dashboard.JustNow")
elif diff < 3600:
elif diff < 5400:
# < 90 min
return t("Gui.Dashboard.MinutesAgo", time=int(diff // 60))
elif diff < 86400:
elif diff < 129600:
# < 36 hours
return t("Gui.Dashboard.HoursAgo", time=int(diff // 3600))
elif diff < 1296000:
# < 15 days
return t("Gui.Dashboard.DaysAgo", time=int(diff // 86400))
else:
# > 15 days
# >= 15 days
return t("Gui.Dashboard.LongTimeAgo")