teacher_activity.mustache 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 :reports %>
  19. <% js_bundle :teacher_activity_report %>
  20. <% add_crumb(t('crumbs.interaction_report', "Student Interactions Report")) %>
  21. <% content_for :page_title, t('title', 'Teacher Activity Report') %>
  22. <% content_for :stylesheets do %>
  23. <style type="text/css" media="screen">
  24. a.view_full_link {
  25. font-size: 85%;
  26. }
  27. table.report td {
  28. vertical-align: top;
  29. }
  30. </style>
  31. <% end %>
  32. <h1><%= t('headings.teacher_activity', "Teacher Activity Report for %{teacher}", :teacher => @teacher.name) %></h1>
  33. <% @courses.each do |course, students| %>
  34. <% has_user_notes = students.first.try(:key?, :last_user_note) %>
  35. <h2><%= course.name %></h2>
  36. <% if students.blank? %>
  37. <%= t 'no_students', 'There are no students to report on.' %>
  38. <% else %>
  39. <table class='report sortable <%= 'has_user_notes' if has_user_notes %>'>
  40. <thead>
  41. <tr>
  42. <th><%= t 'headings.student_name', %{Student} %></th>
  43. <th><%= t 'headings.last_interaction', 'Last Student Interaction' %></th>
  44. <% if has_user_notes %>
  45. <th><%= t 'headings.last_journal_entry', %{Last Faculty Journal Entry} %></th>
  46. <% end %>
  47. <th>{{#t}}Current Score{{/t}}</th>
  48. <th>{{#t}}Final Score{{/t}}</th>
  49. <th>{{#t}}Ungraded Assignments{{/t}}</th>
  50. <% if course.user_has_been_instructor?(@current_user) %>
  51. <th>&nbsp;</th>
  52. <% end %>
  53. </tr>
  54. </thead>
  55. <tbody>
  56. <% students.each_with_index do |student, idx| %>
  57. <tr>
  58. <td data-number="<%= idx %>">
  59. <%= link_to(student[:enrollment].user.name, course_user_url(course, student[:enrollment].user_id)) %>
  60. </td>
  61. <td>
  62. <% if student[:last_interaction] %>
  63. <%= t 'last_time', { :zero => "less than 1 day ago", :one => "1 day ago", :other => "%{count} days ago" }, :count => (((Time.now - student[:last_interaction])/60)/1440).abs.to_i %>
  64. <% else %>
  65. <%= t 'last_time_never', 'never' %>
  66. <% end %>
  67. </td>
  68. <% if has_user_notes %>
  69. <td>
  70. <% if student[:last_user_note] %>
  71. <% user_note_link = t 'last_time', { :zero => "less than 1 day ago", :one => "1 day ago", :other => "%{count} days ago" }, :count => (((Time.now - student[:last_user_note])/60)/1440).abs.to_i %>
  72. <% else %>
  73. <% user_note_link = t 'last_time_never', 'never' %>
  74. <% end %>
  75. <%= link_to(user_note_link, user_user_notes_url(student[:enrollment].user)) %>
  76. </td>
  77. <% end %>
  78. <td><%= n(student[:enrollment].computed_current_score, percentage: true, precision: 1) %></td>
  79. <td><%= n(student[:enrollment].computed_final_score, percentage: true, precision: 1) %></td>
  80. <td data-number="<%= (student[:ungraded].map(&:submitted_at).compact.min || 1.day.from_now).to_i / 3600 %>">
  81. <% student[:ungraded].each do |submission| %>
  82. <%= link_to(submission.assignment.title, speed_grader_course_gradebook_path(course, :assignment_id => submission.assignment.id, :anchor => { :student_id => student[:enrollment].user_id }.to_json)) %><br/>
  83. <div style="padding-bottom: 5px; margin-top: -2px; padding-left: 20px; font-size: 0.8em; color: #888;">
  84. <% if submission.submitted_at %>
  85. <%= t 'submitted_time', { :zero => "submitted less than 1 day ago", :one => "submitted 1 day ago", :other => "submitted %{count} days ago" }, :count => (((Time.now - submission.submitted_at)/60)/1440).abs.to_i %>
  86. <% end %>
  87. </div>
  88. <% end %>
  89. </td>
  90. <% if course.user_has_been_instructor?(@current_user) %>
  91. <td>
  92. <a href="<%= message_user_path(student[:enrollment].user, course) %>" class="message_student_link" title="<%= t 'message_student', 'Message this student' %>"><i class="icon-email"></i></a>
  93. </td>
  94. <% end %>
  95. </tr>
  96. <% end %>
  97. </tbody>
  98. </table>
  99. <% end %>
  100. <% if params[:student_id] %>
  101. <div>
  102. <%= link_to(t('links.view_full_course', 'View the full Student Interaction Report for %{course}', :course => course.name), user_course_teacher_activity_url(@teacher, course), :class => 'view_full_link') %>
  103. </div>
  104. <% end %>
  105. <br/>
  106. <% end %>