solresol / solar-panel-astronomy

Doing lunar astronomy using domestic solar panels
The Unlicense
0 stars 0 forks source link

Sweep: fix database bug #16

Open solresol opened 7 months ago

solresol commented 7 months ago

Details

There should be a table called weather_data, not weather. You'll need to fix exporter.py

Checklist - [X] Modify `exporter.py` ✓ https://github.com/solresol/solar-panel-astronomy/commit/e493fde57c01c13b24e28f4c7a48cebe63f22d9b [Edit](https://github.com/solresol/solar-panel-astronomy/edit/sweep/fix_database_bug/exporter.py#L55-L58) - [X] Running GitHub Actions for `exporter.py` ✓ [Edit](https://github.com/solresol/solar-panel-astronomy/edit/sweep/fix_database_bug/exporter.py#L55-L58) - [X] Modify `exporter.py` ! No changes made [Edit](https://github.com/solresol/solar-panel-astronomy/edit/sweep/fix_database_bug/exporter.py#L61-L61) - [X] Running GitHub Actions for `exporter.py` ✗ [Edit](https://github.com/solresol/solar-panel-astronomy/edit/sweep/fix_database_bug/exporter.py#L61-L61) - [X] Modify `exporter.py` ! No changes made [Edit](https://github.com/solresol/solar-panel-astronomy/edit/sweep/fix_database_bug/exporter.py#L78-L78) - [X] Running GitHub Actions for `exporter.py` ✗ [Edit](https://github.com/solresol/solar-panel-astronomy/edit/sweep/fix_database_bug/exporter.py#L78-L78)
ifost-autodev[bot] commented 7 months ago

🚀 Here's the PR! #17

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

[!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 6f20658
Checking exporter.py for syntax errors... ✅ exporter.py has no syntax errors! 1/1 ✓
Checking exporter.py for syntax errors...
✅ exporter.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/solresol/solar-panel-astronomy/blob/6f2065850103e114180c3937b1d680d9e5e21d9d/exporter.py#L51-L124 https://github.com/solresol/solar-panel-astronomy/blob/6f2065850103e114180c3937b1d680d9e5e21d9d/schema.sql#L45-L75

Step 2: ⌨️ Coding

--- 
+++ 
@@ -52,13 +52,13 @@
 def write_sqlite(conn, weather_data, astronomy_data):
     cursor = conn.cursor()
     cursor.execute("""
-    CREATE TABLE IF NOT EXISTS weather (
+    CREATE TABLE IF NOT EXISTS weather_data (
         when_recorded TIMESTAMP,
         clouds FLOAT
     )
     """)
     conn.commit()
-    cursor.execute("DELETE FROM weather")
+    cursor.execute("DELETE FROM weather_data")
     conn.commit()
     cursor.execute("""
     CREATE TABLE IF NOT EXISTS astronomy (
@@ -75,7 +75,7 @@
     cursor.execute("DELETE FROM astronomy")
     conn.commit()
     for i, record in enumerate(weather_data):
-        cursor.execute("INSERT INTO weather (when_recorded, clouds) VALUES (?, ?)", record)
+        cursor.execute("INSERT INTO weather_data (when_recorded, clouds) VALUES (?, ?)", record)
         if i % 1000 == 0:
             conn.commit()
     for i, record in enumerate(astronomy_data):

Ran GitHub Actions for e493fde57c01c13b24e28f4c7a48cebe63f22d9b:
• build:


Step 3: 🔁 Code Review

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


🎉 Latest improvements to Sweep:


💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request. Join Our Discord