1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2024-12-21 23:32:23 +00:00

FIX: fix for week 52-2019 showing up with no entries - will now automatically flip to week 0-2020 to avoid empty pullists

This commit is contained in:
evilhero 2019-12-29 20:10:48 -05:00
parent cbb89e1b60
commit 54eb2bb96d

View file

@ -2940,6 +2940,14 @@ def weekly_info(week=None, year=None, current=None):
weeknumber = 51
year = 2018
#monkey patch for 2019/2020 - week 52/week 0
if all([weeknumber == 52, c_weeknumber == 51, c_weekyear == 2019]):
weeknumber = 0
year = 2020
elif all([weeknumber == 52, c_weeknumber == 0, c_weekyear == 2020]):
weeknumber = 51
year = 2019
#view specific week (prev_week, next_week)
startofyear = date(year,1,1)
week0 = startofyear - timedelta(days=startofyear.isoweekday())
@ -2960,6 +2968,14 @@ def weekly_info(week=None, year=None, current=None):
weeknumber = 51
year = 2018
#monkey patch for 2019/2020 - week 52/week 0
if all([weeknumber == 52, c_weeknumber == 51, c_weekyear == 2019]) or all([weeknumber == '52', year == '2019']):
weeknumber = 0
year = 2020
elif all([weeknumber == 52, c_weeknumber == 0, c_weekyear == 2020]):
weeknumber = 51
year = 2019
stweek = datetime.datetime.strptime(todaydate.strftime('%Y-%m-%d'), '%Y-%m-%d')
startweek = stweek - timedelta(days = (stweek.weekday() + 1) % 7)
midweek = startweek + timedelta(days = 3)