From 465654c1d47a8af5e65d110f57f492e616479b11 Mon Sep 17 00:00:00 2001 From: Zanger67 Date: Fri, 26 Jul 2024 18:16:40 -0700 Subject: [PATCH] asdf --- main.ipynb | 19 +++++++++++++++++-- main.py | 19 +++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/main.ipynb b/main.ipynb index 5a55820..ca5221c 100644 --- a/main.ipynb +++ b/main.ipynb @@ -794,6 +794,7 @@ " if qNo in questionData and questionData[qNo]['date_done'] <= date + timedelta(days=1, hours=12) :\n", " dailiesDict[date] = questionData[qNo].copy()\n", " dailiesDict[date]['date_done'] = date\n", + " questionData[qNo]['categories'].add('Daily')\n", " # print(f'{dailiesDict[date] = }')\n", "\n", " # print(f'{dailiesDict = }')\n", @@ -826,6 +827,7 @@ " if qNo in questionData and questionData[qNo]['date_done'] <= date + timedelta(days=8) :\n", " weekliesDict[date] = questionData[qNo].copy()\n", " weekliesDict[date]['date_done'] = date\n", + " questionData[qNo]['categories'].add('Weekly Premium')\n", "\n", " return weekliesDict" ] @@ -1657,7 +1659,8 @@ " *,\n", " code_length: bool = False,\n", " recent: bool = False,\n", - " daily: bool = False) -> str : # output path\n", + " daily: bool = False,\n", + " weekly: bool = False) -> str : # output path\n", " \n", " df = None\n", " fileName = None\n", @@ -1690,6 +1693,16 @@ " details = 'Dates are for the date I completed the ' + \\\n", " 'question so due to the my time zone and how it lines up with ' + \\\n", " 'UTC, it may be off by a day.\\n\\n'\n", + " elif weekly :\n", + " weeklyQuestionData = parseQuestionsForWeeklies(questionData)\n", + " \n", + " df = byRecentQuestionDataDataframe(weekly)\n", + " fileName = 'Weekly_Questions.md'\n", + " # header_data = f'# [Daily Questions](<{DAILY_URL}>)\\n\\n'\n", + " header_data = f'# Weekly Premium Questions\\n\\n'\n", + " details = 'Dates are for the date I completed the ' + \\\n", + " 'question so due to the my time zone and how it lines up with ' + \\\n", + " 'UTC, it may be off by a day.\\n\\n'\n", " else :\n", " print('Error. No markdown generation specified.')\n", " print()\n", @@ -1888,10 +1901,12 @@ " # written for the question\n", " # code_length_md_path = exportCodeLengthMarkdown(questionData)\n", " print('Generating category lists...')\n", + " dailyQuestions = miscMarkdownGenerations(questionData, daily=True)\n", + " weeklyQuestions = miscMarkdownGenerations(questionData, weekly=True)\n", " byCodeLength = miscMarkdownGenerations(questionData, code_length=True)\n", " byRecentlySolved = miscMarkdownGenerations(questionData, recent=True)\n", - " dailyQuestions = miscMarkdownGenerations(questionData, daily=True)\n", " altSorts = [f'- [Daily Questions](<{dailyQuestions}>)',\n", + " f'- [Weekly Questions](<{weeklyQuestions}>)',\n", " f'- [Questions By Code Length](<{byCodeLength}>)',\n", " f'- [Questions By Recent](<{byRecentlySolved}>)']\n", " \n", diff --git a/main.py b/main.py index f956405..311fb6f 100644 --- a/main.py +++ b/main.py @@ -675,6 +675,7 @@ def parseQuestionsForDailies(questionData: dict) -> Dict[int, Question] : if qNo in questionData and questionData[qNo]['date_done'] <= date + timedelta(days=1, hours=12) : dailiesDict[date] = questionData[qNo].copy() dailiesDict[date]['date_done'] = date + questionData[qNo]['categories'].add('Daily') # print(f'{dailiesDict[date] = }') # print(f'{dailiesDict = }') @@ -704,6 +705,7 @@ def parseQuestionsForWeeklies(questionData: dict) -> Dict[int, Question] : if qNo in questionData and questionData[qNo]['date_done'] <= date + timedelta(days=8) : weekliesDict[date] = questionData[qNo].copy() weekliesDict[date]['date_done'] = date + questionData[qNo]['categories'].add('Weekly Premium') return weekliesDict @@ -1410,7 +1412,8 @@ def miscMarkdownGenerations(questionData: dict, *, code_length: bool = False, recent: bool = False, - daily: bool = False) -> str : # output path + daily: bool = False, + weekly: bool = False) -> str : # output path df = None fileName = None @@ -1443,6 +1446,16 @@ def miscMarkdownGenerations(questionData: dict, details = 'Dates are for the date I completed the ' + \ 'question so due to the my time zone and how it lines up with ' + \ 'UTC, it may be off by a day.\n\n' + elif weekly : + weeklyQuestionData = parseQuestionsForWeeklies(questionData) + + df = byRecentQuestionDataDataframe(weekly) + fileName = 'Weekly_Questions.md' + # header_data = f'# [Daily Questions](<{DAILY_URL}>)\n\n' + header_data = f'# Weekly Premium Questions\n\n' + details = 'Dates are for the date I completed the ' + \ + 'question so due to the my time zone and how it lines up with ' + \ + 'UTC, it may be off by a day.\n\n' else : print('Error. No markdown generation specified.') print() @@ -1630,10 +1643,12 @@ def main(*, recalculateAll: bool = False, noRecord: bool = False) -> None : # written for the question # code_length_md_path = exportCodeLengthMarkdown(questionData) print('Generating category lists...') + dailyQuestions = miscMarkdownGenerations(questionData, daily=True) + weeklyQuestions = miscMarkdownGenerations(questionData, weekly=True) byCodeLength = miscMarkdownGenerations(questionData, code_length=True) byRecentlySolved = miscMarkdownGenerations(questionData, recent=True) - dailyQuestions = miscMarkdownGenerations(questionData, daily=True) altSorts = [f'- [Daily Questions](<{dailyQuestions}>)', + f'- [Weekly Questions](<{weeklyQuestions}>)', f'- [Questions By Code Length](<{byCodeLength}>)', f'- [Questions By Recent](<{byRecentlySolved}>)']