- Updated the new_user function in database.py to use db.flush() instead of db.commit() for adding new users. This change ensures that the user object is added to the session without committing the transaction, allowing for better control over database operations.
- Updated LanguageMiddleware and UserIdentityMiddleware to always set cookies for language and user ID, respectively, removing conditional checks for existing cookies. This streamlines the cookie management process and ensures consistent behavior across sessions.
- Added UserIdentityMiddleware to manage user sessions by generating a unique user ID stored in a cookie.
- Implemented logic to update the last seen timestamp for existing users in the database.
- Enhanced ScaleResult model to associate responses with users, improving data tracking and user experience.
- Implemented a new endpoint to download scale results as a CSV file.
- The endpoint retrieves responses based on the scale ID and formats the data, including question IDs and subscale scores, into a CSV format.
- Updated database URL to remove the public directory reference for better file access.
- Introduced created_at field in the ScaleResult model to track response creation time.
- Updated result handling logic in app.py to populate created_at with the current UTC time when saving responses.
- Updated the database model from RawResponse to ScaleResult to better reflect its purpose.
- Adjusted the result handling logic in app.py to utilize the new ScaleResult model for storing user responses.
- Renamed RawResponse model to Response for clarity.
- Changed location field type from String to JSON in the Response model.
- Updated result handling logic to store location as a JSON object instead of a string.
- Changed the SQLALCHEMY_DATABASE_URL to use the public directory for the SQLite database file, ensuring proper access and organization of database resources.