canvas-lms/db/migrate/20111209171640_recalculate_...

18 lines
395 B
Ruby

class RecalculateMutedAssignments < ActiveRecord::Migration
tag :predeploy
def self.up
course_ids = Assignment.where(:muted => true, :context_type => 'Course').select(:context_id).uniq.map(&:context_id)
course_ids.each do |id|
c = Course.find id
c.recompute_student_scores
end
end
def self.down
raise ActiveRecord::IrreversibleMigration
end
end