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

Teacher app: Rescore taught in past #27287

Merged
merged 10 commits into from Mar 8, 2019
Merged

Conversation

clareconstantine
Copy link

@clareconstantine clareconstantine commented Feb 27, 2019

Rescore the question about what CS courses you've taught previously to give bonus points if their answer doesn't include anything except:

  • CS Fundamentals
  • Robotics
  • ScratchEd
  • CS in Algebra
  • CS in Science
  • I don't have experience teaching any...

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.

@clareconstantine clareconstantine changed the title Rescore taught in past Teacher app: Rescore taught in past Feb 27, 2019
@@ -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
Copy link
Contributor

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?


# 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|
Copy link
Contributor

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/

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
Copy link
Contributor

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|
Copy link
Contributor

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?

@clareconstantine clareconstantine merged commit 3d96e3d into staging Mar 8, 2019
@clareconstantine clareconstantine deleted the rescore-taught-in-past branch March 8, 2019 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants