Make peer grading xmodule work with notifications
This commit is contained in:
@@ -64,7 +64,6 @@ def replace_static_urls(get_html, prefix, course_namespace=None):
|
||||
return replace_urls(get_html(), staticfiles_prefix=prefix, course_namespace = course_namespace)
|
||||
return _get_html
|
||||
|
||||
|
||||
def grade_histogram(module_id):
|
||||
''' Print out a histogram of grades on a given problem.
|
||||
Part of staff member debug info.
|
||||
|
||||
@@ -29,6 +29,9 @@ from xmodule import peer_grading_module
|
||||
from xmodule import peer_grading_service
|
||||
from mitxmako.shortcuts import render_to_string
|
||||
from xmodule.x_module import ModuleSystem
|
||||
from courseware import module_render
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from courseware.models import StudentModule, StudentModuleCache
|
||||
|
||||
from django.http import HttpResponse, Http404
|
||||
|
||||
@@ -86,14 +89,14 @@ def staff_grading(request, course_id):
|
||||
# Checked above
|
||||
'staff_access': True, })
|
||||
|
||||
|
||||
@cache_control(no_cache=True, no_store=True, must_revalidate=True)
|
||||
def peer_grading(request, course_id):
|
||||
'''
|
||||
Show a peer grading interface
|
||||
'''
|
||||
course = get_course_with_access(request.user, course_id, 'load')
|
||||
|
||||
ajax_url = ajax_url = _reverse_with_slash('peer_grading', course_id)
|
||||
ajax_url = _reverse_with_slash('peer_grading_ajax', course_id)
|
||||
track_function = None
|
||||
get_module = None
|
||||
render_template = render_to_string
|
||||
@@ -114,16 +117,35 @@ def peer_grading(request, course_id):
|
||||
definition = "<peergrading use_for_single_location = 'False'></peergrading>"
|
||||
descriptor = peer_grading_module.PeerGradingDescriptor
|
||||
instance_state = None
|
||||
pg_url = re.sub("/courses", "i4x:/", ajax_url)[:-1]
|
||||
|
||||
pg_module = peer_grading_module.PeerGradingModule(system, pg_url, definition, descriptor, instance_state)
|
||||
pg_ajax = _reverse_with_slash('peer_grading', course_id)
|
||||
pg_url = re.sub("/courses", "i4x:/",pg_ajax)[:-1]
|
||||
pg_location = request.GET.get('location', pg_url)
|
||||
|
||||
course = get_course_with_access(request.user, course_id, 'load')
|
||||
pg_module = peer_grading_module.PeerGradingModule(system, pg_location, definition, descriptor, instance_state)
|
||||
|
||||
return pg_module.get_html()
|
||||
"""
|
||||
return_html = pg_module.get_html()
|
||||
log.debug(return_html)
|
||||
response = render_to_response('peer_grading/peer_grading_notifications.html', {
|
||||
'peer_grading_html' : return_html,
|
||||
'course': course,
|
||||
'problem_location': pg_location,
|
||||
'course_id': course_id,
|
||||
'ajax_url': ajax_url,
|
||||
'staff_access': False,
|
||||
})
|
||||
"""
|
||||
|
||||
student_module_cache = StudentModuleCache(course_id,
|
||||
request.user, descriptor)
|
||||
|
||||
pg_xmodule = module_render.get_module(request.user, request, pg_location, student_module_cache, course_id)
|
||||
|
||||
return pg_xmodule.get_html()
|
||||
|
||||
@cache_control(no_cache=True, no_store=True, must_revalidate=True)
|
||||
def peer_grading_problem(request, course_id):
|
||||
def peer_grading_ajax(request, course_id):
|
||||
'''
|
||||
Show individual problem interface
|
||||
'''
|
||||
|
||||
@@ -52,20 +52,28 @@ CACHES = {
|
||||
# We set it to be a DummyCache to force reloading of course.xml in dev.
|
||||
# In staging environments, we would grab VERSION from data uploaded by the
|
||||
# push process.
|
||||
#'general': {
|
||||
# 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
||||
# 'KEY_PREFIX': 'general',
|
||||
# 'VERSION': 4,
|
||||
# 'LOCATION': 'mitx_loc_mem_cache_general',
|
||||
# 'KEY_FUNCTION': 'util.memcache.safe_key',
|
||||
#}
|
||||
|
||||
'general': {
|
||||
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
|
||||
'KEY_PREFIX': 'general',
|
||||
'VERSION': 4,
|
||||
'KEY_FUNCTION': 'util.memcache.safe_key',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
XQUEUE_INTERFACE = {
|
||||
"url": "https://sandbox-xqueue.edx.org",
|
||||
"url": "http://127.0.0.1:3032",
|
||||
"django_auth": {
|
||||
"username": "lms",
|
||||
"password": "***REMOVED***"
|
||||
"password": "abcd"
|
||||
},
|
||||
"basic_auth": ('anant', 'agarwal'),
|
||||
}
|
||||
@@ -198,3 +206,9 @@ PIPELINE_SASS_ARGUMENTS = '-r {proj_dir}/static/sass/bourbon/lib/bourbon.rb'.for
|
||||
MITX_FEATURES['ENABLE_PEARSON_HACK_TEST'] = True
|
||||
PEARSON_TEST_USER = "pearsontest"
|
||||
PEARSON_TEST_PASSWORD = "12345"
|
||||
|
||||
#AWS upload stuff for local file testing
|
||||
AWS_ACCESS_KEY_ID = "***REMOVED***"
|
||||
AWS_SECRET_ACCESS_KEY = "***REMOVED***"
|
||||
AWS_STORAGE_BUCKET_NAME = 'edxuploads'
|
||||
|
||||
|
||||
17
lms/templates/peer_grading/peer_grading_notifications.html
Normal file
17
lms/templates/peer_grading/peer_grading_notifications.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<%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>
|
||||
|
||||
${peer_grading_html|n}
|
||||
@@ -300,6 +300,8 @@ if settings.COURSEWARE_ENABLED:
|
||||
|
||||
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_ajax$',
|
||||
'open_ended_grading.views.peer_grading_ajax', name='peer_grading_ajax'),
|
||||
)
|
||||
|
||||
# discussion forums live within courseware, so courseware must be enabled first
|
||||
|
||||
Reference in New Issue
Block a user