Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sprint dates now correctly set for 2023 #22

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it!


#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
Comment on lines +21 to +22
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great explanation!


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)
Comment on lines +37 to +39
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's talk about what this is doing during our meeting today.

##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