You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently it is done as part of the request if the statistics are out of date, which may result in an occasional very slow request.
It would be nicer to have this functionality as a separate function with an endpoint, that can run automatically e.g. once a week, and also be ran by an admin on demand from the admin interface.
- refactor statistics calculation
- add `update_stats` function which updates milestones and milestone group statistics
- optional `incremental` argument
- if `True`, then statistics updated with any new answers since last calculation (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)
- add apscheduler to schedule regular calls of this function (based on 271c75e)
- add `STATS_CRONTAB` to app settings to allow the schedule to be set, with a default crontab of 3am every monday
- add fastapi_injectable to allow use of fastapi dependencies outside of fastapi routes
- reduce duplication
- resolves#203
- `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
Currently it is done as part of the request if the statistics are out of date, which may result in an occasional very slow request.
It would be nicer to have this functionality as a separate function with an endpoint, that can run automatically e.g. once a week, and also be ran by an admin on demand from the admin interface.
see 271c75e for partial implementation
The text was updated successfully, but these errors were encountered: