def add_open_question_command(dbservice: DBService): content = input("Question content: ") question = { constants['CONTENT_KEY']: content, constants['TYPE_KEY']: constants['OPEN_QUESTION_KEY'] } dbservice.insert(question)
def add_closed_question_command(dbservice: DBService): content = input("Question content: ") num_of_answers = int(input("Number of answers: ")) answers = [] for i in range(0, num_of_answers): answer = input("answer: ") answers.append(answer) question = { constants['CONTENT_KEY']: content, constants['TYPE_KEY']: constants['CLOSED_QUESTION_KEY'], constants['ANSWERS_KET']: answers } dbservice.insert(question)