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
428824c3
Commit
428824c3
authored
Mar 21, 2014
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small refactoring and adding comments in response to PR comments.
parent
9a184f06
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
apps/openassessment/assessment/models.py
+10
-0
apps/openassessment/assessment/peer_api.py
+1
-4
apps/openassessment/assessment/self_api.py
+1
-4
No files found.
apps/openassessment/assessment/models.py
View file @
428824c3
...
...
@@ -352,6 +352,8 @@ class Assessment(models.Model):
if
not
assessments
:
return
[]
# Generate a cache key that represents all the assessments we're being
# asked to grab scores from (comma separated list of assessment IDs)
cache_key
=
"assessments.scores_by_criterion.{}"
.
format
(
","
.
join
(
str
(
assessment
.
id
)
for
assessment
in
assessments
)
)
...
...
@@ -394,6 +396,14 @@ class AssessmentPart(models.Model):
def
points_possible
(
self
):
return
self
.
option
.
criterion
.
points_possible
@classmethod
def
add_to_assessment
(
cls
,
assessment
,
option_ids
):
"""Creates AssessmentParts and adds them to `assessment`."""
cls
.
objects
.
bulk_create
([
cls
(
assessment
=
assessment
,
option_id
=
option_id
)
for
option_id
in
option_ids
])
class
AssessmentFeedback
(
models
.
Model
):
"""A response to a submission's feedback, judging accuracy or helpfulness."""
...
...
apps/openassessment/assessment/peer_api.py
View file @
428824c3
...
...
@@ -199,10 +199,7 @@ def create_assessment(
# We do this to do a run around django-rest-framework serializer
# validation, which would otherwise require two DB queries per
# option to do validation. We already validated these options above.
AssessmentPart
.
objects
.
bulk_create
([
AssessmentPart
(
assessment
=
assessment
,
option_id
=
option_id
)
for
option_id
in
option_ids
])
AssessmentPart
.
add_to_assessment
(
assessment
,
option_ids
)
student_item
=
submission
.
student_item
student_item_dict
=
StudentItemSerializer
(
student_item
)
.
data
...
...
apps/openassessment/assessment/self_api.py
View file @
428824c3
...
...
@@ -94,10 +94,7 @@ def create_assessment(submission_uuid, user_id, options_selected, rubric_dict, s
# We do this to do a run around django-rest-framework serializer
# validation, which would otherwise require two DB queries per
# option to do validation. We already validated these options above.
AssessmentPart
.
objects
.
bulk_create
([
AssessmentPart
(
assessment
=
assessment
,
option_id
=
option_id
)
for
option_id
in
option_ids
])
AssessmentPart
.
add_to_assessment
(
assessment
,
option_ids
)
# Return the serialized assessment
return
full_assessment_dict
(
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