test-platform/server/cgi/question_list.py

16 lines
462 B
Python
Raw Normal View History

2024-05-28 17:47:08 +03:00
from db.question import QuestionPool
class QuestionList:
def __init__(self, cursor):
self.cursor = cursor
def render(self, test_id = None):
qp = QuestionPool(self.cursor)
if test_id:
2024-06-01 13:49:13 +03:00
rendered_questions = [i.render_short(self.cursor) for i in qp.select_by_test_id(test_id)]
2024-05-28 17:47:08 +03:00
else:
2024-06-01 13:49:13 +03:00
rendered_questions = [i.render_short(self.cursor) for i in qp.iter()]
2024-05-28 17:47:08 +03:00
return "\n".join(rendered_questions)