canvas-lms/app/views/users/teacher_activity.html.erb

93 lines
4.3 KiB
Plaintext

<% jammit_css :reports %>
<% js_bundle :teacher_activity_report %>
<% add_crumb(t('crumbs.interaction_report', "Student Interactions Report")) %>
<% content_for :page_title, t('title', 'Teacher Activity Report') %>
<% content_for :stylesheets do %>
<style type="text/css" media="screen">
a.view_full_link {
font-size: 85%;
}
table.report td {
vertical-align: top;
}
</style>
<% end %>
<h2><%= t('headings.teacher_activity', "Teacher Activity Report for %{teacher}", :teacher => @teacher.name) %></h2>
<% @courses.each do |course, students| %>
<% has_user_notes = students.first.try(:key?, :last_user_note) %>
<h3><%= course.name %></h3>
<% if students.blank? %>
<%= t 'no_students', 'There are no students to report on.' %>
<% else %>
<table class='report sortable <%= 'has_user_notes' if has_user_notes %>'>
<thead>
<tr>
<th><%= t 'headings.student_name', %{Student} %></th>
<th><%= t 'headings.last_interaction', 'Last Student Interaction' %></th>
<% if has_user_notes %>
<th><%= t 'headings.last_journal_entry', %{Last Faculty Journal Entry} %></th>
<% end %>
<th><%= t('headings.current_score', %{Current Score}) %></th>
<th><%= t('headings.final_score', %{Final Score}) %></th>
<th><%= t('headings.ungraded', %{Ungraded Assignments}) %></th>
<% if course.user_has_been_instructor?(@current_user) %>
<th>&nbsp;</th>
<% end %>
</tr>
</thead>
<tbody>
<% students.each_with_index do |student, idx| %>
<tr>
<td data-number="<%= idx %>">
<%= link_to(student[:enrollment].user.name, course_user_url(course, student[:enrollment].user_id)) %>
</td>
<td>
<% if student[:last_interaction] %>
<%= 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 %>
<% else %>
<%= t 'last_time_never', 'never' %>
<% end %>
</td>
<% if has_user_notes %>
<td>
<% if student[:last_user_note] %>
<% 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 %>
<% else %>
<% user_note_link = t 'last_time_never', 'never' %>
<% end %>
<%= link_to(user_note_link, user_user_notes_url(student[:enrollment].user)) %>
</td>
<% end %>
<td><%= number_to_percentage(student[:enrollment].computed_current_score, :precision => 1) %></td>
<td><%= number_to_percentage(student[:enrollment].computed_final_score, :precision => 1) %></td>
<td data-number="<%= (student[:ungraded].map(&:submitted_at).compact.max || 1.day.from_now).to_i / 3600 %>">
<% student[:ungraded].each do |submission| %>
<%= 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/>
<div style="padding-bottom: 5px; margin-top: -2px; padding-left: 20px; font-size: 0.8em; color: #888;">
<% if submission.submitted_at %>
<%= 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 %>
<% end %>
</div>
<% end %>
</td>
<% if course.user_has_been_instructor?(@current_user) %>
<td>
<a href="<%= message_user_path(student[:enrollment].user) %>" class="message_student_link" title="<%= t 'message_student', 'Message this student' %>"><i class="icon-email"></i></a>
</td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% if params[:student_id] %>
<div>
<%= 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') %>
</div>
<% end %>
<br/>
<% end %>