2011-05-26 06:16:01 +08:00
|
|
|
#
|
2017-04-28 12:12:06 +08:00
|
|
|
# Copyright (C) 2011 - present Instructure, Inc.
|
2011-05-26 06:16:01 +08:00
|
|
|
#
|
|
|
|
# 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 AssetUserAccess do
|
2014-06-28 16:57:40 +08:00
|
|
|
before :once do
|
2012-11-13 08:13:30 +08:00
|
|
|
@course = Account.default.courses.create!(:name => 'My Course')
|
|
|
|
@assignment = @course.assignments.create!(:title => 'My Assignment')
|
|
|
|
@user = User.create!
|
|
|
|
|
|
|
|
@asset = factory_with_protected_attributes(AssetUserAccess, :user => @user, :context => @course, :asset_code => @assignment.asset_string)
|
|
|
|
@asset.display_name = @assignment.asset_string
|
|
|
|
@asset.save!
|
|
|
|
end
|
|
|
|
|
2011-05-26 06:16:01 +08:00
|
|
|
it "should update existing records that have bad display names" do
|
2014-10-14 10:08:00 +08:00
|
|
|
expect(@asset.display_name).to eq "My Assignment"
|
2012-11-13 08:13:30 +08:00
|
|
|
end
|
|
|
|
|
2014-10-03 02:46:43 +08:00
|
|
|
it "should update existing records that have changed display names" do
|
|
|
|
@assignment.title = 'My changed Assignment'
|
|
|
|
@assignment.save!
|
2016-06-16 02:59:20 +08:00
|
|
|
@asset = AssetUserAccess.find(@asset.id)
|
2014-10-03 02:46:43 +08:00
|
|
|
@asset.log @course, { :level => 'view' }
|
2014-10-14 10:08:00 +08:00
|
|
|
expect(@asset.display_name).to eq 'My changed Assignment'
|
2014-10-03 02:46:43 +08:00
|
|
|
end
|
|
|
|
|
2016-06-06 06:11:25 +08:00
|
|
|
it "should work for assessment questions" do
|
|
|
|
question = assessment_question_model(bank: AssessmentQuestionBank.create!(context: @course))
|
|
|
|
@asset.log question, { :level => 'view' }
|
|
|
|
expect(@asset.context).to eq @course
|
|
|
|
end
|
|
|
|
|
2012-11-13 08:13:30 +08:00
|
|
|
describe "for_user" do
|
|
|
|
it "should work with a User object" do
|
2014-10-14 10:08:00 +08:00
|
|
|
expect(AssetUserAccess.for_user(@user)).to eq [@asset]
|
2012-11-13 08:13:30 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should work with a list of User objects" do
|
2014-10-14 10:08:00 +08:00
|
|
|
expect(AssetUserAccess.for_user([@user])).to eq [@asset]
|
2012-11-13 08:13:30 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should work with a User id" do
|
2014-10-14 10:08:00 +08:00
|
|
|
expect(AssetUserAccess.for_user(@user.id)).to eq [@asset]
|
2012-11-13 08:13:30 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should work with a list of User ids" do
|
2014-10-14 10:08:00 +08:00
|
|
|
expect(AssetUserAccess.for_user([@user.id])).to eq [@asset]
|
2012-11-13 08:13:30 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should with with an empty list" do
|
2014-10-14 10:08:00 +08:00
|
|
|
expect(AssetUserAccess.for_user([])).to eq []
|
2012-11-13 08:13:30 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should not find unrelated accesses" do
|
2014-10-14 10:08:00 +08:00
|
|
|
expect(AssetUserAccess.for_user(User.create!)).to eq []
|
|
|
|
expect(AssetUserAccess.for_user(@user.id + 1)).to eq []
|
2012-11-13 08:13:30 +08:00
|
|
|
end
|
2011-05-26 06:16:01 +08:00
|
|
|
end
|
2012-11-16 07:34:57 +08:00
|
|
|
|
|
|
|
describe '#log_action' do
|
|
|
|
let(:scores) { Hash.new }
|
|
|
|
let(:asset) { AssetUserAccess.new(scores) }
|
|
|
|
|
|
|
|
subject { asset }
|
|
|
|
|
|
|
|
describe 'when action level is nil' do
|
|
|
|
describe 'with nil scores' do
|
|
|
|
describe 'view level' do
|
|
|
|
before { asset.log_action 'view' }
|
2014-10-14 10:08:00 +08:00
|
|
|
|
|
|
|
describe '#view_score' do
|
|
|
|
subject { super().view_score }
|
|
|
|
it { is_expected.to eq 1 }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#participate_score' do
|
|
|
|
subject { super().participate_score }
|
|
|
|
it { is_expected.to be_nil }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#action_level' do
|
|
|
|
subject { super().action_level }
|
|
|
|
it { is_expected.to eq 'view' }
|
|
|
|
end
|
2012-11-16 07:34:57 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'participate level' do
|
|
|
|
before { asset.log_action 'participate' }
|
2014-10-14 10:08:00 +08:00
|
|
|
|
|
|
|
describe '#view_score' do
|
|
|
|
subject { super().view_score }
|
|
|
|
it { is_expected.to eq 1 }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#participate_score' do
|
|
|
|
subject { super().participate_score }
|
|
|
|
it { is_expected.to eq 1 }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#action_level' do
|
|
|
|
subject { super().action_level }
|
|
|
|
it { is_expected.to eq 'participate' }
|
|
|
|
end
|
2012-11-16 07:34:57 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'submit level' do
|
|
|
|
before { asset.log_action 'submit' }
|
2014-10-14 10:08:00 +08:00
|
|
|
|
|
|
|
describe '#view_score' do
|
|
|
|
subject { super().view_score }
|
|
|
|
it { is_expected.to be_nil }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#participate_score' do
|
|
|
|
subject { super().participate_score }
|
|
|
|
it { is_expected.to eq 1 }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#action_level' do
|
|
|
|
subject { super().action_level }
|
|
|
|
it { is_expected.to eq 'participate' }
|
|
|
|
end
|
2012-11-16 07:34:57 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'with existing scores' do
|
|
|
|
before { asset.view_score = asset.participate_score = 3 }
|
|
|
|
|
|
|
|
describe 'view level' do
|
|
|
|
before { asset.log_action 'view' }
|
2014-10-14 10:08:00 +08:00
|
|
|
|
|
|
|
describe '#view_score' do
|
|
|
|
subject { super().view_score }
|
|
|
|
it { is_expected.to eq 4 }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#participate_score' do
|
|
|
|
subject { super().participate_score }
|
|
|
|
it { is_expected.to eq 3 }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#action_level' do
|
|
|
|
subject { super().action_level }
|
|
|
|
it { is_expected.to eq 'view' }
|
|
|
|
end
|
2012-11-16 07:34:57 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'participate level' do
|
|
|
|
before { asset.log_action 'participate' }
|
2014-10-14 10:08:00 +08:00
|
|
|
|
|
|
|
describe '#view_score' do
|
|
|
|
subject { super().view_score }
|
|
|
|
it { is_expected.to eq 4 }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#participate_score' do
|
|
|
|
subject { super().participate_score }
|
|
|
|
it { is_expected.to eq 4 }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#action_level' do
|
|
|
|
subject { super().action_level }
|
|
|
|
it { is_expected.to eq 'participate' }
|
|
|
|
end
|
2012-11-16 07:34:57 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'submit level' do
|
|
|
|
before { asset.log_action 'submit' }
|
2014-10-14 10:08:00 +08:00
|
|
|
|
|
|
|
describe '#view_score' do
|
|
|
|
subject { super().view_score }
|
|
|
|
it { is_expected.to eq 3 }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#participate_score' do
|
|
|
|
subject { super().participate_score }
|
|
|
|
it { is_expected.to eq 4 }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#action_level' do
|
|
|
|
subject { super().action_level }
|
|
|
|
it { is_expected.to eq 'participate' }
|
|
|
|
end
|
2012-11-16 07:34:57 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'when action level is view' do
|
|
|
|
before { asset.action_level = 'view' }
|
|
|
|
|
|
|
|
it 'gets overridden by participate' do
|
|
|
|
asset.log_action 'participate'
|
2014-10-14 10:08:00 +08:00
|
|
|
expect(asset.action_level).to eq 'participate'
|
2012-11-16 07:34:57 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'gets overridden by submit' do
|
|
|
|
asset.log_action 'submit'
|
2014-10-14 10:08:00 +08:00
|
|
|
expect(asset.action_level).to eq 'participate'
|
2012-11-16 07:34:57 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not overwrite the participate level with view' do
|
|
|
|
asset.action_level = 'participate'
|
|
|
|
asset.log_action 'view'
|
2014-10-14 10:08:00 +08:00
|
|
|
expect(asset.action_level).to eq 'participate'
|
2012-11-16 07:34:57 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#log' do
|
|
|
|
let(:access) { AssetUserAccess.new }
|
|
|
|
let(:context) { User.new }
|
|
|
|
subject { access }
|
|
|
|
|
|
|
|
before { access.stubs :save }
|
|
|
|
|
|
|
|
describe 'attribute values directly from hash' do
|
|
|
|
def it_sets_if_nil( attribute, hash_key = nil)
|
|
|
|
hash_key ||= attribute
|
|
|
|
access.log(context, { hash_key => 'value' })
|
2014-10-14 10:08:00 +08:00
|
|
|
expect(access.send(attribute)).to eq 'value'
|
2012-11-16 07:34:57 +08:00
|
|
|
access.send("#{attribute}=", 'other')
|
|
|
|
access.log(context, { hash_key => 'value' })
|
2014-10-14 10:08:00 +08:00
|
|
|
expect(access.send(attribute)).to eq 'other'
|
2012-11-16 07:34:57 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
specify { it_sets_if_nil( :asset_category, :category ) }
|
|
|
|
specify { it_sets_if_nil( :asset_group_code, :group_code ) }
|
|
|
|
specify { it_sets_if_nil( :membership_type ) }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'interally set or calculated attribute values' do
|
|
|
|
before { access.log context, { :level => 'view' } }
|
2014-10-14 10:08:00 +08:00
|
|
|
|
|
|
|
describe '#context' do
|
|
|
|
subject { super().context }
|
|
|
|
it { is_expected.to eq context }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#last_access' do
|
|
|
|
subject { super().last_access }
|
|
|
|
it { is_expected.not_to be_nil }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#view_score' do
|
|
|
|
subject { super().view_score }
|
|
|
|
it { is_expected.to eq 1 }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#participate_score' do
|
|
|
|
subject { super().participate_score }
|
|
|
|
it { is_expected.to be_nil }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#action_level' do
|
|
|
|
subject { super().action_level }
|
|
|
|
it { is_expected.to eq 'view' }
|
|
|
|
end
|
2012-11-16 07:34:57 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
More accurate Access Report scores for Quizzes
This patch makes it that when viewing the Access Report for a course
student, their "Times Viewed" column will reflect the number of times
the student has browsed the quiz or any of its related resources
(like History, or attempt views), but not taken it.
While the "Times Participated" column will reflect the number of times
the student really took the quiz (1:1 mapping with the number of
submissions.)
TEST PLAN
---- ----
In both test cases, you'll need:
- a course with a student enrolled
- one browser session with a teacher logged in viewing the Access
Report of the student
- one browser session with the student logged
CASE: Normal quizzes
- Create a quiz with a few questions and unlimited attempts.
- Refresh the teacher tab, keep an eye on Times "Viewed" and
"Participated" columns
- As the student:
- Go to the quizzes page
- Go to the quiz page
- Refresh the teacher tab, and:
- ONLY the "Times Viewed" score should be incremented by 1
- As the student:
- Push the Take the Quiz
- Refresh the teacher tab, and:
- ONLY the "Times Participated" score should be incremented by 1
- As the student:
- Refresh the quiz page (while taking it)
- Refresh the teacher tab, and:
- NEITHER score should be incremented
CASE: OQAAT quizzes
The expected behaviour for OQAAT quizzes is that the entire attempt
counts as 1 participation, just like the normal quizzes.
Follow the same steps as above, but:
- While taking the quiz, and for every question page:
- Refresh the teacher tab and make sure that neither score is
incremented
OBLIGATORY REFERENCES
---------- ----------
- Acceptance criteria @ http://docs.kodoware.com/canvas/cnvs-5294
refs CNVS-5294
Change-Id: I55883b8edbf417edb42b9fd103e08369e0e9e63c
Reviewed-on: https://gerrit.instructure.com/26543
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2013-11-22 01:33:04 +08:00
|
|
|
|
|
|
|
describe '#corrected_view_score' do
|
|
|
|
it 'should deduct the participation score from the view score for a quiz' do
|
2014-02-05 12:32:22 +08:00
|
|
|
subject.view_score = 10
|
|
|
|
subject.participate_score = 4
|
|
|
|
subject.asset_group_code = 'quizzes'
|
More accurate Access Report scores for Quizzes
This patch makes it that when viewing the Access Report for a course
student, their "Times Viewed" column will reflect the number of times
the student has browsed the quiz or any of its related resources
(like History, or attempt views), but not taken it.
While the "Times Participated" column will reflect the number of times
the student really took the quiz (1:1 mapping with the number of
submissions.)
TEST PLAN
---- ----
In both test cases, you'll need:
- a course with a student enrolled
- one browser session with a teacher logged in viewing the Access
Report of the student
- one browser session with the student logged
CASE: Normal quizzes
- Create a quiz with a few questions and unlimited attempts.
- Refresh the teacher tab, keep an eye on Times "Viewed" and
"Participated" columns
- As the student:
- Go to the quizzes page
- Go to the quiz page
- Refresh the teacher tab, and:
- ONLY the "Times Viewed" score should be incremented by 1
- As the student:
- Push the Take the Quiz
- Refresh the teacher tab, and:
- ONLY the "Times Participated" score should be incremented by 1
- As the student:
- Refresh the quiz page (while taking it)
- Refresh the teacher tab, and:
- NEITHER score should be incremented
CASE: OQAAT quizzes
The expected behaviour for OQAAT quizzes is that the entire attempt
counts as 1 participation, just like the normal quizzes.
Follow the same steps as above, but:
- While taking the quiz, and for every question page:
- Refresh the teacher tab and make sure that neither score is
incremented
OBLIGATORY REFERENCES
---------- ----------
- Acceptance criteria @ http://docs.kodoware.com/canvas/cnvs-5294
refs CNVS-5294
Change-Id: I55883b8edbf417edb42b9fd103e08369e0e9e63c
Reviewed-on: https://gerrit.instructure.com/26543
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2013-11-22 01:33:04 +08:00
|
|
|
|
2014-10-14 10:08:00 +08:00
|
|
|
expect(subject.corrected_view_score).to eq 6
|
More accurate Access Report scores for Quizzes
This patch makes it that when viewing the Access Report for a course
student, their "Times Viewed" column will reflect the number of times
the student has browsed the quiz or any of its related resources
(like History, or attempt views), but not taken it.
While the "Times Participated" column will reflect the number of times
the student really took the quiz (1:1 mapping with the number of
submissions.)
TEST PLAN
---- ----
In both test cases, you'll need:
- a course with a student enrolled
- one browser session with a teacher logged in viewing the Access
Report of the student
- one browser session with the student logged
CASE: Normal quizzes
- Create a quiz with a few questions and unlimited attempts.
- Refresh the teacher tab, keep an eye on Times "Viewed" and
"Participated" columns
- As the student:
- Go to the quizzes page
- Go to the quiz page
- Refresh the teacher tab, and:
- ONLY the "Times Viewed" score should be incremented by 1
- As the student:
- Push the Take the Quiz
- Refresh the teacher tab, and:
- ONLY the "Times Participated" score should be incremented by 1
- As the student:
- Refresh the quiz page (while taking it)
- Refresh the teacher tab, and:
- NEITHER score should be incremented
CASE: OQAAT quizzes
The expected behaviour for OQAAT quizzes is that the entire attempt
counts as 1 participation, just like the normal quizzes.
Follow the same steps as above, but:
- While taking the quiz, and for every question page:
- Refresh the teacher tab and make sure that neither score is
incremented
OBLIGATORY REFERENCES
---------- ----------
- Acceptance criteria @ http://docs.kodoware.com/canvas/cnvs-5294
refs CNVS-5294
Change-Id: I55883b8edbf417edb42b9fd103e08369e0e9e63c
Reviewed-on: https://gerrit.instructure.com/26543
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2013-11-22 01:33:04 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should return the normal view score for anything but a quiz' do
|
2014-02-05 12:32:22 +08:00
|
|
|
subject.view_score = 10
|
|
|
|
subject.participate_score = 4
|
More accurate Access Report scores for Quizzes
This patch makes it that when viewing the Access Report for a course
student, their "Times Viewed" column will reflect the number of times
the student has browsed the quiz or any of its related resources
(like History, or attempt views), but not taken it.
While the "Times Participated" column will reflect the number of times
the student really took the quiz (1:1 mapping with the number of
submissions.)
TEST PLAN
---- ----
In both test cases, you'll need:
- a course with a student enrolled
- one browser session with a teacher logged in viewing the Access
Report of the student
- one browser session with the student logged
CASE: Normal quizzes
- Create a quiz with a few questions and unlimited attempts.
- Refresh the teacher tab, keep an eye on Times "Viewed" and
"Participated" columns
- As the student:
- Go to the quizzes page
- Go to the quiz page
- Refresh the teacher tab, and:
- ONLY the "Times Viewed" score should be incremented by 1
- As the student:
- Push the Take the Quiz
- Refresh the teacher tab, and:
- ONLY the "Times Participated" score should be incremented by 1
- As the student:
- Refresh the quiz page (while taking it)
- Refresh the teacher tab, and:
- NEITHER score should be incremented
CASE: OQAAT quizzes
The expected behaviour for OQAAT quizzes is that the entire attempt
counts as 1 participation, just like the normal quizzes.
Follow the same steps as above, but:
- While taking the quiz, and for every question page:
- Refresh the teacher tab and make sure that neither score is
incremented
OBLIGATORY REFERENCES
---------- ----------
- Acceptance criteria @ http://docs.kodoware.com/canvas/cnvs-5294
refs CNVS-5294
Change-Id: I55883b8edbf417edb42b9fd103e08369e0e9e63c
Reviewed-on: https://gerrit.instructure.com/26543
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2013-11-22 01:33:04 +08:00
|
|
|
|
2014-10-14 10:08:00 +08:00
|
|
|
expect(subject.corrected_view_score).to eq 10
|
More accurate Access Report scores for Quizzes
This patch makes it that when viewing the Access Report for a course
student, their "Times Viewed" column will reflect the number of times
the student has browsed the quiz or any of its related resources
(like History, or attempt views), but not taken it.
While the "Times Participated" column will reflect the number of times
the student really took the quiz (1:1 mapping with the number of
submissions.)
TEST PLAN
---- ----
In both test cases, you'll need:
- a course with a student enrolled
- one browser session with a teacher logged in viewing the Access
Report of the student
- one browser session with the student logged
CASE: Normal quizzes
- Create a quiz with a few questions and unlimited attempts.
- Refresh the teacher tab, keep an eye on Times "Viewed" and
"Participated" columns
- As the student:
- Go to the quizzes page
- Go to the quiz page
- Refresh the teacher tab, and:
- ONLY the "Times Viewed" score should be incremented by 1
- As the student:
- Push the Take the Quiz
- Refresh the teacher tab, and:
- ONLY the "Times Participated" score should be incremented by 1
- As the student:
- Refresh the quiz page (while taking it)
- Refresh the teacher tab, and:
- NEITHER score should be incremented
CASE: OQAAT quizzes
The expected behaviour for OQAAT quizzes is that the entire attempt
counts as 1 participation, just like the normal quizzes.
Follow the same steps as above, but:
- While taking the quiz, and for every question page:
- Refresh the teacher tab and make sure that neither score is
incremented
OBLIGATORY REFERENCES
---------- ----------
- Acceptance criteria @ http://docs.kodoware.com/canvas/cnvs-5294
refs CNVS-5294
Change-Id: I55883b8edbf417edb42b9fd103e08369e0e9e63c
Reviewed-on: https://gerrit.instructure.com/26543
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2013-11-22 01:33:04 +08:00
|
|
|
end
|
|
|
|
|
2014-02-05 12:32:22 +08:00
|
|
|
it 'should not complain if there is no current score' do
|
|
|
|
subject.view_score = nil
|
|
|
|
subject.participate_score = 4
|
|
|
|
subject.stubs(:asset_group_code).returns('quizzes')
|
|
|
|
|
2014-10-14 10:08:00 +08:00
|
|
|
expect(subject.corrected_view_score).to eq -4
|
2014-02-05 12:32:22 +08:00
|
|
|
end
|
More accurate Access Report scores for Quizzes
This patch makes it that when viewing the Access Report for a course
student, their "Times Viewed" column will reflect the number of times
the student has browsed the quiz or any of its related resources
(like History, or attempt views), but not taken it.
While the "Times Participated" column will reflect the number of times
the student really took the quiz (1:1 mapping with the number of
submissions.)
TEST PLAN
---- ----
In both test cases, you'll need:
- a course with a student enrolled
- one browser session with a teacher logged in viewing the Access
Report of the student
- one browser session with the student logged
CASE: Normal quizzes
- Create a quiz with a few questions and unlimited attempts.
- Refresh the teacher tab, keep an eye on Times "Viewed" and
"Participated" columns
- As the student:
- Go to the quizzes page
- Go to the quiz page
- Refresh the teacher tab, and:
- ONLY the "Times Viewed" score should be incremented by 1
- As the student:
- Push the Take the Quiz
- Refresh the teacher tab, and:
- ONLY the "Times Participated" score should be incremented by 1
- As the student:
- Refresh the quiz page (while taking it)
- Refresh the teacher tab, and:
- NEITHER score should be incremented
CASE: OQAAT quizzes
The expected behaviour for OQAAT quizzes is that the entire attempt
counts as 1 participation, just like the normal quizzes.
Follow the same steps as above, but:
- While taking the quiz, and for every question page:
- Refresh the teacher tab and make sure that neither score is
incremented
OBLIGATORY REFERENCES
---------- ----------
- Acceptance criteria @ http://docs.kodoware.com/canvas/cnvs-5294
refs CNVS-5294
Change-Id: I55883b8edbf417edb42b9fd103e08369e0e9e63c
Reviewed-on: https://gerrit.instructure.com/26543
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2013-11-22 01:33:04 +08:00
|
|
|
end
|
2016-12-03 13:27:46 +08:00
|
|
|
|
|
|
|
describe '#icon' do
|
|
|
|
it 'works for quizzes' do
|
|
|
|
quiz = @course.quizzes.create!(:title => 'My Quiz')
|
|
|
|
|
|
|
|
asset = factory_with_protected_attributes(AssetUserAccess, :user => @user, :context => @course, :asset_code => quiz.asset_string)
|
|
|
|
asset.log(@course, { category: 'quizzes' })
|
|
|
|
asset.save!
|
|
|
|
|
|
|
|
expect(asset.icon).to eq 'icon-quiz'
|
|
|
|
end
|
|
|
|
end
|
2011-05-26 06:16:01 +08:00
|
|
|
end
|