conversations are teacher interactions, fixes #5437
Change-Id: I03aebdee626ae8300acf0973a97d0ba69f5098f5 Reviewed-on: https://gerrit.instructure.com/5326 Reviewed-by: Cody Cutrer <cody@instructure.com> Tested-by: Hudson <hudson@instructure.com>
This commit is contained in:
parent
432283d3e7
commit
7fa0ff9663
|
@ -835,6 +835,15 @@ class UsersController < ApplicationController
|
|||
next unless student = data[user_id]
|
||||
student[:last_interaction] = [student[:last_interaction], date].compact.max
|
||||
end
|
||||
last_message_dates = ConversationMessage.maximum(
|
||||
:created_at,
|
||||
:joins => 'INNER JOIN conversation_participants ON conversation_participants.conversation_id=conversation_messages.conversation_id',
|
||||
:group => ['conversation_participants.user_id', 'conversation_messages.author_id'],
|
||||
:conditions => [ 'conversation_messages.author_id = ? AND conversation_participants.user_id IN (?) AND NOT conversation_messages.generated', teacher.id, ids ])
|
||||
last_message_dates.each do |key, date|
|
||||
next unless student = data[key.first.to_i]
|
||||
student[:last_interaction] = [student[:last_interaction], date].compact.max
|
||||
end
|
||||
|
||||
# find all ungraded submissions in one query
|
||||
ungraded_submissions = course.submissions.all(
|
||||
|
|
|
@ -34,6 +34,17 @@ describe UsersController do
|
|||
@e2.update_attribute(:course_section, @s2)
|
||||
end
|
||||
|
||||
it "should count conversations as interaction" do
|
||||
get user_student_teacher_activity_url(@teacher, @e1.user)
|
||||
Nokogiri::HTML(response.body).at_css('table.report tr:first td:nth(2)').text.should match(/never/)
|
||||
|
||||
@conversation = Conversation.initiate([@e1.user_id, @teacher.id], false)
|
||||
@conversation.add_message(@teacher, "hello")
|
||||
|
||||
get user_student_teacher_activity_url(@teacher, @e1.user)
|
||||
Nokogiri::HTML(response.body).at_css('table.report tr:first td:nth(2)').text.should match(/less than 1 day/)
|
||||
end
|
||||
|
||||
it "should only include students the teacher can view" do
|
||||
get user_course_teacher_activity_url(@teacher, @course)
|
||||
response.should be_success
|
||||
|
|
Loading…
Reference in New Issue