Skip to content

Commit

Permalink
Update compile_schedule.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremymanning authored Jul 18, 2024
1 parent 5f14899 commit dd9f46c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions compile_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ def load_emoji_mapping(csv_file):
def get_term_and_year(start_date):
date = datetime.strptime(start_date, "%Y-%m-%d")
year = date.year
if date.month == 8 and date.day >= 24 or date.month in [9, 10, 11, 12] or (date.month == 12 and date.day <= 31):
if (date.month == 8 and date.day >= 24) or date.month in [9, 10, 11] or (date.month == 12 and date.day <= 31):
term = "Fall"
elif date.month in [1, 2] or (date.month == 3 and date.day <= 15):
term = "Winter"
elif date.month == 3 and date.day >= 24 or date.month in [4, 5] or (date.month == 6 and date.day <= 7):
elif (date.month == 3 and date.day >= 24) or date.month in [4, 5] or (date.month == 6 and date.day <= 7):
term = "Spring"
else:
term = "Summer"
Expand Down Expand Up @@ -77,7 +77,7 @@ def remove_last_lines(lines, n):
event_title = non_whitespace_lines[1] if len(non_whitespace_lines) > 1 else row["Event Name"]

# Remove the first line (title) and the last two non-whitespace lines
event_content = remove_last_lines(event_content[1:], 2)
event_content = remove_last_lines(event_content, 2)[1:]

# Replace placeholders with actual values
event_content = ''.join(event_content).replace('{DATE}', row['Date']).replace('{TIME}', row['Time']).replace('{LOCATION}', row['Location'])
Expand All @@ -88,6 +88,7 @@ def remove_last_lines(lines, n):
event_content = event_content.replace('**Location:**', '\n**Location:**')

# Replace emojis
event_title = replace_emojis(event_title)
event_content = replace_emojis(event_content)

events_markdown += f"## {event_title}\n\n"
Expand Down

0 comments on commit dd9f46c

Please sign in to comment.