link SogeCredit to WEI by creation date instead of civil year

This commit is contained in:
Théo Le Moigne 2023-01-10 21:40:03 +01:00
parent 0a853fd3e6
commit c441a43a8b
No known key found for this signature in database
GPG Key ID: D46D7E3364433208
1 changed files with 2 additions and 2 deletions

View File

@ -310,8 +310,8 @@ class SogeCredit(models.Model):
amount = sum(transaction.total for transaction in self.transactions.all())
if 'wei' in settings.INSTALLED_APPS:
from wei.models import WEIMembership
if not WEIMembership.objects.filter(club__weiclub__year=datetime.date.today().year, user=self.user)\
.exists():
if not WEIMembership.objects\
.filter(club__weiclub__year=self.credit_transaction.created_at.year, user=self.user).exists():
# 80 € for people that don't go to WEI
amount += 8000
return amount