Feature/form analytics - #24
Merged
Merged
Conversation
… add AnalyticForm model and related tests for form analytics
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new AnalyticForm model has a nullable/type mismatch for answer_type and a hardcoded FK schema string that should be made consistent to prevent invalid data and future drift.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds support for storing per-session analytic feedback by introducing a new AnalyticForm ORM model and a QuestionType enum to standardize how analytic form answers are typed, with accompanying CRUD/relationship tests and minor test-field naming alignment in document-related tests.
Changes:
- Added
AnalyticFormmodel under theuser_relatedschema with a session relationship and typedanswer_type. - Introduced
QuestionType(TEXT,CHECKBOX,PREDEFINED_TEXT) to standardize analytic form answer types. - Extended tests to cover
AnalyticFormcreation/querying and its session relationship; aligned document tests fromquantitytocount.
File summaries
| File | Description |
|---|---|
| welearn_database/data/models/user_related.py | Adds the AnalyticForm SQLAlchemy model and links it to Session. |
| welearn_database/data/enumeration.py | Adds QuestionType enum used by analytic form answer typing. |
| tests/test_user_related.py | Adds CRUD + relationship tests for AnalyticForm; updates imports accordingly. |
| tests/test_document_related.py | Renames test argument from quantity to count to match model fields. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
jmsevin
approved these changes
Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new
AnalyticFormmodel for storing analytic feedback associated with user sessions, adds theQuestionTypeenumeration to standardize answer types, and updates related tests. It also makes minor naming adjustments for consistency in document-related tests.New Analytic Feedback Model and Related Functionality:
AnalyticFormSQLAlchemy model inuser_related.pyto store analytic feedback forms, including fields for form name, question, answer, answer type, and a relationship to the user session.QuestionTypeenumeration (TEXT,CHECKBOX,PREDEFINED_TEXT) inenumeration.pyto standardize the types of possible answers in analytic forms.Test Enhancements:
AnalyticFormentries intest_user_related.py.test_user_related.pyto includeAnalyticFormandQuestionType.Consistency Improvements:
quantitytocountin three document-related test cases to match the model definition. [1] [2] [3]