The objective of this interface is the ability to get data from an Admidio installation and use them in python. Currently Users, groups and events are integrated
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

40 lines
1.4 KiB

from exceptions import MemberNotFoundException
class Event():
def __init__(self, db, event_id, rol_id, name, start_time, end_time,
description, location, country, admidio):
self.__c = db.cursor()
self.id = event_id
self.rol_id = rol_id
self.name = name
self.start_time = start_time
self.end_time = end_time
self.description = description
self.location = location
self.country = country
self.admidio = admidio
self.participants = list()
self.leaders = list()
self.number_of_guests = 0
sql = ("""SELECT mem_usr_id, mem_leader, mem_count_guests
FROM adm_members"""
f""" WHERE mem_rol_id = {self.rol_id}""")
self.__c.execute(sql)
for row in self.__c.fetchall():
try:
self.number_of_guests += row[2]
if row[1] == 1:
self.leaders.append(self.admidio.getMemberFromID(row[0]))
else:
self.participants.append(
self.admidio.getMemberFromID(row[0]))
except MemberNotFoundException:
print(
f"Member with id {row[0]} not found, group id: {self.id}")
def getAllMembers(self):
"""Return leaders and members in group, combined"""
return self.leaders.append(self.members)