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
6fa12885
Commit
6fa12885
authored
Apr 05, 2016
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle IntegrityError according to 1.8 conventions.
parent
b8307ca9
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
4 deletions
+8
-4
openassessment/assessment/api/peer.py
+2
-0
openassessment/assessment/api/staff.py
+1
-1
openassessment/assessment/models/student_training.py
+2
-1
openassessment/assessment/serializers/training.py
+1
-0
openassessment/assessment/test/test_student_training_api.py
+2
-2
No files found.
openassessment/assessment/api/peer.py
View file @
6fa12885
...
@@ -115,6 +115,7 @@ def on_start(submission_uuid):
...
@@ -115,6 +115,7 @@ def on_start(submission_uuid):
"""
"""
try
:
try
:
with
transaction
.
atomic
():
submission
=
sub_api
.
get_submission_and_student
(
submission_uuid
)
submission
=
sub_api
.
get_submission_and_student
(
submission_uuid
)
workflow
,
__
=
PeerWorkflow
.
objects
.
get_or_create
(
workflow
,
__
=
PeerWorkflow
.
objects
.
get_or_create
(
student_id
=
submission
[
'student_item'
][
'student_id'
],
student_id
=
submission
[
'student_item'
][
'student_id'
],
...
@@ -721,6 +722,7 @@ def create_peer_workflow(submission_uuid):
...
@@ -721,6 +722,7 @@ def create_peer_workflow(submission_uuid):
"""
"""
try
:
try
:
with
transaction
.
atomic
():
submission
=
sub_api
.
get_submission_and_student
(
submission_uuid
)
submission
=
sub_api
.
get_submission_and_student
(
submission_uuid
)
workflow
,
__
=
PeerWorkflow
.
objects
.
get_or_create
(
workflow
,
__
=
PeerWorkflow
.
objects
.
get_or_create
(
student_id
=
submission
[
'student_item'
][
'student_id'
],
student_id
=
submission
[
'student_item'
][
'student_id'
],
...
...
openassessment/assessment/api/staff.py
View file @
6fa12885
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
Public interface for staff grading, used by students/course staff.
Public interface for staff grading, used by students/course staff.
"""
"""
import
logging
import
logging
from
django.db
import
DatabaseError
,
IntegrityError
,
transaction
from
django.db
import
DatabaseError
,
transaction
from
django.utils.timezone
import
now
from
django.utils.timezone
import
now
from
dogapi
import
dog_stats_api
from
dogapi
import
dog_stats_api
...
...
openassessment/assessment/models/student_training.py
View file @
6fa12885
"""
"""
Django models specific to the student training assessment type.
Django models specific to the student training assessment type.
"""
"""
from
django.db
import
models
,
IntegrityError
from
django.db
import
models
,
transaction
,
IntegrityError
from
django.utils
import
timezone
from
django.utils
import
timezone
from
submissions
import
api
as
sub_api
from
submissions
import
api
as
sub_api
from
.training
import
TrainingExample
from
.training
import
TrainingExample
...
@@ -137,6 +137,7 @@ class StudentTrainingWorkflow(models.Model):
...
@@ -137,6 +137,7 @@ class StudentTrainingWorkflow(models.Model):
next_example
=
available_examples
[
0
]
next_example
=
available_examples
[
0
]
try
:
try
:
with
transaction
.
atomic
():
StudentTrainingWorkflowItem
.
objects
.
create
(
StudentTrainingWorkflowItem
.
objects
.
create
(
workflow
=
self
,
workflow
=
self
,
order_num
=
order_num
,
order_num
=
order_num
,
...
...
openassessment/assessment/serializers/training.py
View file @
6fa12885
...
@@ -181,6 +181,7 @@ def deserialize_training_examples(examples, rubric_dict):
...
@@ -181,6 +181,7 @@ def deserialize_training_examples(examples, rubric_dict):
example
=
TrainingExample
.
objects
.
get
(
content_hash
=
content_hash
)
example
=
TrainingExample
.
objects
.
get
(
content_hash
=
content_hash
)
except
TrainingExample
.
DoesNotExist
:
except
TrainingExample
.
DoesNotExist
:
try
:
try
:
with
transaction
.
atomic
():
example
=
TrainingExample
.
create_example
(
example
=
TrainingExample
.
create_example
(
example_dict
[
'answer'
],
example_dict
[
'options_selected'
],
rubric
example_dict
[
'answer'
],
example_dict
[
'options_selected'
],
rubric
)
)
...
...
openassessment/assessment/test/test_student_training_api.py
View file @
6fa12885
...
@@ -103,7 +103,7 @@ class StudentTrainingAssessmentTest(CacheResetTest):
...
@@ -103,7 +103,7 @@ class StudentTrainingAssessmentTest(CacheResetTest):
# This will need to create the student training workflow and the first item
# This will need to create the student training workflow and the first item
# NOTE: we *could* cache the rubric model to reduce the number of queries here,
# NOTE: we *could* cache the rubric model to reduce the number of queries here,
# but we're selecting it by content hash, which is indexed and should be plenty fast.
# but we're selecting it by content hash, which is indexed and should be plenty fast.
with
self
.
assertNumQueries
(
6
):
with
self
.
assertNumQueries
(
8
):
training_api
.
get_training_example
(
self
.
submission_uuid
,
RUBRIC
,
EXAMPLES
)
training_api
.
get_training_example
(
self
.
submission_uuid
,
RUBRIC
,
EXAMPLES
)
# Without assessing the first training example, try to retrieve a training example.
# Without assessing the first training example, try to retrieve a training example.
...
@@ -117,7 +117,7 @@ class StudentTrainingAssessmentTest(CacheResetTest):
...
@@ -117,7 +117,7 @@ class StudentTrainingAssessmentTest(CacheResetTest):
# Retrieve the next training example, which requires us to create
# Retrieve the next training example, which requires us to create
# a new workflow item (but not a new workflow).
# a new workflow item (but not a new workflow).
with
self
.
assertNumQueries
(
6
):
with
self
.
assertNumQueries
(
8
):
training_api
.
get_training_example
(
self
.
submission_uuid
,
RUBRIC
,
EXAMPLES
)
training_api
.
get_training_example
(
self
.
submission_uuid
,
RUBRIC
,
EXAMPLES
)
def
test_submitter_is_finished_num_queries
(
self
):
def
test_submitter_is_finished_num_queries
(
self
):
...
...
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