@@ 540-547 (lines=8) @@ | ||
537 | user.User.lifetime_fees = __lifetime_fees |
|
538 | ||
539 | # This is in a stupid place due to circular input problems |
|
540 | @property |
|
541 | def __lifetime_discounts(self): |
|
542 | return object_session(self).query(func.sum((Purchase.amount / (1-Purchase.discount)) - Purchase.amount).label("f"))\ |
|
543 | .join(event.Event)\ |
|
544 | .filter(Purchase.fr_account_virt_id == self.id)\ |
|
545 | .filter(Purchase.discount > 0)\ |
|
546 | .filter(event.Event.type == 'purchase')\ |
|
547 | .filter(event.Event.deleted==False).one().f or Decimal(0.0) |
|
548 | user.User.lifetime_discounts = __lifetime_discounts |
|
549 | ||
550 | # This is in a stupid place due to circular input problems |
|
@@ 529-536 (lines=8) @@ | ||
526 | user.User.days_since_last_purchase = __days_since_last_purchase |
|
527 | ||
528 | # This is in a stupid place due to circular input problems |
|
529 | @property |
|
530 | def __lifetime_fees(self): |
|
531 | return object_session(self).query(func.sum((Purchase.amount / (1-Purchase.discount)) - Purchase.amount).label("f"))\ |
|
532 | .join(event.Event)\ |
|
533 | .filter(Purchase.fr_account_virt_id == self.id)\ |
|
534 | .filter(Purchase.discount < 0)\ |
|
535 | .filter(event.Event.type == 'purchase')\ |
|
536 | .filter(event.Event.deleted==False).one().f or Decimal(0.0) |
|
537 | user.User.lifetime_fees = __lifetime_fees |
|
538 | ||
539 | # This is in a stupid place due to circular input problems |