Skip to content

Commit

Permalink
deleted unncessary arguments in create methods
Browse files Browse the repository at this point in the history
  • Loading branch information
danmenloz committed Oct 28, 2019
1 parent fd04912 commit 30605fc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/controllers/quiz_questionnaires_controller.rb
Expand Up @@ -180,7 +180,7 @@ def update_truefalse(question_choice)
end
end

def create_checkbox(question, choice_key, question_num, q_type, q_choices)
def create_checkbox(question, choice_key, q_choices)
q = if q_choices[choice_key][:iscorrect] == 1.to_s
QuizQuestionChoice.new(txt: q_choices[choice_key][:txt], iscorrect: "true", question_id: question.id)
else
Expand All @@ -189,7 +189,7 @@ def create_checkbox(question, choice_key, question_num, q_type, q_choices)
q.save
end

def create_radio(question, choice_key, question_num, q_type, q_choices)
def create_radio(question, choice_key, q_choices)
q = if q_choices[1.to_s][:iscorrect] == choice_key
QuizQuestionChoice.new(txt: q_choices[choice_key][:txt], iscorrect: "true", question_id: question.id)
else
Expand All @@ -198,7 +198,7 @@ def create_radio(question, choice_key, question_num, q_type, q_choices)
q.save
end

def create_truefalse(question, choice_key, question_num, q_type, q_choices)
def create_truefalse(question, choice_key, q_choices)
if q_choices[1.to_s][:iscorrect] == choice_key
q = QuizQuestionChoice.new(txt: "True", iscorrect: "true", question_id: question.id)
q.save
Expand Down Expand Up @@ -246,11 +246,11 @@ def save_choices(questionnaire_id)
q_choices = params[:new_choices][question_num.to_s][q_type]
q_choices.each_key do |choice_key|
if q_type == "MultipleChoiceCheckbox"
create_checkbox(question, choice_key, question_num, q_type, q_choices)
create_checkbox(question, choice_key, q_choices)
elsif q_type == "TrueFalse"
create_truefalse(question, choice_key, question_num, q_type, q_choices)
create_truefalse(question, choice_key, q_choices)
else # MultipleChoiceRadio
create_radio(question, choice_key, question_num, q_type, q_choices)
create_radio(question, choice_key, q_choices)
end
end
question_num += 1
Expand Down

0 comments on commit 30605fc

Please sign in to comment.