23 lines
752 B
Python
23 lines
752 B
Python
from db.response_option import ResponseOptionPool
|
|
|
|
class ResponseOptionList:
|
|
def __init__(self, cursor):
|
|
self.cursor = cursor
|
|
|
|
def render(self, question_id = None):
|
|
rop = ResponseOptionPool(self.cursor)
|
|
|
|
if question_id:
|
|
rendered_response_options = [i.render_full() for i in rop.select_by_question_id(question_id)]
|
|
else:
|
|
rendered_response_options = [i.render_full() for i in rop.iter()]
|
|
|
|
return "\n".join(rendered_response_options)
|
|
|
|
def count(self, correct = False):
|
|
rop = ResponseOptionPool(self.cursor)
|
|
if correct:
|
|
return len([i for i in rop.object_pool.pool if i.get_correctness()])
|
|
else:
|
|
return len(rop.object_pool.pool)
|