Пример #1
0
def gettopic(roundnum, indexnum, sessionid):
    outval = genfunc.queryfield(adminmodels.Sessions, "sessid",
                                int(sessionid))[0]
    print(outval)
    questions = eval("outval.topic_" + str(roundnum))
    maintopic = questions[0]
    stance = questions[int(indexnum)]
    return maintopic, stance
Пример #2
0
def updateroundnum(sessid):
    session = genfunc.queryfield(adminmodels.Sessions, "sessid",
                                 int(sessid))[0]
    if session.round_num > 3:
        return True, -1
    session.round_num += 1
    session.put()
    time.sleep(2)
    return False, session.round_num
Пример #3
0
def timedif(sessionid, timeallowed):
    session = genfunc.queryfield(adminmodels.Sessions, "sessid",
                                 int(sessionid))[0]
    timedelta = session.session_start - datetime.datetime.now()
    secdelta = timedelta.total_seconds() + timeallowed
    return round(secdelta / 60, 6)
Пример #4
0
def querytopic(topic_category="", fieldval=""):
    outval = genfunc.queryfield(contentmodels.Topics, topic_category,
                                str(fieldval))  #"" is user input category
    outputdict = {"topic": outval}
    return outputdict
Пример #5
0
def getroundnum(sessid):
    outval = genfunc.queryfield(adminmodels.Sessions, "sessid", int(sessid))[0]
    return outval.round_num
Пример #6
0
def querytopicrand(topic_category="", fieldval=""):
    outval = genfunc.queryfield(contentmodels.Topics, topic_category,
                                str(fieldval))
    random.shuffle(outval)
    outputdict = {"topic": outval}
    return outputdict