I can track numCows and weightedAvgCowHealth every 6 hours
so that I can better track what's happening over the course of the game
Discussion
There is an existing feature to generate reports.
In addition, and in a similar manner, Prof. deVries would like to track a small number of statistics over time. Here's what he says:
What would be nice would be a simple report showing just the overall health and total > number of cows of a chosen commons as a function of time. The time interval could
be 6 hours or something like that.
Would that be hard?
Acceptance Criteria
[ ] First thing that should be true when story is done.
[ ] Second thing that should be true when story is done.
Implementation Todos
suggested implementation steps
Average cow health service
[x] There is a new service with a method that, when given a commons id, will return the weighted average of the health of all cows in the commons across all users.
Backend for stats
[x] There is a CommonsStats entity with id, commonsId, numCows, avgHealth, and a timestamp (make the timestamp similar to the one for reports and reportlines), and a CommonsStatsRepository to go along with it.
[x] There is a job that will compute the stats for all games in progress and create one new row in the CommonsStats table for each commons. It will use the Average Cow Health Service to compute the cowhealth for each commons.
[x] There is a scheduled job that runs this job each 6 hours.
[x] There is an endpoint in the Jobs Controller to run the job on demand.
Frontend for stats
[x] Note: The Admin/Jobs page does not need a place to run this job on demand.
[x] On the admin list commons page, there is a Download Stats CSV button where the user can download a CSV of all of the available stats records for that commons.
User Story
Discussion
There is an existing feature to generate reports.
In addition, and in a similar manner, Prof. deVries would like to track a small number of statistics over time. Here's what he says:
Acceptance Criteria
Implementation Todos
suggested implementation steps
Average cow health service
Backend for stats
Frontend for stats