diff --git a/titles/idac/service/season3/team_service.py b/titles/idac/service/season3/team_service.py index 6063432..954752e 100644 --- a/titles/idac/service/season3/team_service.py +++ b/titles/idac/service/season3/team_service.py @@ -257,22 +257,19 @@ class IDACSeason3TeamService: now = datetime.now() - # create timestamp for today at 1am - this_day = now.replace(hour=1, minute=0, second=0, microsecond=0) + # create timestamp for today at 12am + start_of_today = now.replace(hour=0, minute=0, second=0, microsecond=0) - # check if this_day is greater than or equal to create_date_daily - if this_day >= team_member_ranking_dto.create_date_daily: - # reset the daily stamp + # if their last claim was before today started, reset it + if team_member_ranking_dto.create_date_daily < start_of_today: team_member_ranking_dto.create_date_daily = now daily_bonus = 0 - # create a timestamp for this monday at 1am - this_monday = now - timedelta(days=now.weekday()) - this_monday = this_monday.replace(hour=1, minute=0, second=0, microsecond=0) + # find the monday of the current week at 12am + start_of_this_monday = start_of_today - timedelta(days=start_of_today.weekday()) - # check if this_monday is greater than or equal to create_date_weekly - if this_monday >= team_member_ranking_dto.create_date_weekly: - # reset the weekly stamp + # if their last claim was before this monday, reset it + if team_member_ranking_dto.create_date_weekly < start_of_this_monday: team_member_ranking_dto.create_date_weekly = now weekly_bonus = 0 @@ -659,12 +656,12 @@ class IDACSeason3TeamService: before_user_ranking = member.ranking break - # update daily and weekly bonus - if team_update.team_daily_bonus: + # update daily and weekly bonus if previously not received + if team_update.team_daily_bonus and not team_member_ranking.daily_bonus: team_member_ranking.daily_bonus = team_update.team_daily_bonus team_member_ranking.create_date_daily = datetime.now() - if team_update.team_weekly_bonus: + if team_update.team_weekly_bonus and not team_member_ranking.weekly_bonus: team_member_ranking.weekly_bonus = team_update.team_weekly_bonus team_member_ranking.create_date_weekly = datetime.now()