updated calendar, dmmain

This commit is contained in:
buenosairesam
2025-02-04 03:38:21 -03:00
parent d0f1047b8b
commit 706ed2039c
3 changed files with 88 additions and 41 deletions

View File

@@ -6,7 +6,13 @@ from pprint import pprint
from dmweb.dm import dmbp
from flask import Blueprint, render_template
from .get_period_times import get_period_totals, timezone
from .get_period_times import (
get_period_totals,
read_and_extract,
task_file,
task_or_none,
timezone,
)
class DMHTMLCalendar(calendar.HTMLCalendar):
@@ -69,7 +75,7 @@ class DMHTMLCalendar(calendar.HTMLCalendar):
hour=23, minute=59, second=59, tzinfo=timezone
)
rows = get_period_totals(start, end)
rows = get_period_totals(start, end, self.task)
returnstr = "<table class='totaltable'>"
for row in rows:
@@ -112,9 +118,9 @@ class DMHTMLCalendar(calendar.HTMLCalendar):
@dmbp.route("/month")
@dmbp.route("/month/<int:month>")
@dmbp.route("/month/<int:month>/<int:year>")
@dmbp.route("/month/task/<string:task>")
@dmbp.route("/month/<int:month>/task/<string:task>")
@dmbp.route("/month/<int:month>/<int:year>/task/<string:task>")
@dmbp.route("/month/<string:task>")
@dmbp.route("/month/<string:task>/<int:month>")
@dmbp.route("/month/<string:task>/<int:month>/<int:year>")
def month(month=None, year=None, task=None):
usemonth = datetime.today().month
useyear = datetime.today().year
@@ -127,9 +133,7 @@ def month(month=None, year=None, task=None):
cal = DMHTMLCalendar(calendar.SATURDAY)
cal.settask(None)
if task:
cal.settask(task)
cal.settask(task_or_none(task))
cal.setcalmonth(usemonth)
cal.setcalyear(useyear)