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
Teacher app: Rescore taught in past #27287
Conversation
@@ -505,7 +505,7 @@ def auto_score! | |||
meets_scholarship_criteria_scores[:previous_yearlong_cdo_pd] = responses[:previous_yearlong_cdo_pd].exclude?('CS Principles') ? YES : NO | |||
end | |||
|
|||
bonus_points_scores[:taught_in_past] = responses[:taught_in_past] == [options[:taught_in_past].last] ? 2 : 0 | |||
bonus_points_scores[:taught_in_past] = (responses[:taught_in_past] & options[:taught_in_past].values_at(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 15)).any? ? 0 : 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relying on the indexes here seems unnecessarily fragile. Could this be pulled out into a helper method that's more explicit about the values we care about?
bin/oneoff/rescore_taught_in_past
Outdated
|
||
# append to the file as we go, so that in case we encounter an exception and exit early, | ||
# we have a record of the applications we've updated. | ||
File.open('rescored_applications', 'a') do |list| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit; this should probably be in /tmp/
bin/oneoff/rescore_taught_in_past
Outdated
response_scores = JSON.parse(application.response_scores) | ||
|
||
old_taught_in_past_score = response_scores["bonus_points_scores"] ? response_scores["bonus_points_scores"]["taught_in_past"] : nil | ||
new_taught_in_past_score = (responses[:taught_in_past] & options[:taught_in_past].values_at(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 15)).any? ? 0 : 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this should probably also use TAUGHT_IN_PAST_NO_BONUS_POINT_RESPONSES
, although fragility for a one-off script is much less frightening
raise | ||
end | ||
|
||
File.open('./tmp/rescored_applications', 'w') do |file| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why ./tmp
rather than /tmp
?
Rescore the question about what CS courses you've taught previously to give bonus points if their answer doesn't include anything except:
There is a script to rescore previous applications and produce a list of the changed applications sorted by regional partner for Anthonette to notify partners.