user_outcome_results.mustache 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <%
  2. # Copyright (C) 2011 - present Instructure, Inc.
  3. #
  4. # This file is part of Canvas.
  5. #
  6. # Canvas is free software: you can redistribute it and/or modify it under
  7. # the terms of the GNU Affero General Public License as published by the Free
  8. # Software Foundation, version 3 of the License.
  9. #
  10. # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
  11. # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
  13. # details.
  14. #
  15. # You should have received a copy of the GNU Affero General Public License along
  16. # with this program. If not, see <http://www.gnu.org/licenses/>.
  17. %>
  18. <% css_bundle :learning_outcomes %>
  19. <% js_bundle :rubric_assessment %>
  20. <% content_for :page_title do %><%= t :outcomes_for, "Outcomes for %{user_name}", :user_name => @user.name %><% end %>
  21. <% content_for :right_side do %>
  22. <div class="rs-margin-bottom">
  23. <% chain = (@context.account_chain rescue [@domain_root_account]).select{|a| can_do(a, @current_user, :manage) }; %>
  24. <% if !chain.empty? %>
  25. <%= before_label :see_results, "See %{user_name}'s results for", :user_name => @user.short_name %>
  26. <ul>
  27. <% chain.each do |account| %>
  28. <li><a href="<%= context_url(account, :context_user_outcomes_results_url, @user.id) %>"><%= account.name %></a></li>
  29. <% end %>
  30. </ul>
  31. <% end %>
  32. </div>
  33. <div class="show_all_artificts">
  34. <a href="#" class="btn button-sidebar-wide" id="show_all_artifacts_link"><%= t "#buttons.show_all_artifacts", "Show All Artifacts" %></a>
  35. </div>
  36. <% end %>
  37. <% content_for :stylesheets do %>
  38. <style>
  39. #outcomes th {
  40. background-color: #444;
  41. color: #eee;
  42. padding: 5px 5px;
  43. font-size: 1.2em;
  44. text-align: center;
  45. }
  46. #outcomes th.outcome {
  47. text-align: left;
  48. }
  49. #outcomes td {
  50. padding: 2px 5px;
  51. text-align: center;
  52. border-bottom: 1px dotted #ccc;
  53. }
  54. #outcomes .short_description {
  55. text-align: left;
  56. min-width: 150px;
  57. }
  58. #outcomes .attempts .sub_attempt {
  59. font-size: 0.8em;
  60. }
  61. #outcomes .latest_score {
  62. white-space: nowrap;
  63. }
  64. #outcomes .out_of {
  65. font-size: 0.8em;
  66. }
  67. #outcomes .latest_score.mastery {
  68. background-color: #efe;
  69. }
  70. #outcomes .latest_score {
  71. background-color: #fee;
  72. }
  73. #outcomes td#outcome_results {
  74. text-align: left;
  75. }
  76. </style>
  77. <% end %>
  78. <% js_bundle 'legacy/user_outcome_results' %>
  79. <h1 class="screenreader-only"><%= t :outcomes_for, "Outcomes for %{user_name}", :user_name => @user.name %></h1>
  80. <table id="outcomes">
  81. <thead>
  82. <tr>
  83. <th class="outcome"><%= t "short_title.outcome", "Outcome" %></th>
  84. <th><%= t "short_title.attempts", "Attempts" %></th>
  85. <th><%= t "short_title.latest_score", "Latest Score" %></th>
  86. <th><%= t "short_title.average_percent", "Avg Percent" %></th>
  87. </thead>
  88. <tbody>
  89. <% @outcomes.each do |outcome| %>
  90. <tr>
  91. <td class="short_description"><%= outcome.short_description %></td>
  92. <% results = @results_for_outcome[outcome.id] || [] %>
  93. <td class="attempts">
  94. <%= t :attempts_from_artifacts, "%{attempts} *from %{artifacts}*", :wrapper => '<div class="sub_attempt">\1</div>', :attempts => t(:attempts, "attempt", :count => results.map{|r| [1, r.attempt || 0].max }.sum), :artifacts => t(:artifacts, "artifact", :count => results.length) %>
  95. </td>
  96. <td class="latest_score <%= 'mastery' if results[-1] && results[-1].mastery %>" title="<%= (results[-1] && results[-1].mastery) ? t(:mastery, "Mastery on latest attempt") : t(:no_mastery, "No Mastery on latest attempt") %>">
  97. <% if results.empty? %>
  98. -
  99. <% else %>
  100. <% if results[-1].possible %>
  101. <%= t :score_out_of_possible, "%{score}* out of %{possible}*", :score => results[-1].score, :possible => results[-1].possible, :wrapper => '<span class="out_of">\1</span>' %>
  102. <% else %>
  103. <%= results[-1].score %><span class="out_of"></span>
  104. <% end %>
  105. <% end %>
  106. </td>
  107. <td class="avg_percent">
  108. <% results_with_percent = results.select { |r| r.percent.present? }
  109. if results_with_percent.empty? %>
  110. -
  111. <% else %>
  112. <%= results_with_percent.map(&:percent).sum.to_f * 100.0 / results.length.to_f %>%
  113. <% end %>
  114. </td>
  115. </tr>
  116. <% unless results.empty? %>
  117. <tr class="artifact_details" style="display: none;">
  118. <td colspan="4" id="outcome_results">
  119. <ul id="outcome_results_list">
  120. <% results.each do |result| %>
  121. {{> views/outcome_result}}
  122. <% end %>
  123. </ul>
  124. </td>
  125. </tr>
  126. <% end %>
  127. <% end %>
  128. </tbody>
  129. </table>
  130. {{> views/shared/rubric_criterion_dialog}}