@@ -37,14 +37,16 @@ def get_cached_data() -> dict:
3737 with open ('index.json' ) as f :
3838 return json .load (f )
3939 except FileNotFoundError :
40- return {"previous_completion" : {}, "last_sunday" : None }
40+ return {'previous_completion' : {}, 'last_sunday' : None }
41+
4142
4243def get_last_sunday () -> str :
4344 today = date .today ()
4445 offset = today .weekday () + 1
4546 last_sunday = today - timedelta (days = offset )
4647 return last_sunday .isoformat ()
4748
49+
4850def update_previous_completion (cached_data : dict , completion_progress : list ):
4951 current_sunday = get_last_sunday ()
5052 if cached_data .get ('last_sunday' ) != current_sunday :
@@ -53,13 +55,14 @@ def update_previous_completion(cached_data: dict, completion_progress: list):
5355 }
5456 cached_data ['last_sunday' ] = current_sunday
5557
58+
5659def save_index_json (cached_data : dict , completion_progress : list ):
5760 with open ('index.json' , 'w' ) as f :
5861 json .dump (
5962 {
60- " last_sunday" : cached_data ['last_sunday' ],
61- " previous_completion" : cached_data ['previous_completion' ],
62- " languages" : [asdict (item ) for item in completion_progress ],
63+ ' last_sunday' : cached_data ['last_sunday' ],
64+ ' previous_completion' : cached_data ['previous_completion' ],
65+ ' languages' : [asdict (item ) for item in completion_progress ],
6366 },
6467 f ,
6568 indent = 2 ,
0 commit comments