Beispiel #1
0
def searchEvent(searchString):
    found = Persister.searchEvent(searchString)
    result = []
    for eventName in found:
        event = found[eventName]
        leader = Persister.getLeader(event['leader'])
        photo = Persister.getProfilePhoto(event['leader'])
        bio = Persister.getDescription(event['leader'])
        createDate = event['created']
        created = createDate.strftime('%m/%d/%Y')
        begin = event['begin']
        beginDay = begin.strftime('%d')
        beginMonth = begin.strftime('%b')
        beginTime = begin.strftime('%H:%M')
        leaderId = event['leader']
        end = event['end']
        endDay = end.strftime('%d')
        endMonth = end.strftime('%b')
        endTime = end.strftime('%H:%M')

        participantList = []
        participants = Persister.getAllParticepants(event['id'])
        if participants != 400:
            for participant in participants:
                person = Persister.getPerson(participant.person_id)
                name = person.firstname + " " + person.lastname
                participantInfo = {
                    "id": person.id,
                    "name": name,
                    "points": person.points
                }
                participantList.append(participantInfo)
        result.append({
            "id": event['id'],
            "name": event['name'],
            "begin": beginDay,
            "beginMonth": months[beginMonth],
            "beginTime": beginTime,
            "beginFull": begin,
            "end": endDay,
            "endMonth": months[endMonth],
            "endTime": endTime,
            "endFull": end,
            "location": event['location'],
            "desc": event['desc'],
            "leader": leader,
            "cancel": event['cancel'],
            "img": event['img'],
            "qrCode": event['qr_code'],
            "created": created,
            "leaderDesc": bio,
            "leaderId": leaderId,
            "link": event['link'],
            "photo": photo,
            "subscribed": None,
            "participants": participantList
        })

    return result
Beispiel #2
0
def getAllEvents():
    events = Persister.getAllEvents()
    result = []
    if events != 400:
        for event in events:
            leader = Persister.getLeader(event.leader)
            if (leader == None):
                leader = ""
            photo = Persister.getProfilePhoto(event.leader)
            bio = Persister.getDescription(event.leader)
            createDate = event.created
            created = createDate.strftime('%m/%d/%Y')

            begin = event.begin
            beginDay = begin.strftime('%d')
            beginMonth = begin.strftime('%b')
            beginTime = begin.strftime('%H:%M')

            end = event.end
            endDay = end.strftime('%d')
            endMonth = end.strftime('%b')
            endTime = end.strftime('%H:%M')

            participantList = []
            participants = Persister.getAllParticepants(event.id)
            if participants != 400:
                for participant in participants:
                    person = Persister.getPerson(participant.person_id)
                    name = person.firstname + " " + person.lastname
                    participantInfo = {
                        "id": person.id,
                        "name": name,
                        "points": person.points
                    }
                    participantList.append(participantInfo)
            result.append({
                "id": event.id,
                "name": event.name,
                "begin": beginDay,
                "beginMonth": months[beginMonth],
                "beginTime": beginTime,
                "end": endDay,
                "endMonth": months[endMonth],
                "endTime": endTime,
                "location": event.location,
                "desc": event.desc,
                "leader": leader,
                "cancel": event.cancel,
                "img": event.img,
                "qrCode": event.qr_code,
                "created": created,
                "leaderDesc": bio,
                "link": event.link,
                "photo": photo,
                "subscribed": None,
                "participants": participantList
            })
    return result
Beispiel #3
0
def getParticipantInfo(eventId):
    event = Persister.getEventById(eventId)
    participantList = []
    participants = Persister.getAllParticepants(event.id)
    if participants != 400:
        for participant in participants:
            person = Persister.getPerson(participant.person_id)
            name = person.firstname + " " + person.lastname
            participantInfo = {
                "id": person.id,
                "name": name,
                "points": person.points
            }
            participantList.append(participantInfo)
    sortedList = sorted(participantList, key=itemgetter('name'))

    return sortedList
Beispiel #4
0
def getPerson(person_id):
    return Persister.getPerson(person_id)
Beispiel #5
0
def loginCheck(form):
    user = Persister.getPerson(form.get('id'))
    return user.authenticated
Beispiel #6
0
def logoutUser(form):
    user = Persister.getPerson(form.get('id'))
    if Persister.logoutUser(user):
        return {"responseCode": 200, "boolean": True}
    return {"responseCode": 500, "boolean": False}
Beispiel #7
0
def logoutUser(form):
    user = Persister.getPerson(form.get('id'))
    return Persister.logoutUser(user)