-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor milestone answers statistics calculation
- refactor statistics calculation - add `update_stats` function which updates milestones and milestone group statistics - optional `update_existing_statistics` argument - if `True`, then statistics updated using new answers as before - if `False`, then recalculates all statistics using all answers (may be needed if e.g. some junk answers are deleted by an admin) - reduce duplication - `AnswerSession` - add `expired` flag: initially False - set to True by `get_or_create_current_milestone_answer_session` if it was created 7 or more days ago - set to True when stats are updated if it was created 9 days or more ago - includes a grace period to avoid setting a currently in use answer session to expired - once an answer session is expired, then answers can no longer be modified / submitted by the user - this should ensure that answers cannot be modified after they have been included in the statistics - resolves #219 - add `included_in_statistics` flag: initially False - set to True once the answers from this session are included in the statistics - `MilestoneAnswer` - remove `included_in_milestone_statistics` and `included_in_milestonegroup_statistics` flags - this is now done at the level of an answer session rather than for each individual answer - milestone feedback functions - insert a `TrafficLight.invalid.value` instead of raising an exception if there are no statistics for a milestone id or group - no longer recalculate stats when constructing feedback to avoid slowing down a user request in this case - add `/update-milestone-age-scores` admin endpoint to recalculate the statistics - TODO: add tests, add button(s) to admin interface? - TODO: add scheduled calling of this function
- Loading branch information
Showing
14 changed files
with
531 additions
and
690 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.