fixed ##225 and ##226

This commit is contained in:
Tim Gröger 2020-03-12 10:16:50 +01:00
parent cc692bb82c
commit b4d648530e
1 changed files with 5 additions and 2 deletions

View File

@ -212,13 +212,16 @@ class UserController(metaclass=Singleton):
1 if oldMonth else now.month 1 if oldMonth else now.month
endDay = 1 endDay = 1
debug.debug("calculate end day of month") debug.debug("calculate end day of month")
lockedYear = lockedYear if lockedMonth != 12 else (lockedYear + 1)
lockedMonth = (lockedMonth + 1) if lockedMonth != 12 else 1
for i in range(1, 8): for i in range(1, 8):
nextMonth = datetime(lockedYear, lockedMonth + 1, i) nextMonth = datetime(lockedYear, lockedMonth, i)
if nextMonth.weekday() == 2: if nextMonth.weekday() == 2:
endDay = i endDay = i
break break
monthLockedEndDate = datetime(lockedYear, lockedMonth + 1, endDay) monthLockedEndDate = datetime(
lockedYear, lockedMonth, endDay) - timedelta(1)
debug.debug("get lock day from database") debug.debug("get lock day from database")
retVal = db.getLockedDay(date.date()) retVal = db.getLockedDay(date.date())
if not retVal: if not retVal: