Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-ora2
Commits
91a5c710
Commit
91a5c710
authored
Jul 24, 2014
by
gradyward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed some of models/base.py to reflect the increased complexity
parent
8a4e5d9f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
5 deletions
+35
-5
openassessment/assessment/models/base.py
+34
-2
openassessment/assessment/test/test_peer.py
+1
-1
openassessment/assessment/test/test_self.py
+0
-2
No files found.
openassessment/assessment/models/base.py
View file @
91a5c710
...
...
@@ -655,8 +655,8 @@ class AssessmentPart(models.Model):
}
# Validate that we have selections for all criteria
# This will raise an exception if we're missing any criteria
cls
.
_check_
has_all_criteria
(
rubric_index
,
set
(
selected
.
keys
()
+
feedback
.
keys
()
))
# This will raise an exception if we're missing any
selections/feedback required for
criteria
cls
.
_check_
all_criteria_assessed
(
rubric_index
,
selected
.
keys
(),
feedback
.
keys
(
))
# Retrieve the criteria/option/feedback for criteria that have options.
# Since we're using the rubric's index, we'll get an `InvalidRubricSelection` error
...
...
@@ -773,3 +773,34 @@ class AssessmentPart(models.Model):
if
len
(
missing_criteria
)
>
0
:
msg
=
u"Missing selections for criteria: {missing}"
.
format
(
missing
=
missing_criteria
)
raise
InvalidRubricSelection
(
msg
)
@classmethod
def
_check_all_criteria_assessed
(
cls
,
rubric_index
,
selected_criteria
,
criteria_feedback
):
"""
Verify that we've selected options OR have feedback for all criteria in the rubric.
Verifies the predicate for all criteria (X) in the rubric:
has-an-option-selected(X) OR (has-zero-options(X) AND has-criterion-feedback(X))
Args:
rubric_index (RubricIndex): The index of the rubric's data.
selected_criteria (list): list of criterion names
Returns:
None
Raises:
InvalidRubricSelection
"""
missing_option_selections
=
rubric_index
.
find_missing_criteria
(
selected_criteria
)
zero_option_criteria
=
set
([
c
.
name
for
c
in
rubric_index
.
find_criteria_without_options
()])
zero_option_criteria_missing_feedback
=
zero_option_criteria
-
set
(
criteria_feedback
)
optioned_criteria_missing_selection
=
missing_option_selections
-
zero_option_criteria
missing_criteria
=
zero_option_criteria_missing_feedback
|
optioned_criteria_missing_selection
if
len
(
missing_criteria
)
>
0
:
msg
=
u"Missing selections for criteria: {missing}"
.
format
(
missing
=
missing_criteria
)
raise
InvalidRubricSelection
(
msg
)
\ No newline at end of file
openassessment/assessment/test/test_peer.py
View file @
91a5c710
...
...
@@ -151,7 +151,7 @@ class TestPeerApi(CacheResetTest):
Tests for the peer assessment API functions.
"""
CREATE_ASSESSMENT_NUM_QUERIES
=
59
CREATE_ASSESSMENT_NUM_QUERIES
=
63
def
test_create_assessment_points
(
self
):
self
.
_create_student_and_submission
(
"Tim"
,
"Tim's answer"
)
...
...
openassessment/assessment/test/test_self.py
View file @
91a5c710
...
...
@@ -169,8 +169,6 @@ class TestSelfApi(CacheResetTest):
options
=
copy
.
deepcopy
(
self
.
OPTIONS_SELECTED
)
del
options
[
'clarity'
]
import
pudb
,
sys
as
__sys
;
__sys
.
stdout
=
__sys
.
__stdout__
;
pudb
.
set_trace
()
# -={XX}=-={XX}=-={XX}=
# Attempt to create a self-assessment with options that do not match the rubric
with
self
.
assertRaises
(
SelfAssessmentRequestError
):
create_assessment
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment