This commit is contained in:
Alexandre Avenel 2016-10-14 00:45:40 +00:00 committed by GitHub
commit d27b7b2aaa

View file

@ -35,10 +35,11 @@ class Project(db.Model):
for time in (1, 2, 3)) for time in (1, 2, 3))
# for each person # for each person
bills_in_project = self.get_bills()
for person in self.members: for person in self.members:
# get the list of bills he has to pay # get the list of bills he has to pay
bills = Bill.query.filter(Bill.owers.contains(person)) bills = bills_in_project.filter(Bill.owers.contains(person)).all()
for bill in bills.all(): for bill in bills:
if person != bill.payer: if person != bill.payer:
share = bill.pay_each() * person.weight share = bill.pay_each() * person.weight
should_pay[person] += share should_pay[person] += share