Commit 9475c6ed by Vik Paruchuri

Address review comments

parent 5bbb70ef
...@@ -456,7 +456,6 @@ class PeerGradingModule(XModule): ...@@ -456,7 +456,6 @@ class PeerGradingModule(XModule):
try: try:
problem_list_json = self.peer_gs.get_problem_list(self.system.course_id, self.system.anonymous_student_id) problem_list_json = self.peer_gs.get_problem_list(self.system.course_id, self.system.anonymous_student_id)
problem_list_dict = problem_list_json problem_list_dict = problem_list_json
log.debug(problem_list_dict)
success = problem_list_dict['success'] success = problem_list_dict['success']
if 'error' in problem_list_dict: if 'error' in problem_list_dict:
error_text = problem_list_dict['error'] error_text = problem_list_dict['error']
...@@ -593,7 +592,6 @@ class PeerGradingDescriptor(XmlDescriptor, EditingDescriptor): ...@@ -593,7 +592,6 @@ class PeerGradingDescriptor(XmlDescriptor, EditingDescriptor):
'task_xml': dictionary of xml strings, 'task_xml': dictionary of xml strings,
} }
""" """
log.debug("In definition")
expected_children = [] expected_children = []
for child in expected_children: for child in expected_children:
if len(xml_object.xpath(child)) == 0: if len(xml_object.xpath(child)) == 0:
......
...@@ -89,18 +89,23 @@ def peer_grading(request, course_id): ...@@ -89,18 +89,23 @@ def peer_grading(request, course_id):
Show a peer grading interface Show a peer grading interface
''' '''
#Get the current course
course = get_course_with_access(request.user, course_id, 'load') course = get_course_with_access(request.user, course_id, 'load')
course_id_parts = course.id.split("/") course_id_parts = course.id.split("/")
false_dict = [False,"False", "false", "FALSE"] false_dict = [False,"False", "false", "FALSE"]
#Reverse the base course url
base_course_url = reverse('courses') base_course_url = reverse('courses')
try: try:
#TODO: This will not work with multiple runs of a course. Make it work. The last key in the Location passed #TODO: This will not work with multiple runs of a course. Make it work. The last key in the Location passed
#to get_items is called revision. Is this the same as run? #to get_items is called revision. Is this the same as run?
#Get the peer grading modules currently in the course
items = modulestore().get_items(['i4x', None, course_id_parts[1], 'peergrading', None]) items = modulestore().get_items(['i4x', None, course_id_parts[1], 'peergrading', None])
#See if any of the modules are centralized modules (ie display info from multiple problems)
items = [i for i in items if i.metadata.get("use_for_single_location", True) in false_dict] items = [i for i in items if i.metadata.get("use_for_single_location", True) in false_dict]
#Get the first one
item_location = items[0].location item_location = items[0].location
item_location_url = item_location.url() #Generate a url for the first module and redirect the user to it
problem_url_parts = search.path_to_location(modulestore(), course.id, item_location) problem_url_parts = search.path_to_location(modulestore(), course.id, item_location)
problem_url = generate_problem_url(problem_url_parts, base_course_url) problem_url = generate_problem_url(problem_url_parts, base_course_url)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment