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
c2509762
Commit
c2509762
authored
11 years ago
by
Stephen Sanchez
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #221 from edx/sanchez/more_performance_improvements
Performance changes for staggered deadlines
parents
b4753ea7
1e5ac5ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
49 deletions
+38
-49
apps/openassessment/assessment/peer_api.py
+38
-49
No files found.
apps/openassessment/assessment/peer_api.py
View file @
c2509762
...
...
@@ -760,20 +760,34 @@ def _get_submission_for_review(workflow, graded_by, over_grading=False):
"""
timeout
=
(
timezone
.
now
()
-
TIME_LIMIT
)
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
# The follow query behaves as the Peer Assessment Queue. This will
# find the next submission (via PeerWorkflow) in this course / question
# that:
# 1) Does not belong to you
# 2) Does not have enough completed assessments
# 3) Is not something you have already scored.
# 4) Does not have a combination of completed assessments or open
# assessments equal to or more than the requirement.
try
:
peer_workflows
=
list
(
PeerWorkflow
.
objects
.
raw
(
"select pw.id, pw.submission_uuid "
"from assessment_peerworkflow pw "
"left join assessment_peerworkflowitem pwi "
"on pw.id=pwi.author_id "
"where pw.item_id=
%
s "
"and pw.course_id=
%
s "
"and pw.student_id<>
%
s "
"and pw.graded_count <
%
s "
"and pw.id not in (select pwi.author_id from assessment_peerworkflowitem pwi where pwi.scorer_id=
%
s) "
"and (pwi.scorer_id is NULL or pwi.assessment_id is not NULL or pwi.started_at >
%
s) "
"group by pw.id "
"having count(pwi.id) <
%
s "
"and pw.id not in ("
" select pwi.author_id "
" from assessment_peerworkflowitem pwi "
" where pwi.scorer_id=
%
s "
") "
"and ("
" select count(pwi.id) as c "
" from assessment_peerworkflowitem pwi "
" where pwi.author_id=pw.id "
" and (pwi.assessment_id is not NULL or pwi.started_at >
%
s) "
") <
%
s "
"order by pw.created_at, pw.id "
"limit 1; "
,
[
workflow
.
item_id
,
...
...
@@ -813,19 +827,31 @@ def _get_submission_for_over_grading(workflow):
6) Returns the workflow with the fewest assessments.
"""
# The follow query behaves as the Peer Assessment Over Grading Queue. This
# will find the next submission (via PeerWorkflow) in this course / question
# that:
# 1) Does not belong to you
# 2) Is not something you have already scored
# 3) Has the fewest current assessments.
try
:
peer_workflows
=
list
(
PeerWorkflow
.
objects
.
raw
(
"select pw.id, pw.submission_uuid "
"select pw.id, pw.submission_uuid, ("
" select count(pwi.id) as c "
" from assessment_peerworkflowitem pwi "
" where pwi.author_id=pw.id "
") as c "
"from assessment_peerworkflow pw "
"left join assessment_peerworkflowitem pwi "
"on pw.id=pwi.author_id "
"where pw.item_id=
%
s "
"and pw.course_id=
%
s "
"and pw.student_id<>
%
s "
"and pw.id not in (select pwi.author_id from assessment_peerworkflowitem pwi where pwi.scorer_id=
%
s) "
"group by pw.id "
"order by count(pwi.id), pw.created_at, pw.id "
"and pw.id not in ("
" select pwi.author_id "
" from assessment_peerworkflowitem pwi "
" where pwi.scorer_id=
%
s "
") "
"order by c, pw.created_at, pw.id "
"limit 1; "
,
[
workflow
.
item_id
,
workflow
.
course_id
,
...
...
@@ -846,43 +872,6 @@ def _get_submission_for_over_grading(workflow):
raise
PeerAssessmentInternalError
(
error_message
)
def
_get_next_submission
(
order
,
workflow
,
*
args
):
"""Constructs a raw SQL query for over grading or general peer review
Refactored function for retrieving the first submission that meets the
criteria of the query, which is altered based on the parameters passed
into the function.
For example, for a general peer assessment query, the following would be
the generated SQL query:
select pw.id, pw.submission_uuid , pw.student_id
from assessment_peerworkflow pw
where pw.completed_at is NULL
and pw.item_id='item_one'
and pw.course_id='Demo_Course'
and pw.student_id<>'Tim'
and pw.id not in (select pwi.author_id from assessment_peerworkflowitem pwi where pwi.scorer_id=3159)
and (select count(pwi.id) from assessment_peerworkflowitem pwi where pwi.scorer_id=3159)
and (pw.started_at is NULL or pw.graded_count < 3 or (pw.graded_count = 3 and pw.started_at < '2014-03-14 20:09:04'))
order by pw.created_at, pw.id
limit 1;
Args:
order (str): A piece of the query that is unique to over grading or
general peer review. This is inserted in the otherwise identical
query.
workflow (PeerWorkflow): The workflow associated with the student
requesting a submission for peer assessment. Used to parametrize
the query.
Returns:
A submission uuid for the submission that should be peer assessed.
"""
def
_close_active_assessment
(
workflow
,
submission_uuid
,
assessment
):
"""Associate the work item with a complete assessment.
...
...
This diff is collapsed.
Click to expand it.
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