Open Lixquid opened 8 years ago
Looking at this code, it took me a bit to understand what it means:
if params[ ( "q" + index.to_s ).to_sym ].nil?
answer = params[ ( "q" + index.to_s ).to_sym ].to_i
@results[ index ] = [
false, # Correct?
false, # Selected Answer
question[ "correct_answer" ], # Actual correct answer
false
]
@submission_error = "Please answer all questions"
else
answer = params[ ( "q" + index.to_s ).to_sym ].to_i
@results[ index ] = [
answer == question[ "correct_answer" ], # Correct?
answer, # Selected Answer
question[ "correct_answer" ], # Actual correct answer
true
]
end
Maybe add a comment to the if explaining that the question key (e.g. q0) isn't in params as it wasn't completed? Or some other refactoring could probably help with the clarity
Also discussed:
@Lixquid Are all of these done?
Small things that can be done on
final/q1-refactor
:@phase
,@item
,@item_next
, and@item_prev