Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
themrphantom committed Oct 30, 2024
1 parent 6ab16c0 commit 6f7544b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 4 additions & 1 deletion backend/database/Queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def do_checkout(self, checkouts):

self.session.commit()

def get_checkout_mail(self):
def get_checkout_mail(self,memberIDs):
members: list[Member] = self.session.query(Member).all()
checkouts = self.get_checkouts()
if len(checkouts) > 2:
Expand All @@ -292,6 +292,9 @@ def get_checkout_mail(self):
"{price,income,paid,name}"
member_dict = {}
for m in members:
if m.id not in memberIDs:
continue

transactions: list[Transaction] = self.session.query(Transaction).filter(
Transaction.date > last_date, Transaction.member_id == m.id).all()
temp_dict = {}
Expand Down
9 changes: 4 additions & 5 deletions backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,13 +611,12 @@ def put(self):
Create a checkout
"""
db.do_checkout(request.json)
mail_infos = db.get_checkout_mail()
memberids = [m["memberID"] for m in request.json['members']]
mail_infos = db.get_checkout_mail(memberids)

if util.mail_server is not None:
memberids = [m["memberID"] for m in request.json['members']]
mail.send_checkout_mails(mail_infos)

filtered_mail_infos = [x for x in mail_infos if x['id'] in memberids]

mail.send_checkout_mails(filtered_mail_infos)
return util.build_response("")

@admin
Expand Down

0 comments on commit 6f7544b

Please sign in to comment.