示例#1
0
def getDescription(project):
	mdb = MongoPersistence('interface')
	tokens = project.split('-')
	pType, pId, year, subject = tokens[0], tokens[1], tokens[2], '-'.join(tokens[3:])
	description = mdb.getDescription(pType, pId, year, subject)
	mdb.close()

	return description
示例#2
0
def getDetails(project, position):
	mdb = MongoPersistence('details')
	tokens = project.split('-')
	pType, pId, year, subject = tokens[0], tokens[1], tokens[2], '-'.join(tokens[3:])
	projectDetails = mdb.getProjectDetails(pType, pId, year, subject, position)
	mdb.close()

	return projectDetails
示例#3
0
def getDescription(project):
    mdb = MongoPersistence('interface')
    tokens = project.split('-')
    pType, pId, year, subject = tokens[0], tokens[1], tokens[2], '-'.join(
        tokens[3:])
    description = mdb.getDescription(pType, pId, year, subject)
    mdb.close()

    return description
示例#4
0
def getDetails(project, position):
    mdb = MongoPersistence('details')
    tokens = project.split('-')
    pType, pId, year, subject = tokens[0], tokens[1], tokens[2], '-'.join(
        tokens[3:])
    projectDetails = mdb.getProjectDetails(pType, pId, year, subject, position)
    mdb.close()

    return projectDetails
示例#5
0
def getResults(validUserVotes):
	mdb = MongoPersistence('results')
	allResults = dict()

	for project, position in validUserVotes.iteritems():
		tokens = project.split('-')
		pType = tokens[0]
		pId = tokens[1]
		year = tokens[2]
		subject = '-'.join(tokens[3:])

		allResults[project] = mdb.getResult(pType, pId, year, subject, position)

	mdb.close()
	return allResults
示例#6
0
def getResults(validUserVotes):
    mdb = MongoPersistence('results')
    allResults = dict()

    for project, position in validUserVotes.iteritems():
        tokens = project.split('-')
        pType = tokens[0]
        pId = tokens[1]
        year = tokens[2]
        subject = '-'.join(tokens[3:])

        allResults[project] = mdb.getResult(pType, pId, year, subject,
                                            position)

    mdb.close()
    return allResults
示例#7
0
def viewHome():
    mdb = MongoPersistence('interface')
    interfaceItems = mdb.getInterface()
    mdb.close()

    return render_template('home.html', items=interfaceItems)
示例#8
0
    message = ('<b>Список команд</b>\n\n'
               '/start - Основная информация\n'
               '/help - Список команд\n'
               '/settings - Настройки рассылки\n'
               '/test - Тест на знание слов')

    context.bot.send_message(chat_id, message, parse_mode='HTML')


if __name__ == '__main__':
    env = Env()
    env.read_env()
    token = env.str('TOKEN')

    persistence = MongoPersistence(store_user_data=False, store_bot_data=False)
    updater = Updater(token, persistence=persistence, use_context=True)
    dispatcher = updater.dispatcher
    persistence.job_queue = updater.job_queue
    start_saved_jobs(updater)

    test_conv_handler = ConversationHandler(
        entry_points=[CommandHandler('test', handle_test)],
        states={
            SET_NUMBER: [CommandHandler('stop', handle_stop_test), MessageHandler(Filters.text, set_number_test)],
            ANSWERING: [CommandHandler('stop', handle_stop_test), MessageHandler(Filters.text, answer_test)],
            ConversationHandler.TIMEOUT: [MessageHandler(Filters.all, handle_stop_test)]
        },
        fallbacks=[CommandHandler('stop', handle_stop_test)],
        conversation_timeout=10 * 60
    )
示例#9
0
def viewHome():
	mdb = MongoPersistence('interface')
	interfaceItems = mdb.getInterface()
	mdb.close()

	return render_template('home.html', items=interfaceItems)