def get_problem_id_for_check(bot, update):
    if utility.get_permit_for_check(update.message.chat_id):
        update.message.reply_text(
            text_constants.need_check_prob_r,
            reply_markup=keyboard_markups.get_problems_markup())
        return GETTING_CHECK_PROB
    else:
        update.message.reply_text(text_constants.authorization_failed,
                                  rely_markup=keyboard_markups.get_base_markup(
                                      update.message.chat_id))
        return BASE
def get_problem_id_for_send(bot, update):
    if utility.is_now_contest():
        update.message.reply_text(
            text_constants.need_send_prob_r,
            reply_markup=keyboard_markups.get_problems_markup())
        return GETTING_SEND_PROB
    else:
        update.message.reply_text(text_constants.no_contest_r,
                                  rely_markup=keyboard_markups.get_base_markup(
                                      update.message.chat_id))
        return BASE
示例#3
0
def send_mark(contest_id, update):
    author = update.message.chat_id
    with open("marks.json") as marks_file:
        all_marks = json.load(marks_file)
    marks = all_marks[contest_id][str(author)]
    result = ""
    for mark_raw in list(list(marks.items())):
        mark_with_author = mark_raw[1]
        mark = []
        for item in mark_with_author:
            mark.append(str(item[0]))
        if len(mark_with_author) == 0:
            result += "Задача {0}: Нет оценок\n".format(mark_raw[0])
        else:
            result += "Задача {0}: {1}\n".format(mark_raw[0], ', '.join(mark))
    update.message.reply_text(result,
                              reply_markup=keyboard_markups.get_base_markup(
                                  update.message.chat_id))
def error_start(bot, update):
    update.message.reply_text(text_constants.error_start_r,
                              reply_markup=keyboard_markups.get_base_markup(
                                  update.message.chat_id))
    return BASE
def return_to_base(bot, update):
    update.message.reply_text(text_constants.back_r,
                              reply_markup=keyboard_markups.get_base_markup(
                                  update.message.chat_id))
    return BASE