updated core function

This commit is contained in:
buenosairesam
2025-02-04 02:19:47 -03:00
parent 4691348754
commit d0f1047b8b
4 changed files with 287 additions and 232 deletions

View File

@@ -2,10 +2,12 @@ import calendar
from datetime import datetime
from pprint import pprint
import pytz
from dmweb.dm import dmbp, get_period_totals, local_date
# import pytz
from dmweb.dm import dmbp
from flask import Blueprint, render_template
from .get_period_times import get_period_totals, timezone
class DMHTMLCalendar(calendar.HTMLCalendar):
# def formatmonth(self, theyear, themonth, withyear=True):
@@ -23,11 +25,14 @@ class DMHTMLCalendar(calendar.HTMLCalendar):
def oneday(self, month, day):
current_year = datetime.today().year
start = datetime(self.dmyear, month, day).replace(hour=0, minute=0, second=0)
start = datetime(self.dmyear, month, day).replace(
hour=0, minute=0, second=0, tzinfo=timezone
)
end = datetime(self.dmyear, month, day).replace(
hour=23, minute=59, second=59, tzinfo=timezone
)
end = datetime(self.dmyear, month, day).replace(hour=23, minute=59, second=59)
rows = get_period_totals(local_date(start), local_date(end), self.task)
rows = get_period_totals(start, end, self.task)
returnstr = "<table class='totaltable'>"
for row in rows:
@@ -57,14 +62,14 @@ class DMHTMLCalendar(calendar.HTMLCalendar):
break
start = datetime(self.dmyear, month, start_day).replace(
hour=0, minute=0, second=0
hour=0, minute=0, second=0, tzinfo=timezone
)
end = datetime(self.dmyear, month, end_day).replace(
hour=23, minute=59, second=59
hour=23, minute=59, second=59, tzinfo=timezone
)
rows = get_period_totals(local_date(start), local_date(end))
rows = get_period_totals(start, end)
returnstr = "<table class='totaltable'>"
for row in rows: