Browse Source

Added distinction between members that will attend, that will not attend, and will maybe attend an event

master
Dennis Potter 6 years ago
parent
commit
bdc2aef993
Signed by: d.potter GPG Key ID: 186A8AD440942BAF
1 changed files with 45 additions and 4 deletions
  1. +45
    -4
      event.py

+ 45
- 4
event.py View File

@ -18,7 +18,7 @@ class Event():
self.leaders = list()
self.number_of_guests = 0
sql = f"""SELECT mem_usr_id, mem_leader, mem_count_guests
sql = f"""SELECT mem_usr_id, mem_leader, mem_count_guests, mem_approved
FROM {self.admidio.prefix}_members
WHERE mem_rol_id = {self.rol_id}
AND mem_end = '9999-12-31'"""
@ -27,15 +27,56 @@ class Event():
for row in self.__c.fetchall():
try:
self.number_of_guests += row[2]
# Distinguish between members that will attend, not
# attend, or will maybe attend.
if row[1] == 1:
self.leaders.append(self.admidio.getMemberFromID(row[0]))
self.leaders.append(
[row[3], self.admidio.getMemberFromID(row[0])])
else:
self.participants.append(
self.admidio.getMemberFromID(row[0]))
[row[3], 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)
return self.leaders + self.participants
def getAllAttend(self):
"""Return leaders and members which actually attend"""
members = list()
for i in (self.leaders + self.participants):
if (i[0] == 2):
members.append(i)
return members
def getAllMaybe(self):
"""Return leaders and members which will maybe attend"""
members = list()
for i in (self.leaders + self.participants):
if (i[0] == 1):
members.append(i)
return members
def getAllNotAttend(self):
"""Return leaders and members which will not attend"""
members = list()
for i in (self.leaders + self.participants):
if (i[0] == 3):
members.append(i)
return members
def getNumberMembers(self):
"""Return the total number of members"""
return len(self.leaders) + len(self.participants)

Loading…
Cancel
Save