Skip to content

Instantly share code, notes, and snippets.

@renaehodgkins
Created October 22, 2012 19:52
Show Gist options
  • Save renaehodgkins/3933670 to your computer and use it in GitHub Desktop.
Save renaehodgkins/3933670 to your computer and use it in GitHub Desktop.
desc "Reverses current score for heart and start"
task :reverse_score => :environment do
Observation.where(:current_score && !:option_value).compact.each do |observation|
next unless observation.assessment
if observation.assessment.heart?
observation.option_value = observation.current_score.abs + 1
else
observation.option_value = observation.current_score.abs + 5
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment