mirror of https://github.com/evilhero/mylar
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:
parent
cbb89e1b60
commit
54eb2bb96d
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue