updated calendar, dmmain
This commit is contained in:
@@ -2,7 +2,13 @@ from datetime import datetime, timedelta
|
||||
|
||||
from flask import Blueprint, render_template
|
||||
|
||||
from .get_period_times import get_period_totals, read_and_extract, task_file, timezone
|
||||
from .get_period_times import (
|
||||
get_period_totals,
|
||||
read_and_extract,
|
||||
task_file,
|
||||
task_or_none,
|
||||
timezone,
|
||||
)
|
||||
|
||||
dmbp = Blueprint("deskmeter", __name__, url_prefix="/", template_folder="templates")
|
||||
|
||||
@@ -18,14 +24,9 @@ def index(task=None):
|
||||
"""
|
||||
Show total time used in each desktop for today
|
||||
"""
|
||||
if not task:
|
||||
task = read_and_extract(task_file)
|
||||
|
||||
if task == "all":
|
||||
task = None
|
||||
task = task_or_none(task)
|
||||
|
||||
start = datetime.today().replace(hour=0, minute=0, second=0, tzinfo=timezone)
|
||||
|
||||
end = datetime.today().replace(hour=23, minute=59, second=59, tzinfo=timezone)
|
||||
|
||||
rows = get_period_totals(start, end, task)
|
||||
@@ -34,7 +35,14 @@ def index(task=None):
|
||||
|
||||
|
||||
@dmbp.route("/day/<int:month>/<int:day>")
|
||||
def oneday(month, day):
|
||||
@dmbp.route("/day/<string:task>/<int:month>/<int:day>")
|
||||
def oneday(
|
||||
month,
|
||||
day,
|
||||
task=None,
|
||||
):
|
||||
task = task_or_none(task)
|
||||
|
||||
start = datetime(2020, month, day).replace(
|
||||
hour=0, minute=0, second=0, tzinfo=timezone
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user