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

16 lines
377 B
Ruby
Raw Normal View History

class RecalculateMutedAssignments < ActiveRecord::Migration
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