Skip to content

feat: capture daily snapshots of aggregated task completion data#607

Open
audreypho wants to merge 18 commits intodoubtfire-lms:10.0.xfrom
audreypho:task-completion-snapshots
Open

feat: capture daily snapshots of aggregated task completion data#607
audreypho wants to merge 18 commits intodoubtfire-lms:10.0.xfrom
audreypho:task-completion-snapshots

Conversation

@audreypho
Copy link
Copy Markdown

@audreypho audreypho commented Apr 9, 2026

Description

Adds daily scheduled snapshots of task completion data for each unit aggregated at a tutorial level by task and status.

Fixes # (issue)

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • units_api_test.rb
  • task_completion_snapshot_test.rb
  • unit_model_test.rb

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation if appropriate
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have created or extended unit tests to address my new additions
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

If you have any questions, please contact @macite or @jakerenzella.

@audreypho audreypho changed the title feat: add snapshots of aggregated task completion data feat: capture daily snapshots of aggregated task completion data Apr 9, 2026
@audreypho audreypho marked this pull request as ready for review April 14, 2026 00:24
Copy link
Copy Markdown
Member

@b0ink b0ink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good - we will need to discuss whether we store the aggregated data inside the database or if they should be saved as json files, mainly for easy archiving/compression at the end of the semester

Can you also fix the merge conflicts so i can run the tests? - I recommend to just rollback the migration via rails db:rollback, pull the latest schema changes, then start a new migration so that you have a newer migration timestamp, then re-run the migration with the requested changes (removing foreign key)

Comment thread app/models/unit.rb Outdated
Comment thread db/migrate/20260322143502_create_task_completion_snapshots.rb Outdated
Comment thread db/migrate/20260322143502_create_task_completion_snapshots.rb Outdated
Comment thread app/api/units_api.rb
Comment thread app/api/units_api.rb
Comment thread app/api/units_api.rb Outdated
@audreypho audreypho marked this pull request as draft April 19, 2026 03:39
@audreypho audreypho marked this pull request as ready for review April 20, 2026 10:01
@audreypho audreypho requested a review from b0ink April 20, 2026 10:01
@audreypho audreypho marked this pull request as draft April 20, 2026 14:48
@audreypho audreypho marked this pull request as ready for review April 21, 2026 02:06
Copy link
Copy Markdown
Member

@b0ink b0ink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall workflow is looking really good

Just a few notes about bringing back the task status names, and querying the student's campus so we can bring back the campus filtering in the front end

Can you also please fix the RuboCop errors in the gh actions?

Comment thread app/models/unit.rb Outdated
Comment thread app/models/unit.rb Outdated
Comment thread app/models/unit.rb Outdated
Comment thread app/models/unit.rb Outdated
Comment thread app/models/unit.rb Outdated
@audreypho audreypho requested a review from b0ink April 22, 2026 07:49
Comment on lines +295 to +298
def unit_task_status_snapshot_path(unit, snapshot_timestamp, create: true, archived: true)
snapshot_filename = "#{sanitized_filename(snapshot_timestamp.to_s)}.zip"
File.join(unit_task_status_snapshots_dir(unit, create: create, archived: archived), snapshot_filename)
end
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than storing each snapshot in its own zip file, it would be more efficient to store a single task-status-snapshots.zip in {unit}/analytics/task-status-snapshots.zip where we then place all the CSV files inside.

You'll need to then search for the timestamped snapshot within the ZIP

Comment thread app/models/unit.rb
row['username'],
"#{row['first_name']} #{row['last_name']}",
]
student_details << row['campus_abbreviation'] if includes_campus
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can simplify this by just always including campus in the CSV, so you can remove the includes_campus argument.

task_status_uses_id should be fine to stay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants