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
009017fe
Commit
009017fe
authored
Sep 12, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address review comments
parent
b222e66f
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
49 additions
and
6 deletions
+49
-6
common/test/data/open_ended_nopath/README.md
+1
-0
common/test/data/open_ended_nopath/course.xml
+1
-0
common/test/data/open_ended_nopath/course/2012_Fall.xml
+4
-0
common/test/data/open_ended_nopath/peergrading/PeerGradingNoPath.xml
+2
-0
common/test/data/open_ended_nopath/policies/2012_Fall.json
+11
-0
lms/djangoapps/courseware/tests/modulestore_config.py
+1
-0
lms/djangoapps/open_ended_grading/tests.py
+20
-0
lms/djangoapps/open_ended_grading/views.py
+9
-6
No files found.
common/test/data/open_ended_nopath/README.md
0 → 100644
View file @
009017fe
This is a very very simple course, useful for debugging open ended grading code. This is specifically for testing if a peer grading module with no path to it in the course will be handled properly.
common/test/data/open_ended_nopath/course.xml
0 → 100644
View file @
009017fe
<course
org=
"edX"
course=
"open_ended_nopath"
url_name=
"2012_Fall"
/>
common/test/data/open_ended_nopath/course/2012_Fall.xml
0 → 100644
View file @
009017fe
<course>
<chapter
url_name=
"Overview"
>
</chapter>
</course>
common/test/data/open_ended_nopath/peergrading/PeerGradingNoPath.xml
0 → 100644
View file @
009017fe
<peergrading/>
\ No newline at end of file
common/test/data/open_ended_nopath/policies/2012_Fall.json
0 → 100644
View file @
009017fe
{
"course/2012_Fall"
:
{
"graceperiod"
:
"2 days 5 hours 59 minutes 59 seconds"
,
"start"
:
"2015-07-17T12:00"
,
"display_name"
:
"Self Assessment Test"
,
"graded"
:
"true"
},
"chapter/Overview"
:
{
"display_name"
:
"Overview"
}
}
lms/djangoapps/courseware/tests/modulestore_config.py
View file @
009017fe
...
...
@@ -22,5 +22,6 @@ MAPPINGS = {
'edX/test_about_blob_end_date/2012_Fall'
:
'xml'
,
'edX/graded/2012_Fall'
:
'xml'
,
'edX/open_ended/2012_Fall'
:
'xml'
,
'edX/open_ended_nopath/2012_Fall'
:
'xml'
,
}
TEST_DATA_MIXED_MODULESTORE
=
mixed_store_config
(
TEST_DATA_DIR
,
MAPPINGS
)
lms/djangoapps/open_ended_grading/tests.py
View file @
009017fe
...
...
@@ -320,3 +320,22 @@ class TestPanel(ModuleStoreTestCase, LoginEnrollmentTestCase):
request
=
Mock
(
user
=
self
.
user
)
response
=
views
.
student_problem_list
(
request
,
self
.
course
.
id
)
self
.
assertRegexpMatches
(
response
.
content
,
"Here are a list of open ended problems for this course."
)
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
class
TestPeerGradingFound
(
ModuleStoreTestCase
):
"""
Test to see if peer grading modules can be found properly.
"""
def
setUp
(
self
):
self
.
course_name
=
'edX/open_ended_nopath/2012_Fall'
self
.
course
=
modulestore
()
.
get_course
(
self
.
course_name
)
def
test_peer_grading_nopath
(
self
):
"""
The open_ended_nopath course contains a peer grading module with no path to it.
Ensure that the exception is caught.
"""
found
,
url
=
views
.
find_peer_grading_module
(
self
.
course
)
self
.
assertEqual
(
found
,
False
)
\ No newline at end of file
lms/djangoapps/open_ended_grading/views.py
View file @
009017fe
...
...
@@ -97,28 +97,31 @@ def find_peer_grading_module(course):
@param course: A course object.
@return: boolean found_module, string problem_url
"""
#Reverse the base course url
# Reverse the base course url.
base_course_url
=
reverse
(
'courses'
)
found_module
=
False
problem_url
=
""
#
Get the course id and split it
#
Get the course id and split it.
course_id_parts
=
course
.
id
.
split
(
"/"
)
log
.
info
(
"COURSE ID PARTS"
)
log
.
info
(
course_id_parts
)
#Get the peer grading modules currently in the course. Explicitly specify the course id to avoid issues with different runs.
#
Get the peer grading modules currently in the course. Explicitly specify the course id to avoid issues with different runs.
items
=
modulestore
()
.
get_items
([
'i4x'
,
course_id_parts
[
0
],
course_id_parts
[
1
],
'peergrading'
,
None
],
course_id
=
course
.
id
)
#See if any of the modules are centralized modules (ie display info from multiple problems)
items
=
[
i
for
i
in
items
if
not
getattr
(
i
,
"use_for_single_location"
,
True
)]
#
Get the first one
#
Loop through all potential peer grading modules, and find the first one that has a path to it.
for
item
in
items
:
item_location
=
item
.
location
#
Generate a url for the first module and redirect the user to it
#
Generate a url for the first module and redirect the user to it.
try
:
problem_url_parts
=
search
.
path_to_location
(
modulestore
(),
course
.
id
,
item_location
)
except
NoPathToItem
:
log
.
info
(
"Invalid peer grading module location {0} in course {1}."
.
format
(
item_location
,
course
.
id
))
# In the case of nopathtoitem, the peer grading module that was found is in an invalid state, and
# can no longer be accessed. Log an informational message, but this will not impact normal behavior.
log
.
info
(
"Invalid peer grading module location {0} in course {1}. This module may need to be removed."
.
format
(
item_location
,
course
.
id
))
continue
problem_url
=
generate_problem_url
(
problem_url_parts
,
base_course_url
)
found_module
=
True
...
...
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