2024-05-28 17:47:08 +03:00
|
|
|
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)
|
2024-06-01 19:45:47 +03:00
|
|
|
|
|
|
|
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)
|