Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve how homeroom grades are stored #1693

Open
kevinrobinson opened this issue May 11, 2018 · 6 comments
Open

Improve how homeroom grades are stored #1693

kevinrobinson opened this issue May 11, 2018 · 6 comments

Comments

@kevinrobinson
Copy link
Contributor

kevinrobinson commented May 11, 2018

Part of #1693.

This came up in feedback from an AP. I was initially assuming this was a small number of classrooms, most of which are substantially separate special education classrooms. I went to confirm that but looks like there's more going on:

Homeroom.all.size
class_list_homerooms = Homeroom.all.where(grade: ['KF', '1', '2', '3', '4', '5']);nil
class_list_homerooms.size

mixed_homerooms = class_list_homerooms.select {|homeroom| homeroom.students.map(&:grade).any? {|grade| grade != homeroom.grade } };nil
mixed_homerooms.size
=> 0.6241610738255033

So that shows a large fraction of classrooms have some mismatch around grade levels. Spot checking a few, it seems this might be partially an Insights bug.

@kevinrobinson
Copy link
Contributor Author

It looks like there's a method https://github.com/studentinsights/studentinsights/blob/master/app/models/homeroom.rb#L12 for updating the Homeroom grade but grepping around it seems to me like it's never called. @alexsoble does any of this ring bells for you? No worries if not, I can look more next week.

@alexsoble
Copy link
Member

@kevinrobinson It's invoked as a hook here:

has_many :students, after_add: :update_grade

@kevinrobinson
Copy link
Contributor Author

@alexsoble ha okay great thanks! That's what I thought but failed at grepping :)

@kevinrobinson
Copy link
Contributor Author

This is an issue today, I patched the db manually:

step 1, clear data bugs (I did not investigate how or why yet):

clear_mismatches = Homeroom.all.includes(:students).select {|homeroom| grades = homeroom.students.map(&:grade).uniq; grades.size == 1 && grades.first != homeroom.grade };nil


k8_clear_mismatches = clear_mismatches.select {|h| !h.school.is_high_school? };nil
puts k8_clear_mismatches.map {|h| [h.id, h.grade, h.students.map(&:grade).uniq, h.school.name].join("\t") }.join("\n");nil

step 2, more complicated homerooms that maybe accurate or data bugs:

mixed_grade_homerooms = Homeroom.all.includes(:students).select {|homeroom| !homeroom.school.is_high_school? }.select {|homeroom| grades = homeroom.students.map(&:grade).uniq; grades.size > 1 };nil
mixed_grade_homerooms.size

@kevinrobinson
Copy link
Contributor Author

The root problem here is that a homeroom doesn't have a grade in the import, and there are mixed grade homerooms. So the approach in https://github.com/studentinsights/studentinsights/blob/master/app/models/homeroom.rb#L12 won't be accurate over time.

I think ideally we'd remove the Homeroom relation altogether in favor of Sections for K8 before the rollover this summer.

@kevinrobinson
Copy link
Contributor Author

Going to split this out of #1722 and leave it for later this summer.

@kevinrobinson kevinrobinson changed the title Classrooms: Investigate mixed grade homerooms Improve how homeroom grades are stored Jun 8, 2018
@kevinrobinson kevinrobinson removed their assignment Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants