moved processing into months and month
This commit is contained in:
parent
284885c221
commit
037981040a
22
main.py
22
main.py
@ -121,13 +121,9 @@ def write_calendar(events: list[Event]) -> None:
|
||||
writer.write()
|
||||
|
||||
|
||||
def process_year(MONTHS, monthly_events):
|
||||
"""process full year and return list of events"""
|
||||
events = []
|
||||
for month in range(1, 13):
|
||||
print(f"MONTH: {month}")
|
||||
for week_of_month, week in enumerate(MONTHS[month]):
|
||||
print(week_of_month, week)
|
||||
|
||||
def process_month(MONTHS, monthly_events, week_of_month, week, events):
|
||||
"""process one MONTHS of events"""
|
||||
for day_of_week, day in enumerate(week):
|
||||
if day > 0:
|
||||
"""
|
||||
@ -138,13 +134,23 @@ def process_year(MONTHS, monthly_events):
|
||||
day_events = [x[1:] for x in monthly_events[day_of_week] if week_of_month + 1 in x[0]]
|
||||
print(day_events)
|
||||
print()
|
||||
return events
|
||||
|
||||
|
||||
def process_months(MONTHS, monthly_events):
|
||||
"""process full year of MONTHS and return list of events"""
|
||||
events = []
|
||||
for month in range(1, 13):
|
||||
print(f"MONTH: {month}")
|
||||
for week_of_month, week in enumerate(MONTHS[month]):
|
||||
print(week_of_month, week)
|
||||
events = process_month(MONTHS, monthly_events, week_of_month, week, events)
|
||||
return events
|
||||
|
||||
@click.command()
|
||||
def main():
|
||||
"""create csv file"""
|
||||
events = process_year(MONTHS, monthly_events)
|
||||
events = process_months(MONTHS, monthly_events)
|
||||
events = sort_events(events)
|
||||
write_calendar(events)
|
||||
sys.exit(0)
|
||||
|
Loading…
Reference in New Issue
Block a user