Commit b784cb28 by Stephen Sanchez

Quick code review changes to clean up empty files and move functions

parent d580f825
from django.template import Context
from django.template.loader import get_template
from webob import Response
class AssessmentMixin(object):
def render(self, path, context_dict=None):
"""Render an Assessment Module's HTML
Given the name of an assessment module, find it in the list of
configured modules, and ask for its rendered HTML.
"""
if not context_dict: context_dict = {}
context_dict["xblock_trace"] = self.get_xblock_trace()
context_dict["rubric_instructions"] = self.rubric_instructions
context_dict["rubric_criteria"] = self.rubric_criteria
template = get_template(path)
context = Context(context_dict)
return Response(template.render(context), content_type='application/html', charset='UTF-8')
"""An XBlock where students can read a question and compose their response""" """An XBlock where students can read a question and compose their response"""
import datetime import datetime
import pkg_resources
from django.template.context import Context from django.template.context import Context
from django.template.loader import get_template from django.template.loader import get_template
import pkg_resources from webob import Response
from xblock.core import XBlock from xblock.core import XBlock
from xblock.fields import List, Scope, String from xblock.fields import List, Scope, String
...@@ -272,3 +273,22 @@ class OpenAssessmentBlock(XBlock, SubmissionMixin, PeerAssessmentMixin, SelfAsse ...@@ -272,3 +273,22 @@ class OpenAssessmentBlock(XBlock, SubmissionMixin, PeerAssessmentMixin, SelfAsse
"message": "You have not started this problem", "message": "You have not started this problem",
} }
return grade_state return grade_state
def render(self, path, context_dict=None):
"""Render an Assessment Module's HTML
Given the name of an assessment module, find it in the list of
configured modules, and ask for its rendered HTML.
"""
if not context_dict:
context_dict = {}
# TODO: these shouldn't overwrite
context_dict["xblock_trace"] = self.get_xblock_trace()
context_dict["rubric_instructions"] = self.rubric_instructions
context_dict["rubric_criteria"] = self.rubric_criteria
template = get_template(path)
context = Context(context_dict)
return Response(template.render(context), content_type='application/html', charset='UTF-8')
from xblock.core import XBlock from xblock.core import XBlock
from openassessment.peer import api as peer_api from openassessment.peer import api as peer_api
from openassessment.peer.api import PeerAssessmentWorkflowError from openassessment.peer.api import PeerAssessmentWorkflowError
from openassessment.xblock.assessment_mixin import AssessmentMixin
class PeerAssessmentMixin(AssessmentMixin): class PeerAssessmentMixin(object):
@XBlock.json_handler @XBlock.json_handler
def assess(self, data, suffix=''): def assess(self, data, suffix=''):
...@@ -25,6 +24,7 @@ class PeerAssessmentMixin(AssessmentMixin): ...@@ -25,6 +24,7 @@ class PeerAssessmentMixin(AssessmentMixin):
assessment_dict assessment_dict
) )
# Temp kludge until we fix JSON serialization for datetime # Temp kludge until we fix JSON serialization for datetime
assessment["scored_at"] = str(assessment["scored_at"]) assessment["scored_at"] = str(assessment["scored_at"])
...@@ -37,9 +37,7 @@ class PeerAssessmentMixin(AssessmentMixin): ...@@ -37,9 +37,7 @@ class PeerAssessmentMixin(AssessmentMixin):
self.get_student_item_dict(), self.get_student_item_dict(),
assessment assessment
)} )}
return super(PeerAssessmentMixin, self).render( return self.render('static/html/oa_peer_assessment.html', context_dict)
'static/html/oa_peer_assessment.html',
context_dict)
def get_peer_submission(self, student_item_dict, assessment): def get_peer_submission(self, student_item_dict, assessment):
peer_submission = False peer_submission = False
...@@ -63,4 +61,4 @@ class PeerAssessmentMixin(AssessmentMixin): ...@@ -63,4 +61,4 @@ class PeerAssessmentMixin(AssessmentMixin):
""" """
for assessment in self.rubric_assessments: for assessment in self.rubric_assessments:
if assessment.name == mixin_name: if assessment.name == mixin_name:
return assessment return assessment
\ No newline at end of file
from xblock.core import XBlock from xblock.core import XBlock
from openassessment.xblock.assessment_mixin import AssessmentMixin
class SelfAssessmentMixin(AssessmentMixin): class SelfAssessmentMixin(object):
@XBlock.handler @XBlock.handler
def render_self_assessment(self, data, suffix=''): def render_self_assessment(self, data, suffix=''):
......
...@@ -40,4 +40,4 @@ class SubmissionMixin(AssessmentMixin): ...@@ -40,4 +40,4 @@ class SubmissionMixin(AssessmentMixin):
@XBlock.handler @XBlock.handler
def render_submission(self, data, suffix=''): def render_submission(self, data, suffix=''):
return super(SubmissionMixin, self).render('static/html/oa_response.html') return self.render('static/html/oa_response.html')
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