moved processing from main to process_year
This commit is contained in:
		
							parent
							
								
									ea9d02a03a
								
							
						
					
					
						commit
						284885c221
					
				
							
								
								
									
										29
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								main.py
									
									
									
									
									
								
							| @ -120,20 +120,12 @@ def write_calendar(events: list[Event]) -> None: | |||||||
|         writer.map("event_description").to("EVENT DESCRIPTION") |         writer.map("event_description").to("EVENT DESCRIPTION") | ||||||
|         writer.write() |         writer.write() | ||||||
| 
 | 
 | ||||||
| @click.command() |  | ||||||
| def main(): |  | ||||||
|     """create csv file""" |  | ||||||
|     events: list[Event] = [] |  | ||||||
|     for month, weeks in MONTHS.items(): |  | ||||||
|         add_tuesdays(events, YEAR, month, weeks) |  | ||||||
|         add_wednesdays(events, YEAR, month, weeks) |  | ||||||
|         add_thursdays(events, YEAR, month, weeks) |  | ||||||
|         add_fridays(events, YEAR, month, weeks) |  | ||||||
|         add_saturdays(events, YEAR, month, weeks) |  | ||||||
|         add_sundays(events, YEAR, month, weeks) |  | ||||||
| 
 | 
 | ||||||
|     """ | def process_year(MONTHS, monthly_events): | ||||||
|     month = 1 |     """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]): |         for week_of_month, week in enumerate(MONTHS[month]): | ||||||
|             print(week_of_month, week) |             print(week_of_month, week) | ||||||
|             for day_of_week, day in enumerate(week): |             for day_of_week, day in enumerate(week): | ||||||
| @ -146,8 +138,15 @@ def main(): | |||||||
|                     day_events = [x[1:] for x in monthly_events[day_of_week] if week_of_month + 1 in x[0]] |                     day_events = [x[1:] for x in monthly_events[day_of_week] if week_of_month + 1 in x[0]] | ||||||
|                     print(day_events) |                     print(day_events) | ||||||
|             print() |             print() | ||||||
|     # events = sort_events(events) | 
 | ||||||
|     # write_calendar(events) |     return events | ||||||
|  | 
 | ||||||
|  | @click.command() | ||||||
|  | def main(): | ||||||
|  |     """create csv file""" | ||||||
|  |     events = process_year(MONTHS, monthly_events)  | ||||||
|  |     events = sort_events(events) | ||||||
|  |     write_calendar(events) | ||||||
|     sys.exit(0) |     sys.exit(0) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user