Friday, September 30, 2016

ASA notes - add randomize flag to instructor quiz


##################################################
# add randomize flag to instructor quiz
##################################################

very similar to the active flag.
same UI, table column in the instructor quizzes table (instructor tools)



rails g migration add_randomize_flag_to_instructor_quiz randomize:boolean

add default: true

class AddRandomizeFlagToInstructorQuiz < ActiveRecord::Migration
  def change
    add_column :instructor_quizzes, :randomize, :boolean, default: true
  end
end


we want default to be randomized, but don't want to convert all existing instructor quizzes to be randomized, so after the migration (which sets the randomize flag to 1 for existing quizzes) manually set the randomize flag to 0 for all existing instructor_quizzes:

update `instructor_quizzes` set randomize=0


No comments:

Post a Comment