app/views/users/history.html.erb

Summary

Maintainability
Test Coverage
<% provide(:title, "Deine bisherigen Fragen") %>

<div>
  <h2>Historie</h2>
</div>

<% @stats.each do |s| %>
  <%
    next if s.question.nil?
    q = s.question

    kls = ""
    kls = "correct" if s.correct?
    kls = "wrong" if s.wrong?
  %>

  <div class="<%= kls %> box">
    <h3 class="count"><small>(vor <%=time_ago_in_words s.created_at %>)</small> Frage </h3>
    <script>
      document.write(renderStarred({id: <%=q.id%>, starred: <%=@user.starred.include?(q)%>}));
    </script>
    <%=render_tex q.text %>
    <br/>
    <% if s.skipped? %>
      <% if q.matrix_validate? %>
        <strong>Antwort:</strong> Das Rechenergebnis wäre in ein Textfeld einzutragen.
      <% else %>
        <strong>Antwortmöglichkeiten:</strong>
        <ul style="margin-top: 10px;margin-bottom:0">
          <% q.answers.each do |a| %>
            <li><%=render_tex a.text %></li>
          <% end %>
        </ul>
      <% end %>
      Du hast diese Frage übersprungen. Daher wird Dir das Ergebnis nicht angezeigt.
    <% else # skipped %>
      <% if q.matrix_validate? %>
        <div style="float:left">
          <strong>Deine Antwort:</strong>
          <%=render_tex short_matrix_str_to_tex(s.selected_answers.first.to_s) %>
        </div>
        <div style="float:left;margin-left:20px;">
          <strong>richtige Antwort:</strong>
          <%=render_tex q.answers.first.text %>
        </div>
        <br class="clear"/>
      <% else %>
        <strong>Antwortmöglichkeiten:</strong>
        <div class="answer-chooser noHide">
          <% q.answers.each do |a| %>
            <div><div><%=render_tex a.text%></div><span><%=render_correctness(a)%></span><span><%=s.selected_answers.include?(a.id) ? "(Das hattest Du angekreuzt)" : "" %></span></div>
          <% end %>
        </div>
      <% end %>
    <% end %>
  </div>
<% end %>