Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 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
Ejemplo n.º 5
0
def getroundnum(sessid):
    outval = genfunc.queryfield(adminmodels.Sessions, "sessid", int(sessid))[0]
    return outval.round_num
Ejemplo n.º 6
0
def querytopicrand(topic_category="", fieldval=""):
    outval = genfunc.queryfield(contentmodels.Topics, topic_category,
                                str(fieldval))
    random.shuffle(outval)
    outputdict = {"topic": outval}
    return outputdict