updated calendar, dmmain
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user