Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new test user jim_dun to the seed data system and updates the test_seeds:destroy rake task to clean up data associated with this user. The PR also includes minor improvements to array syntax in the cleanup logic.
Changes:
- Added
jim_duntest user UUID toTEST_USERSconstant inseeds_helper.rb - Updated
test_seeds:destroytask to clean up roles and optionally schools created by thejim_dunuser - Refactored array syntax to remove unnecessary nested array wrapping
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| lib/tasks/seeds_helper.rb | Adds jim_dun UUID to TEST_USERS hash with comment indicating "user with no school" |
| lib/tasks/test_seeds.rake | Adds cleanup logic for jim_dun's roles and school; refactors array syntax in where clauses |
lib/tasks/test_seeds.rake
Outdated
| Lesson.where(id: lesson_ids).delete_all | ||
|
|
||
| # Destroy the class members and then the class itself | ||
| school_class_ids = SchoolClass.where(school_id:).pluck(:id) |
There was a problem hiding this comment.
The SchoolClass cleanup only handles the primary school_id, not the teacher_signup_school_id. If jim_dun has created a school with classes and class members, those won't be cleaned up before the school is destroyed at line 40.
Consider extending the cleanup to include both schools:
school_class_ids = SchoolClass.where(school_id: [school_id, teacher_signup_school_id].compact).pluck(:id)| school_class_ids = SchoolClass.where(school_id:).pluck(:id) | |
| school_class_ids = SchoolClass.where(school_id: [school_id, teacher_signup_school_id].compact).pluck(:id) |
mwtrew
left a comment
There was a problem hiding this comment.
Could you take a look at these Copilot suggestions before we merge this in?
Just looking at this now. The tests are not running again properly so I'll try fix these |
What's changed?