Skip to content

Commit

Permalink
Fixed sprint dates for 2023)
Browse files Browse the repository at this point in the history
q
  • Loading branch information
finnveloz committed May 1, 2024
1 parent 6e006d3 commit 14564a2
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,33 @@

def get_sprintdates():
today = datetime.now(timezone.utc)


iso_calendar_info = today.isocalendar()

#today=datetime(2024,5,12,tzinfo=timezone.utc)
# Extract the week number from the ISO calendar information
week_number = iso_calendar_info[1]
first_day_of_year = datetime(today.year, 1, 1, tzinfo=timezone.utc)
full_weeks_since_year_start = (today - first_day_of_year).days // 7

## We add a plus one because the integer divison can only find what week you are in by measuring how many full weeks have passed,
## and so we still need to account for the current week we are in
week_number =full_weeks_since_year_start + 1
#if first day of year is thursday or later, the isocalendar method i am using will not count that week as a week
##so this code counts it as a week if it starts on any day other than saturday

if first_day_of_year.isocalendar()[2] > 4 and first_day_of_year.isocalendar()[2]<7:
# Increment the week number by 1
week_number+=1




#today=datetime(2024,5,12,tzinfo=timezone.utc)





if(first_day_of_year.weekday()==6):
while first_day_of_year.weekday() != 0: # 0 represents Monday
first_day_of_year += timedelta(days=1)
##gets find_right_monday to right week
find_right_monday = first_day_of_year + timedelta(weeks=week_number)

Expand All @@ -34,7 +49,7 @@ def get_sprintdates():
sprint_start = find_right_monday
sprint_end = sprint_start + timedelta(days=4) + timedelta(weeks=1)

print(f'Week Number: {week_number}')
print(f'Week number {week_number}')
return sprint_start, sprint_end

def get_bullet_points(full_description,i):
Expand Down

0 comments on commit 14564a2

Please sign in to comment.