jdriscoll98 / daily-summary

daily-summary
0 stars 0 forks source link

Sweep: Add --date arg to create a report for any date #2

Closed jdriscoll98 closed 9 months ago

jdriscoll98 commented 9 months ago

Add non required --date arg to main.py

Pass this arg to extract_git_data and use in that file Also pass to generate to create the filename using the date

default to today if no date is passed in

Checklist - [X] Modify `daily_summary/main.py` ✓ https://github.com/jdriscoll98/daily-summary/commit/507ed451502a237fe143035a7f691faf48f43f51 [Edit](https://github.com/jdriscoll98/daily-summary/edit/sweep/add_date_arg_to_create_a_report_for_any/daily_summary/main.py#L7-L32) - [X] Running GitHub Actions for `daily_summary/main.py` ✓ [Edit](https://github.com/jdriscoll98/daily-summary/edit/sweep/add_date_arg_to_create_a_report_for_any/daily_summary/main.py#L7-L32) - [X] Modify `daily_summary/git_data_extract.py` ✓ https://github.com/jdriscoll98/daily-summary/commit/a464d38a453222620017ddd73040b5b968e8cee4 [Edit](https://github.com/jdriscoll98/daily-summary/edit/sweep/add_date_arg_to_create_a_report_for_any/daily_summary/git_data_extract.py#L6-L30) - [X] Running GitHub Actions for `daily_summary/git_data_extract.py` ✓ [Edit](https://github.com/jdriscoll98/daily-summary/edit/sweep/add_date_arg_to_create_a_report_for_any/daily_summary/git_data_extract.py#L6-L30) - [X] Modify `daily_summary/generate_daily_summary.py` ✓ https://github.com/jdriscoll98/daily-summary/commit/1d1eeff0b4bdb6badf6fe586c4f9e4332b5c7bc1 [Edit](https://github.com/jdriscoll98/daily-summary/edit/sweep/add_date_arg_to_create_a_report_for_any/daily_summary/generate_daily_summary.py#L35-L48) - [X] Running GitHub Actions for `daily_summary/generate_daily_summary.py` ✓ [Edit](https://github.com/jdriscoll98/daily-summary/edit/sweep/add_date_arg_to_create_a_report_for_any/daily_summary/generate_daily_summary.py#L35-L48)
jdriscoll98 commented 9 months ago

🚀 Here's the PR! #9

See Sweep's progress at the progress dashboard!
💎 Sweep Pro: I'm using GPT-4. You have unlimited GPT-4 tickets. (tracking ID: None)
Install Sweep Configs: Pull Request

[!TIP] I can email you next time I complete a pull request if you set up your email here!


Actions (click)

GitHub Actions✓

Here are the GitHub Actions logs prior to making any changes:

Sandbox logs for 3a06165
Checking daily_summary/main.py for syntax errors... ✅ daily_summary/main.py has no syntax errors! 1/1 ✓
Checking daily_summary/main.py for syntax errors...
✅ daily_summary/main.py has no syntax errors!

Sandbox passed on the latest main, so sandbox checks will be enabled for this issue.


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I think are relevant in decreasing order of relevance (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/jdriscoll98/daily-summary/blob/00329f4ccddfe2a8d2331f7830df65e704622973/daily_summary/main.py#L1-L33 https://github.com/jdriscoll98/daily-summary/blob/00329f4ccddfe2a8d2331f7830df65e704622973/daily_summary/git_data_extract.py#L1-L31 https://github.com/jdriscoll98/daily-summary/blob/00329f4ccddfe2a8d2331f7830df65e704622973/daily_summary/generate_daily_summary.py#L1-L49

Step 2: ⌨️ Coding

--- 
+++ 
@@ -1,4 +1,5 @@
 import argparse
+from datetime import datetime
 from .generate_daily_summary import generate
 from .summarize_diff import summarize_all_diffs
 from .git_data_extract import extract_git_data
@@ -18,16 +19,18 @@
         required=True,
     )
     # Add arguments as needed. For example:
-    # parser.add_argument('--date', help='Date for the report', required=True)
+    parser.add_argument('--date', help='Date for the report in YYYY-MM-DD format', default=None)

     args = parser.parse_args()
+    if args.date is None:
+        args.date = datetime.now().date()
     print("Generating daily development report...")
     print("Extracting git data...")
-    extract_git_data(args.repo, args.author)  # Example usage
+    extract_git_data(args.repo, args.author, args.date)  # Pass date to extract_git_data
     print("Summarizing diffs...")
     summarize_all_diffs()
     print("Generating daily summary...")
-    generate()
+    generate(args.date)  # Pass date to generate
     # clean up the diffs.json file and summaries.txt file
     os.remove("diffs.json")
     os.remove("summaries.txt")

Ran GitHub Actions for 507ed451502a237fe143035a7f691faf48f43f51:

--- 
+++ 
@@ -4,7 +4,7 @@

 # Replace with your repository's path
-def extract_git_data(repo_path, author):
+def extract_git_data(repo_path, author, date):
     repo = git.Repo(repo_path)

     today = datetime.now().date()

Ran GitHub Actions for a464d38a453222620017ddd73040b5b968e8cee4:

--- 
+++ 
@@ -33,7 +33,7 @@
     return response.choices[0].message.content

-def generate():
+def generate(date):
     # Read the diffs from the JSON file
     with open("summaries.txt", "r") as file:
         summaries = file.read()
@@ -46,5 +46,5 @@
         os.makedirs("daily-summary")

     # Writing daily summary to a file named after the date
-    with open(f"daily-summary/{date}.md", "w") as file:
+    with open(f"daily-summary/{date.strftime('%Y-%m-%d')}.md", "w") as file:
         file.write(report)

Ran GitHub Actions for 1d1eeff0b4bdb6badf6fe586c4f9e4332b5c7bc1:


Step 3: 🔁 Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/add_date_arg_to_create_a_report_for_any.


🎉 Latest improvements to Sweep:
  • New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
  • Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
  • Use the GitHub issues extension for creating Sweep issues directly from your editor.

💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request.Something wrong? Let us know.