Commit bdb82cda by Vik Paruchuri

Strip out JS, old urls

parent 52f3e9da
...@@ -9,7 +9,7 @@ class PeerGrading ...@@ -9,7 +9,7 @@ class PeerGrading
@message_container = $('.message-container') @message_container = $('.message-container')
@message_container.toggle(not @message_container.is(':empty')) @message_container.toggle(not @message_container.is(':empty'))
@problem_list = $('.problem-list') @problem_list = $('.problem-list')
@construct_progress_bar() @construct_progress_bar()
......
...@@ -38,14 +38,15 @@ import sys ...@@ -38,14 +38,15 @@ import sys
from pkg_resources import resource_string from pkg_resources import resource_string
from .capa_module import only_one, ComplexEncoder from .capa_module import only_one, ComplexEncoder
from peer_grading_service import peer_grading_service from peer_grading_service import peer_grading_service, GradingServiceError
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class PeerGradingModule(XModule): class PeerGradingModule(XModule):
_VERSION = 1 _VERSION = 1
js = {'coffee': [resource_string(__name__, 'js/src/combinedopenended/display.coffee'), js = {'coffee': [resource_string(__name__, 'js/src/peergrading/peer_grading.coffee'),
resource_string(__name__, 'js/src/peergrading/peer_grading_problem.coffee'),
resource_string(__name__, 'js/src/collapsible.coffee'), resource_string(__name__, 'js/src/collapsible.coffee'),
resource_string(__name__, 'js/src/javascript_loader.coffee'), resource_string(__name__, 'js/src/javascript_loader.coffee'),
]} ]}
...@@ -66,6 +67,7 @@ class PeerGradingModule(XModule): ...@@ -66,6 +67,7 @@ class PeerGradingModule(XModule):
#We need to set the location here so the child modules can use it #We need to set the location here so the child modules can use it
system.set('location', location) system.set('location', location)
self.system = system
self.peer_gs = peer_grading_service() self.peer_gs = peer_grading_service()
log.debug(self.system) log.debug(self.system)
...@@ -104,20 +106,22 @@ class PeerGradingModule(XModule): ...@@ -104,20 +106,22 @@ class PeerGradingModule(XModule):
'is_student_calibrated': self.is_student_calibrated, 'is_student_calibrated': self.is_student_calibrated,
'save_grade': self.save_grade, 'save_grade': self.save_grade,
'save_calibration_essay' : self.save_calibration_essay, 'save_calibration_essay' : self.save_calibration_essay,
'show_problem' : self.peer_grading_problem,
} }
if dispatch not in handlers: if dispatch not in handlers:
return 'Error' return 'Error'
before = self.get_progress()
d = handlers[dispatch](get) d = handlers[dispatch](get)
after = self.get_progress()
d.update({
'progress_changed': after != before,
'progress_status': Progress.to_js_status_str(after),
})
return json.dumps(d, cls=ComplexEncoder) return json.dumps(d, cls=ComplexEncoder)
def get_progress(self):
pass
def get_score(self):
pass
def get_next_submission(self, get): def get_next_submission(self, get):
""" """
Makes a call to the grading controller for the next essay that should be graded Makes a call to the grading controller for the next essay that should be graded
...@@ -146,12 +150,12 @@ class PeerGradingModule(XModule): ...@@ -146,12 +150,12 @@ class PeerGradingModule(XModule):
location = p['location'] location = p['location']
try: try:
response = peer_grading_service().get_next_submission(location, grader_id) response = self.peer_gs.get_next_submission(location, grader_id)
return HttpResponse(response, return HttpResponse(response,
mimetype="application/json") mimetype="application/json")
except GradingServiceError: except GradingServiceError:
log.exception("Error getting next submission. server url: {0} location: {1}, grader_id: {2}" log.exception("Error getting next submission. server url: {0} location: {1}, grader_id: {2}"
.format(peer_grading_service().url, location, grader_id)) .format(self.peer_gs.url, location, grader_id))
return json.dumps({'success': False, return json.dumps({'success': False,
'error': 'Could not connect to grading service'}) 'error': 'Could not connect to grading service'})
...@@ -185,20 +189,18 @@ class PeerGradingModule(XModule): ...@@ -185,20 +189,18 @@ class PeerGradingModule(XModule):
rubric_scores = p.getlist('rubric_scores[]') rubric_scores = p.getlist('rubric_scores[]')
submission_flagged = p['submission_flagged'] submission_flagged = p['submission_flagged']
try: try:
response = peer_grading_service().save_grade(location, grader_id, submission_id, response = self.peer_gs.save_grade(location, grader_id, submission_id,
score, feedback, submission_key, rubric_scores, submission_flagged) score, feedback, submission_key, rubric_scores, submission_flagged)
return HttpResponse(response, mimetype="application/json") return HttpResponse(response, mimetype="application/json")
except GradingServiceError: except GradingServiceError:
log.exception("""Error saving grade. server url: {0}, location: {1}, submission_id:{2}, log.exception("""Error saving grade. server url: {0}, location: {1}, submission_id:{2},
submission_key: {3}, score: {4}""" submission_key: {3}, score: {4}"""
.format(peer_grading_service().url, .format(self.peer_gs.url,
location, submission_id, submission_key, score) location, submission_id, submission_key, score)
) )
return json.dumps({'success': False, return json.dumps({'success': False,
'error': 'Could not connect to grading service'}) 'error': 'Could not connect to grading service'})
def is_student_calibrated(self, get): def is_student_calibrated(self, get):
""" """
Calls the grading controller to see if the given student is calibrated Calls the grading controller to see if the given student is calibrated
...@@ -226,16 +228,14 @@ class PeerGradingModule(XModule): ...@@ -226,16 +228,14 @@ class PeerGradingModule(XModule):
location = p['location'] location = p['location']
try: try:
response = peer_grading_service().is_student_calibrated(location, grader_id) response = self.peer_gs.is_student_calibrated(location, grader_id)
return HttpResponse(response, mimetype="application/json") return HttpResponse(response, mimetype="application/json")
except GradingServiceError: except GradingServiceError:
log.exception("Error from grading service. server url: {0}, grader_id: {0}, location: {1}" log.exception("Error from grading service. server url: {0}, grader_id: {0}, location: {1}"
.format(peer_grading_service().url, grader_id, location)) .format(self.peer_gs.url, grader_id, location))
return json.dumps({'success': False, return json.dumps({'success': False,
'error': 'Could not connect to grading service'}) 'error': 'Could not connect to grading service'})
def show_calibration_essay(self, get): def show_calibration_essay(self, get):
""" """
Fetch the next calibration essay from the grading controller and return it Fetch the next calibration essay from the grading controller and return it
...@@ -270,11 +270,11 @@ class PeerGradingModule(XModule): ...@@ -270,11 +270,11 @@ class PeerGradingModule(XModule):
p = request.POST p = request.POST
location = p['location'] location = p['location']
try: try:
response = peer_grading_service().show_calibration_essay(location, grader_id) response = self.peer_gs.show_calibration_essay(location, grader_id)
return HttpResponse(response, mimetype="application/json") return HttpResponse(response, mimetype="application/json")
except GradingServiceError: except GradingServiceError:
log.exception("Error from grading service. server url: {0}, location: {0}" log.exception("Error from grading service. server url: {0}, location: {0}"
.format(peer_grading_service().url, location)) .format(self.peer_gs.url, location))
return json.dumps({'success': False, return json.dumps({'success': False,
'error': 'Could not connect to grading service'}) 'error': 'Could not connect to grading service'})
# if we can't parse the rubric into HTML, # if we can't parse the rubric into HTML,
...@@ -318,13 +318,14 @@ class PeerGradingModule(XModule): ...@@ -318,13 +318,14 @@ class PeerGradingModule(XModule):
rubric_scores = p.getlist('rubric_scores[]') rubric_scores = p.getlist('rubric_scores[]')
try: try:
response = peer_grading_service().save_calibration_essay(location, grader_id, calibration_essay_id, response = self.peer_gs.save_calibration_essay(location, grader_id, calibration_essay_id,
submission_key, score, feedback, rubric_scores) submission_key, score, feedback, rubric_scores)
return HttpResponse(response, mimetype="application/json") return HttpResponse(response, mimetype="application/json")
except GradingServiceError: except GradingServiceError:
log.exception("Error saving calibration grade, location: {0}, submission_id: {1}, submission_key: {2}, grader_id: {3}".format(location, submission_id, submission_key, grader_id)) log.exception("Error saving calibration grade, location: {0}, submission_id: {1}, submission_key: {2}, grader_id: {3}".format(location, submission_id, submission_key, grader_id))
return _err_response('Could not connect to grading service') return _err_response('Could not connect to grading service')
def peer_grading(self, request, course_id):
def peer_grading(self, get = None):
''' '''
Show a peer grading interface Show a peer grading interface
''' '''
...@@ -334,7 +335,7 @@ class PeerGradingModule(XModule): ...@@ -334,7 +335,7 @@ class PeerGradingModule(XModule):
error_text = "" error_text = ""
problem_list = [] problem_list = []
try: try:
problem_list_json = self.peer_gs.get_problem_list(course_id, unique_id_for_user(request.user)) problem_list_json = self.peer_gs.get_problem_list(course_id, self.system.anonymous_student_id)
problem_list_dict = json.loads(problem_list_json) problem_list_dict = json.loads(problem_list_json)
success = problem_list_dict['success'] success = problem_list_dict['success']
if 'error' in problem_list_dict: if 'error' in problem_list_dict:
...@@ -350,7 +351,7 @@ class PeerGradingModule(XModule): ...@@ -350,7 +351,7 @@ class PeerGradingModule(XModule):
error_text = "Could not get problem list" error_text = "Could not get problem list"
success = False success = False
ajax_url = _reverse_with_slash('peer_grading', course_id) ajax_url = self.system.ajax_url
return self.system.render_template('peer_grading/peer_grading.html', { return self.system.render_template('peer_grading/peer_grading.html', {
'course': course, 'course': course,
...@@ -363,16 +364,20 @@ class PeerGradingModule(XModule): ...@@ -363,16 +364,20 @@ class PeerGradingModule(XModule):
'staff_access': False, }) 'staff_access': False, })
def peer_grading_problem(request, course_id): def peer_grading_problem(self, get = None):
''' '''
Show individual problem interface Show individual problem interface
''' '''
course = get_course_with_access(request.user, course_id, 'load') if get == None:
problem_location = request.GET.get("location") problem_location = self.system.location
elif get.get('location') is not None:
problem_location = get.get('location')
else:
problem_location = self.system.location
ajax_url = _reverse_with_slash('peer_grading', course_id) ajax_url = self.system.ajax_url
return render_to_response('peer_grading/peer_grading_problem.html', { return self.system.render_template('peer_grading/peer_grading_problem.html', {
'view_html': '', 'view_html': '',
'course': course, 'course': course,
'problem_location': problem_location, 'problem_location': problem_location,
......
...@@ -25,10 +25,11 @@ from xmodule.course_module import CourseDescriptor ...@@ -25,10 +25,11 @@ from xmodule.course_module import CourseDescriptor
from combined_open_ended_rubric import CombinedOpenEndedRubric, RubricParsingError from combined_open_ended_rubric import CombinedOpenEndedRubric, RubricParsingError
from lxml import etree from lxml import etree
from django.conf import settings from django.conf import settings
class GradingServiceError(Exception):
pass
class PeerGradingService(): class PeerGradingService():
""" """
Interface with the grading controller for peer grading Interface with the grading controller for peer grading
......
...@@ -437,7 +437,6 @@ main_vendor_js = [ ...@@ -437,7 +437,6 @@ main_vendor_js = [
discussion_js = sorted(rooted_glob(PROJECT_ROOT / 'static', 'coffee/src/discussion/**/*.coffee')) discussion_js = sorted(rooted_glob(PROJECT_ROOT / 'static', 'coffee/src/discussion/**/*.coffee'))
staff_grading_js = sorted(rooted_glob(PROJECT_ROOT / 'static', 'coffee/src/staff_grading/**/*.coffee')) staff_grading_js = sorted(rooted_glob(PROJECT_ROOT / 'static', 'coffee/src/staff_grading/**/*.coffee'))
peer_grading_js = sorted(rooted_glob(PROJECT_ROOT / 'static','coffee/src/peer_grading/**/*.coffee'))
open_ended_js = sorted(rooted_glob(PROJECT_ROOT / 'static','coffee/src/open_ended/**/*.coffee')) open_ended_js = sorted(rooted_glob(PROJECT_ROOT / 'static','coffee/src/open_ended/**/*.coffee'))
PIPELINE_CSS = { PIPELINE_CSS = {
...@@ -469,7 +468,7 @@ PIPELINE_JS = { ...@@ -469,7 +468,7 @@ PIPELINE_JS = {
'source_filenames': sorted( 'source_filenames': sorted(
set(rooted_glob(COMMON_ROOT / 'static', 'coffee/src/**/*.coffee') + set(rooted_glob(COMMON_ROOT / 'static', 'coffee/src/**/*.coffee') +
rooted_glob(PROJECT_ROOT / 'static', 'coffee/src/**/*.coffee')) - rooted_glob(PROJECT_ROOT / 'static', 'coffee/src/**/*.coffee')) -
set(courseware_js + discussion_js + staff_grading_js + peer_grading_js + open_ended_js) set(courseware_js + discussion_js + staff_grading_js + open_ended_js)
) + [ ) + [
'js/form.ext.js', 'js/form.ext.js',
'js/my_courses_dropdown.js', 'js/my_courses_dropdown.js',
...@@ -499,10 +498,6 @@ PIPELINE_JS = { ...@@ -499,10 +498,6 @@ PIPELINE_JS = {
'source_filenames': staff_grading_js, 'source_filenames': staff_grading_js,
'output_filename': 'js/staff_grading.js' 'output_filename': 'js/staff_grading.js'
}, },
'peer_grading' : {
'source_filenames': peer_grading_js,
'output_filename': 'js/peer_grading.js'
},
'open_ended' : { 'open_ended' : {
'source_filenames': open_ended_js, 'source_filenames': open_ended_js,
'output_filename': 'js/open_ended.js' 'output_filename': 'js/open_ended.js'
......
<%inherit file="/main.html" />
<%block name="bodyclass">${course.css_class}</%block>
<%namespace name='static' file='/static_content.html'/>
<%block name="headextra">
<%static:css group='course'/>
</%block>
<%block name="title"><title>${course.number} Peer Grading</title></%block>
<%include file="/courseware/course_navigation.html" args="active_page='peer_grading'" />
<%block name="js_extra">
<%static:js group='peer_grading'/>
</%block>
<section class="container"> <section class="container">
<div class="peer-grading" data-ajax_url="${ajax_url}"> <div class="peer-grading" data-ajax_url="${ajax_url}">
<div class="error-container">${error_text}</div> <div class="error-container">${error_text}</div>
......
<%inherit file="/main.html" />
<%block name="bodyclass">${course.css_class}</%block>
<%namespace name='static' file='/static_content.html'/>
<%block name="headextra">
<%static:css group='course'/>
</%block>
<%block name="title"><title>${course.number} Peer Grading.</title></%block>
<%include file="/courseware/course_navigation.html" args="active_page='peer_grading'" />
<%block name="js_extra">
<%static:js group='peer_grading'/>
</%block>
<section class="container"> <section class="container">
<div class="peer-grading" data-ajax_url="${ajax_url}" data-location="${problem_location}"> <div class="peer-grading" data-ajax_url="${ajax_url}" data-location="${problem_location}">
<div class="error-container"></div> <div class="error-container"></div>
......
...@@ -265,23 +265,6 @@ if settings.COURSEWARE_ENABLED: ...@@ -265,23 +265,6 @@ if settings.COURSEWARE_ENABLED:
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/staff_grading/get_problem_list$', url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/staff_grading/get_problem_list$',
'open_ended_grading.staff_grading_service.get_problem_list', name='staff_grading_get_problem_list'), 'open_ended_grading.staff_grading_service.get_problem_list', name='staff_grading_get_problem_list'),
# Peer Grading
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/peer_grading$',
'open_ended_grading.views.peer_grading', name='peer_grading'),
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/peer_grading/problem$',
'open_ended_grading.views.peer_grading_problem', name='peer_grading_problem'),
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/peer_grading/get_next_submission$',
'open_ended_grading.peer_grading_service.get_next_submission', name='peer_grading_get_next_submission'),
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/peer_grading/show_calibration_essay$',
'open_ended_grading.peer_grading_service.show_calibration_essay', name='peer_grading_show_calibration_essay'),
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/peer_grading/is_student_calibrated$',
'open_ended_grading.peer_grading_service.is_student_calibrated', name='peer_grading_is_student_calibrated'),
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/peer_grading/save_grade$',
'open_ended_grading.peer_grading_service.save_grade', name='peer_grading_save_grade'),
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/peer_grading/save_calibration_essay$',
'open_ended_grading.peer_grading_service.save_calibration_essay', name='peer_grading_save_calibration_essay'),
# Open Ended problem list # Open Ended problem list
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/open_ended_problems$', url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/open_ended_problems$',
'open_ended_grading.views.student_problem_list', name='open_ended_problems'), 'open_ended_grading.views.student_problem_list', name='open_ended_problems'),
......
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