test-platform/server/cgi/response_option_list.py

16 lines
503 B
Python
Raw Normal View History

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)