submission unread counts
refs #10541
add a new unread count to the left nav bar, indicating how many grade changes
have occured since you last viewed the course. a grade change can either be
a change in score or a comment left on a submission. when the grades page is
visited, there will be a small new dot next to each submission with new grade
activity, and the count will clear after visiting the grades page.
todo: specs
test plan:
- as a teacher, set up some assignments, including some that are muted, and
some that are peer review
- as a student, submit these assignments
- the counts should not change
- as another student, complete the peer review
- as the original student the count should be up by one, and there should be
a blue dot next to the peer review assignment
- as the teacher, grade the other assignments, including the muted one
- as a student the count and dots should represent what was graded and visible
(everthing but the muted assignment)
- after leaving/refreshing the page, the count and dots should be gone
- as a student, reply to comments on the submissions
- the counts should not change
Change-Id: Ifd5988e37831c4c63314f2aad27ddd2875389dd0
Reviewed-on: https://gerrit.instructure.com/14051
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-09-25 02:41:18 +08:00
|
|
|
#
|
|
|
|
# Copyright (C) 2012 Instructure, Inc.
|
|
|
|
#
|
|
|
|
# This file is part of Canvas.
|
|
|
|
#
|
|
|
|
# Canvas is free software: you can redistribute it and/or modify it under
|
|
|
|
# the terms of the GNU Affero General Public License as published by the Free
|
|
|
|
# Software Foundation, version 3 of the License.
|
|
|
|
#
|
|
|
|
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
|
|
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
|
|
# details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License along
|
|
|
|
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
|
|
|
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
|
|
|
|
|
|
|
describe ContentParticipation do
|
2014-06-30 19:34:00 +08:00
|
|
|
before :once do
|
submission unread counts
refs #10541
add a new unread count to the left nav bar, indicating how many grade changes
have occured since you last viewed the course. a grade change can either be
a change in score or a comment left on a submission. when the grades page is
visited, there will be a small new dot next to each submission with new grade
activity, and the count will clear after visiting the grades page.
todo: specs
test plan:
- as a teacher, set up some assignments, including some that are muted, and
some that are peer review
- as a student, submit these assignments
- the counts should not change
- as another student, complete the peer review
- as the original student the count should be up by one, and there should be
a blue dot next to the peer review assignment
- as the teacher, grade the other assignments, including the muted one
- as a student the count and dots should represent what was graded and visible
(everthing but the muted assignment)
- after leaving/refreshing the page, the count and dots should be gone
- as a student, reply to comments on the submissions
- the counts should not change
Change-Id: Ifd5988e37831c4c63314f2aad27ddd2875389dd0
Reviewed-on: https://gerrit.instructure.com/14051
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-09-25 02:41:18 +08:00
|
|
|
course_with_teacher(:active_all => true)
|
|
|
|
student_in_course(:active_all => true)
|
|
|
|
assignment_model(:course => @course)
|
|
|
|
@content = @assignment.submit_homework(@student)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "create_or_update" do
|
|
|
|
it "should create if it doesn't exist" do
|
|
|
|
expect {
|
|
|
|
ContentParticipation.create_or_update({
|
|
|
|
:content => @content,
|
|
|
|
:user => @student,
|
|
|
|
:workflow_state => "read",
|
|
|
|
})
|
|
|
|
}.to change(ContentParticipation, :count).by 1
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should update existing if one already exists" do
|
|
|
|
expect {
|
|
|
|
ContentParticipation.create_or_update({
|
|
|
|
:content => @content,
|
|
|
|
:user => @student,
|
|
|
|
:workflow_state => "read",
|
|
|
|
})
|
|
|
|
}.to change(ContentParticipation, :count).by 1
|
|
|
|
|
|
|
|
expect {
|
|
|
|
ContentParticipation.create_or_update({
|
|
|
|
:content => @content,
|
|
|
|
:user => @student,
|
|
|
|
:workflow_state => "unread",
|
|
|
|
})
|
|
|
|
}.to change(ContentParticipation, :count).by 0
|
|
|
|
|
2013-03-26 23:19:59 +08:00
|
|
|
cp = ContentParticipation.where(:user_id => @student).first
|
2014-10-14 10:08:00 +08:00
|
|
|
expect(cp.workflow_state).to eq "unread"
|
submission unread counts
refs #10541
add a new unread count to the left nav bar, indicating how many grade changes
have occured since you last viewed the course. a grade change can either be
a change in score or a comment left on a submission. when the grades page is
visited, there will be a small new dot next to each submission with new grade
activity, and the count will clear after visiting the grades page.
todo: specs
test plan:
- as a teacher, set up some assignments, including some that are muted, and
some that are peer review
- as a student, submit these assignments
- the counts should not change
- as another student, complete the peer review
- as the original student the count should be up by one, and there should be
a blue dot next to the peer review assignment
- as the teacher, grade the other assignments, including the muted one
- as a student the count and dots should represent what was graded and visible
(everthing but the muted assignment)
- after leaving/refreshing the page, the count and dots should be gone
- as a student, reply to comments on the submissions
- the counts should not change
Change-Id: Ifd5988e37831c4c63314f2aad27ddd2875389dd0
Reviewed-on: https://gerrit.instructure.com/14051
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-09-25 02:41:18 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "update_participation_count" do
|
|
|
|
it "should update the participation count automatically when the workflow state changes" do
|
|
|
|
expect {
|
|
|
|
ContentParticipation.create_or_update({
|
|
|
|
:content => @content,
|
|
|
|
:user => @student,
|
|
|
|
:workflow_state => "read",
|
|
|
|
})
|
|
|
|
}.to change(ContentParticipationCount, :count).by 1
|
|
|
|
|
|
|
|
ContentParticipation.create_or_update({
|
|
|
|
:content => @content,
|
|
|
|
:user => @student,
|
|
|
|
:workflow_state => "unread",
|
|
|
|
})
|
2013-03-26 23:19:59 +08:00
|
|
|
cpc = ContentParticipationCount.where(:user_id => @student).first
|
2014-10-14 10:08:00 +08:00
|
|
|
expect(cpc.unread_count).to eq 1
|
submission unread counts
refs #10541
add a new unread count to the left nav bar, indicating how many grade changes
have occured since you last viewed the course. a grade change can either be
a change in score or a comment left on a submission. when the grades page is
visited, there will be a small new dot next to each submission with new grade
activity, and the count will clear after visiting the grades page.
todo: specs
test plan:
- as a teacher, set up some assignments, including some that are muted, and
some that are peer review
- as a student, submit these assignments
- the counts should not change
- as another student, complete the peer review
- as the original student the count should be up by one, and there should be
a blue dot next to the peer review assignment
- as the teacher, grade the other assignments, including the muted one
- as a student the count and dots should represent what was graded and visible
(everthing but the muted assignment)
- after leaving/refreshing the page, the count and dots should be gone
- as a student, reply to comments on the submissions
- the counts should not change
Change-Id: Ifd5988e37831c4c63314f2aad27ddd2875389dd0
Reviewed-on: https://gerrit.instructure.com/14051
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-09-25 02:41:18 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should not update participation count if workflow_state doesn't change" do
|
|
|
|
expect {
|
|
|
|
ContentParticipation.create_or_update({
|
|
|
|
:content => @content,
|
|
|
|
:user => @student,
|
|
|
|
:workflow_state => "read",
|
|
|
|
})
|
|
|
|
}.to change(ContentParticipationCount, :count).by 1
|
|
|
|
|
|
|
|
ContentParticipation.create_or_update({
|
|
|
|
:content => @content,
|
|
|
|
:user => @student,
|
|
|
|
:workflow_state => "read",
|
|
|
|
})
|
2013-03-26 23:19:59 +08:00
|
|
|
cpc = ContentParticipationCount.where(:user_id => @student).first
|
2014-10-14 10:08:00 +08:00
|
|
|
expect(cpc.unread_count).to eq 0
|
submission unread counts
refs #10541
add a new unread count to the left nav bar, indicating how many grade changes
have occured since you last viewed the course. a grade change can either be
a change in score or a comment left on a submission. when the grades page is
visited, there will be a small new dot next to each submission with new grade
activity, and the count will clear after visiting the grades page.
todo: specs
test plan:
- as a teacher, set up some assignments, including some that are muted, and
some that are peer review
- as a student, submit these assignments
- the counts should not change
- as another student, complete the peer review
- as the original student the count should be up by one, and there should be
a blue dot next to the peer review assignment
- as the teacher, grade the other assignments, including the muted one
- as a student the count and dots should represent what was graded and visible
(everthing but the muted assignment)
- after leaving/refreshing the page, the count and dots should be gone
- as a student, reply to comments on the submissions
- the counts should not change
Change-Id: Ifd5988e37831c4c63314f2aad27ddd2875389dd0
Reviewed-on: https://gerrit.instructure.com/14051
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-09-25 02:41:18 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|