Ejemplo n.º 1
0
def getTimes(eventID):
    r = getRecurring(eventID)[0][0]
    if (r == 1):
        query = "select Recurring.timeSlot, Recurring.day, Event.eventGranularity, Event.eventName from Recurring natural join Event where eventID = %s"
        values = (eventID, )
    else:
        query = "select OneTime.timeSlot, oneTime.date, Event.eventGranularity, Event.eventName from OneTime natural join Event where eventID = %s"
        values = (eventID, )
    return sql.getQueryResults(query, values)
Ejemplo n.º 2
0
def finalizeEvent(eventID, timeSlot):
    query = "select userEmail from Responses where eventID = %s and timeSlot = %s"
    values = (eventID, timeSlot)
    results = sql.getQueryResults(query, values)
    for res in results:
        emailer.eventConfirm(res[0], timeSlot)
    query = "delete from Responses where eventID = %s and timeSlot !=%s"
    values = (eventID, timeSlot)
    sql.createQuery(query, values)
Ejemplo n.º 3
0
def confirmPass(email, guess):
    query = "select Pass from Users where userID = %s"
    values = (email, )
    target = sql.getQueryResults(query, values)[0][0]
    salt = binascii.unhexlify(target[:64])
    currentHash = genHash(guess, salt)
    currentTry = binascii.hexlify(salt).decode() + binascii.hexlify(
        currentHash).decode()
    try:
        routes.session['userID'] = email
    finally:
        return currentTry == target
Ejemplo n.º 4
0
def checkForReset(key, email):
    query = "select validator, date from passReset where userID = %s"
    values = (email, )
    result = sql.getQueryResults(query, values)
    validator = result[0]
    date = result[1]
    if (key == validator):
        if ((date - datetime.datetime.now()).getseconds() < 3600):
            return True
        else:
            return False
    else:
        return False
Ejemplo n.º 5
0
def getAllMatching(eventID):
    query = "select userName, timeSlot from Responses where eventID = %s"
    values = (eventID, )
    res = sql.getQueryResults(query, values)
    temp1 = []
    for r in res:
        temp1.append(r[1])
    temp1 = list(dict.fromkeys(temp1))
    final = []
    for t in temp1:
        count = 0
        for result in res:
            if result[1] == t:
                count += 1
        final.append((t, count))
    return final
Ejemplo n.º 6
0
def getLastName(userID):
    query = "select LName from Users where userID = %s"
    values = (userID, )
    return sql.getQueryResults(query, values)
Ejemplo n.º 7
0
def getUser(userID):
    query = "select FName, LName, userID from Users where userID = %s"
    values = (userID, )
    return sql.getQueryResults(query, values)
Ejemplo n.º 8
0
def attendeeAvailability(userEmail, eventID):
    query = "select userEmail, timeSlot from Responses where userEmail = %s and eventID = %s"
    values = (userEmail, eventID)
    return sql.getQueryResults(query, values)
Ejemplo n.º 9
0
def getAttendeeName(userEmail, eventID):
    query = "select userName from Responses where userEmail = %s and eventID = %s"
    values = (userEmail, eventID)
    return sql.getQueryResults(query, values)
Ejemplo n.º 10
0
def getAllEvents(userID):
    query = "select * from Event where eventCreator = %s"
    values = (userID, )
    return sql.getQueryResults(query, values)
Ejemplo n.º 11
0
def getAllDetails(eventID):
    query = "select * from Event where eventID = %s"
    values = (eventID, )
    return sql.getQueryResults(query, values)
Ejemplo n.º 12
0
def getEventID(eventCreator, eventName):  # TODO: formatting for datetime
    query = "select eventID, eventCreationTime from Event where eventName=%s and eventCreator=%s"
    values = (eventName, eventCreator)
    records = sql.getQueryResults(query, values)
    return records
Ejemplo n.º 13
0
def getOwner(eventID):
    query = "select eventCreator from Event where eventID=%s"
    values = (eventID, )
    records = sql.getQueryResults(query, values)
    return records
Ejemplo n.º 14
0
def getRecurring(eventID):
    query = "select eventRecurs from Event where eventID=%s"
    values = (eventID, )
    records = sql.getQueryResults(query, values)
    return records
Ejemplo n.º 15
0
def getDuration(eventID):
    query = "select eventDuration from Event where eventID=%s"
    values = (eventID, )
    records = sql.getQueryResults(query, values)
    return records
Ejemplo n.º 16
0
def getAllResponses(eventID):
    query = "select userName, timeSlot from Responses where eventID = %s"
    values = (eventID, )
    return sql.getQueryResults(query, values)