Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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-platform
Commits
640b7fe6
Commit
640b7fe6
authored
Sep 12, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix problem with peer grading list not rendering, test
parent
009017fe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
15 deletions
+50
-15
common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py
+6
-6
common/lib/xmodule/xmodule/peer_grading_module.py
+17
-9
common/lib/xmodule/xmodule/tests/test_peer_grading.py
+27
-0
No files found.
common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py
View file @
640b7fe6
...
...
@@ -94,9 +94,9 @@ class MockPeerGradingService(object):
'success'
:
True
,
'submission_id'
:
1
,
'submission_key'
:
""
,
'student_response'
:
'
fake student response
'
,
'prompt'
:
'
fake submission prompt
'
,
'rubric'
:
'
fake rubric
'
,
'student_response'
:
'
Sample student response.
'
,
'prompt'
:
'
Sample submission prompt.
'
,
'rubric'
:
'
Placeholder text for the full rubric.
'
,
'max_score'
:
4
}
...
...
@@ -110,9 +110,9 @@ class MockPeerGradingService(object):
return
{
'success'
:
True
,
'submission_id'
:
1
,
'submission_key'
:
''
,
'student_response'
:
'
fake student response
'
,
'prompt'
:
'
fake submission prompt
'
,
'rubric'
:
'
fake rubric
'
,
'student_response'
:
'
Sample student response.
'
,
'prompt'
:
'
Sample submission prompt.
'
,
'rubric'
:
'
Placeholder text for the full rubric.
'
,
'max_score'
:
4
}
def
save_calibration_essay
(
self
,
**
kwargs
):
...
...
common/lib/xmodule/xmodule/peer_grading_module.py
View file @
640b7fe6
...
...
@@ -8,7 +8,7 @@ from pkg_resources import resource_string
from
.capa_module
import
ComplexEncoder
from
.x_module
import
XModule
from
xmodule.raw_module
import
RawDescriptor
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
,
NoPathToItem
from
.timeinfo
import
TimeInfo
from
xblock.fields
import
Dict
,
String
,
Scope
,
Boolean
,
Float
from
xmodule.fields
import
Date
,
Timedelta
...
...
@@ -108,6 +108,10 @@ class PeerGradingModule(PeerGradingFields, XModule):
log
.
error
(
"Linked location {0} for peer grading module {1} does not exist"
.
format
(
self
.
link_to_location
,
self
.
location
))
raise
except
NoPathToItem
:
log
.
error
(
"Linked location {0} for peer grading module {1} cannot be linked to."
.
format
(
self
.
link_to_location
,
self
.
location
))
raise
due_date
=
self
.
linked_problem
.
due
if
due_date
:
self
.
due
=
due_date
...
...
@@ -514,14 +518,18 @@ class PeerGradingModule(PeerGradingFields, XModule):
def
_find_corresponding_module_for_location
(
location
):
'''
find the peer grading module that links to the given location
'''
"""
Find the peer grading module that links to the given location.
"""
try
:
return
modulestore
()
.
get_instance
(
self
.
system
.
course_id
,
location
)
except
Exception
:
# the linked problem doesn't exist
log
.
error
(
"Problem {0} does not exist in this course"
.
format
(
location
))
return
self
.
descriptor
.
system
.
load_item
(
location
)
except
ItemNotFoundError
:
# The linked problem doesn't exist.
log
.
error
(
"Problem {0} does not exist in this course."
.
format
(
location
))
raise
except
NoPathToItem
:
# The linked problem doesn't exist.
log
.
error
(
"Cannot find a path to problem {0} in this course."
.
format
(
location
))
raise
good_problem_list
=
[]
...
...
@@ -529,7 +537,7 @@ class PeerGradingModule(PeerGradingFields, XModule):
problem_location
=
problem
[
'location'
]
try
:
descriptor
=
_find_corresponding_module_for_location
(
problem_location
)
except
Exception
:
except
(
NoPathToItem
,
ItemNotFoundError
)
:
continue
if
descriptor
:
problem
[
'due'
]
=
descriptor
.
due
...
...
common/lib/xmodule/xmodule/tests/test_peer_grading.py
View file @
640b7fe6
...
...
@@ -2,6 +2,8 @@ import unittest
from
xmodule.modulestore
import
Location
from
.
import
get_test_system
from
test_util_open_ended
import
MockQueryDict
,
DummyModulestore
from
xmodule.open_ended_grading_classes.peer_grading_service
import
MockPeerGradingService
import
json
import
logging
...
...
@@ -136,6 +138,13 @@ class PeerGradingModuleTest(unittest.TestCase, DummyModulestore):
"""
self
.
peer_grading
.
get_instance_state
()
class
MockPeerGradingServiceProblemList
(
MockPeerGradingService
):
def
get_problem_list
(
self
,
course_id
,
grader_id
):
return
{
'success'
:
True
,
'problem_list'
:
[
{
"num_graded"
:
3
,
"num_pending"
:
681
,
"num_required"
:
3
,
"location"
:
"i4x://edX/open_ended/combinedopenended/SampleQuestion"
,
"problem_name"
:
"Peer-Graded Essay"
},
]}
class
PeerGradingModuleScoredTest
(
unittest
.
TestCase
,
DummyModulestore
):
"""
Test peer grading xmodule at the unit level. More detailed tests are difficult, as the module relies on an
...
...
@@ -155,3 +164,20 @@ class PeerGradingModuleScoredTest(unittest.TestCase, DummyModulestore):
def
test_metadata_load
(
self
):
peer_grading
=
self
.
get_module_from_location
(
self
.
problem_location
,
COURSE
)
self
.
assertEqual
(
peer_grading
.
closed
(),
False
)
def
test_problem_list
(
self
):
"""
Test to see if a peer grading problem list can be correctly initialized.
"""
# Initialize peer grading module.
peer_grading
=
self
.
get_module_from_location
(
self
.
problem_location
,
COURSE
)
# Ensure that it cannot find any peer grading.
html
=
peer_grading
.
peer_grading
()
self
.
assertNotRegexpMatches
(
html
,
"Peer-Graded"
)
#Swap for our mock class, which will find peer grading.
peer_grading
.
peer_gs
=
MockPeerGradingServiceProblemList
()
html
=
peer_grading
.
peer_grading
()
self
.
assertRegexpMatches
(
html
,
"Peer-Graded"
)
\ No newline at end of file
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