add lifetime range

This commit is contained in:
2026-08-11 22:30:13 +07:00
parent 614f205ae5
commit 1aaf5028ff
3 changed files with 13 additions and 1 deletions
+3 -1
View File
@@ -588,6 +588,8 @@ def range_bounds(name):
start = now - dt.timedelta(days=7)
elif name == "30d":
start = now - dt.timedelta(days=30)
elif name == "lifetime":
start = dt.datetime(1970, 1, 1, tzinfo=LOCAL_TZ) # epoch start - all records
else:
start = now.replace(hour=0, minute=0, second=0, microsecond=0)
return start.astimezone(dt.timezone.utc).timestamp(), now.astimezone(dt.timezone.utc).timestamp()
@@ -837,7 +839,7 @@ def main():
quota_p = sub.add_parser("quota", help="Show current quota snapshots")
quota_p.add_argument("--force", action="store_true")
report_p = sub.add_parser("report", help="Print usage summary as JSON")
report_p.add_argument("range", choices=["today", "1h", "5h", "24h", "7d", "30d"])
report_p.add_argument("range", choices=["today", "1h", "5h", "24h", "7d", "30d", "lifetime"])
args = parser.parse_args()
if args.cmd == "init":
init_db()