Commit 26541bb7 by Lyla Fischer

fixed naming convention on response types

parent 05d96b79
...@@ -15,18 +15,18 @@ from mako.template import Template ...@@ -15,18 +15,18 @@ from mako.template import Template
from util import contextualize_text from util import contextualize_text
import inputtypes import inputtypes
from responsetypes import numericalresponse, formularesponse, customresponse, schematicresponse, multiplechoiceresponse, StudentInputError from responsetypes import NumericalResponse, FormulaResponse, CustomResponse, SchematicResponse, MultipleChoiceResponse, StudentInputError
import calc import calc
import eia import eia
log = logging.getLogger("mitx.courseware") log = logging.getLogger("mitx.courseware")
response_types = {'numericalresponse':numericalresponse, response_types = {'numericalresponse':NumericalResponse,
'formularesponse':formularesponse, 'formularesponse':FormulaResponse,
'customresponse':customresponse, 'customresponse':CustomResponse,
'schematicresponse':schematicresponse, 'schematicresponse':SchematicResponse,
'multiplechoiceresponse':multiplechoiceresponse} 'multiplechoiceresponse':MultipleChoiceResponse}
entry_types = ['textline', 'schematic', 'choicegroup'] entry_types = ['textline', 'schematic', 'choicegroup']
response_properties = ["responseparam", "answer"] response_properties = ["responseparam", "answer"]
# How to convert from original XML to HTML # How to convert from original XML to HTML
......
...@@ -38,7 +38,7 @@ def compare_with_tolerance(v1, v2, tol): ...@@ -38,7 +38,7 @@ def compare_with_tolerance(v1, v2, tol):
#Every response type needs methods "grade" and "get_answers" #Every response type needs methods "grade" and "get_answers"
class multiplechoiceresponse(object): class MultipleChoiceResponse(object):
def __init__(self, xml, context): def __init__(self, xml, context):
self.xml = xml self.xml = xml
self.correct_choices = xml.xpath('//*[@id=$id]//choice[@correct="true"]', self.correct_choices = xml.xpath('//*[@id=$id]//choice[@correct="true"]',
...@@ -62,7 +62,7 @@ class multiplechoiceresponse(object): ...@@ -62,7 +62,7 @@ class multiplechoiceresponse(object):
def get_answers(self): def get_answers(self):
return {self.answer_id:self.correct_choices} return {self.answer_id:self.correct_choices}
class numericalresponse(object): class NumericalResponse(object):
def __init__(self, xml, context): def __init__(self, xml, context):
self.xml = xml self.xml = xml
self.correct_answer = contextualize_text(xml.get('answer'), context) self.correct_answer = contextualize_text(xml.get('answer'), context)
...@@ -91,7 +91,7 @@ class numericalresponse(object): ...@@ -91,7 +91,7 @@ class numericalresponse(object):
def get_answers(self): def get_answers(self):
return {self.answer_id:self.correct_answer} return {self.answer_id:self.correct_answer}
class customresponse(object): class CustomResponse(object):
def __init__(self, xml, context): def __init__(self, xml, context):
self.xml = xml self.xml = xml
## CRITICAL TODO: Should cover all entrytypes ## CRITICAL TODO: Should cover all entrytypes
...@@ -122,7 +122,7 @@ class customresponse(object): ...@@ -122,7 +122,7 @@ class customresponse(object):
class StudentInputError(Exception): class StudentInputError(Exception):
pass pass
class formularesponse(object): class FormulaResponse(object):
def __init__(self, xml, context): def __init__(self, xml, context):
self.xml = xml self.xml = xml
self.correct_answer = contextualize_text(xml.get('answer'), context) self.correct_answer = contextualize_text(xml.get('answer'), context)
...@@ -192,7 +192,7 @@ class formularesponse(object): ...@@ -192,7 +192,7 @@ class formularesponse(object):
def get_answers(self): def get_answers(self):
return {self.answer_id:self.correct_answer} return {self.answer_id:self.correct_answer}
class schematicresponse(object): class SchematicResponse(object):
def __init__(self, xml, context): def __init__(self, xml, context):
self.xml = xml self.xml = xml
self.answer_ids = xml.xpath('//*[@id=$id]//schematic/@id', self.answer_ids = xml.xpath('//*[@id=$id]//schematic/@id',
......
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