blinklet / music-festival-organizer

Music Festival Organizer for competitive music festivals
Other
0 stars 0 forks source link

Enable review and conirmation of issues before committing changes to database #1

Closed blinklet closed 3 months ago

blinklet commented 3 months ago

Currently, we need to read in data from a Google sheet that contains all the responses from the Google form used to register new entries.

The program currently displays all issues found in the imported and then commits the changes to the database.

Let's create a step where the user gets to review the issues and then cancel or confirm the database changes.

Why? Some issue are easier to fix in the spreadsheet before they are committed to the database.

blinklet commented 3 months ago

The problem is that I need to make a POST request when I get the file and another POST request to accept the changes. But these create different contexts so any changes I make in the database session after uploading and processing the file are lost when I redirect to the route that handles the confirmation form.

I tried using HTMX to make all actions occur in the same page but I still have to make new requests to the server to confirm the form and this creates a different context with a new db session so it contains no changes to commit.

The solution may be to save the imported dataframe in a cache so it is available to the confirm route. Then, I will work with the upload session to add chenges to the session, so I can detect issues between the spreadsheet and the database. Then, roll back the changes and present the issues list to the user. Cache the initial dataframe.

The confirm route will get the dataframe from the cache and run the same processing code but this time it will not display issues and just commit the changes.