ruby on rails - Can you help me figure out what's wrong with my quiz show view? -


in show view, want display multiple choice quiz questions , answers, , add css classes of correct-answer, incorrect-answer, , normal-answer each answer displayed indicate answer 1. answered correctly user 2. answered incorrectly user, or 3. not answered @ (the user picked answer choice). in code, @submitted_quiz.submitted_answers contains answers user inputted.

<% question.answers.each |answer| %> <% @submitted_quiz.submitted_answers.each |submitted_answer| %>  <% if(submitted_answer.content == answer.content && submitted_answer.question.id == answer.question.id && submitted_answer.got_correct) %> <li><span class ='correct-answer'><%= answer.content %> correct </span></li>  <% elsif(submitted_answer.content == answer.content && submitted_answer.question.id == answer.question.id && submitted_answer.got_incorrect) %> <li><span class ='incorrect-answer'><%= answer.content %> incorrect</span></li>  <% else %> <li><span class ='normal-answer'> <%= answer.content %> normal</span></li>  <% end #  if statement%>  <% end # submitted_answers.each do%>  <% end # question.answers.each |answer|%> 

i know did wrong, can't seem fix it. ideas?


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -