hardcoded updates
This commit is contained in:
@@ -2,13 +2,7 @@ from datetime import datetime, timedelta
|
||||
|
||||
from flask import Blueprint, render_template
|
||||
|
||||
from .get_period_times import (
|
||||
get_period_totals,
|
||||
read_and_extract,
|
||||
task_file,
|
||||
task_or_none,
|
||||
timezone,
|
||||
)
|
||||
from .get_period_times import get_period_totals, task_or_none, timezone
|
||||
|
||||
dmbp = Blueprint("deskmeter", __name__, url_prefix="/", template_folder="templates")
|
||||
|
||||
@@ -43,11 +37,11 @@ def oneday(
|
||||
):
|
||||
task = task_or_none(task)
|
||||
|
||||
start = datetime(2020, month, day).replace(
|
||||
start = datetime(2025, month, day).replace(
|
||||
hour=0, minute=0, second=0, tzinfo=timezone
|
||||
)
|
||||
|
||||
end = datetime(2020, month, day).replace(
|
||||
end = datetime(2025, month, day).replace(
|
||||
hour=23, minute=59, second=59, tzinfo=timezone
|
||||
)
|
||||
|
||||
@@ -72,23 +66,18 @@ def period(start, end):
|
||||
|
||||
|
||||
@dmbp.route("/totals")
|
||||
def totals():
|
||||
@dmbp.route("/totals/<string:task>")
|
||||
def totals(task=None):
|
||||
"""
|
||||
Show total time used in each desktop for all time
|
||||
"""
|
||||
|
||||
pipe = [
|
||||
{"$group": {"_id": "$workspace", "totals": {"$sum": "$delta"}}},
|
||||
{"$sort": {"_id": 1}},
|
||||
]
|
||||
task = task_or_none(task)
|
||||
|
||||
rows = []
|
||||
for total in switches.aggregate(pipeline=pipe):
|
||||
rows.append(
|
||||
{
|
||||
"ws": total["_id"],
|
||||
"total": str(timedelta(seconds=total["totals"])),
|
||||
}
|
||||
)
|
||||
start = datetime(2020, 1, 1).replace(hour=0, minute=0, second=0, tzinfo=timezone)
|
||||
|
||||
end = datetime(2030, 1, 1).replace(hour=23, minute=59, second=59, tzinfo=timezone)
|
||||
|
||||
rows = get_period_totals(start, end)
|
||||
|
||||
return render_template("pages.html", rows=rows)
|
||||
|
||||
Reference in New Issue
Block a user