Coverage for apps/rewards/signals.py: 75%
8 statements
« prev ^ index » next coverage.py v6.4.4, created at 2023-09-08 12:47 -0600
« prev ^ index » next coverage.py v6.4.4, created at 2023-09-08 12:47 -0600
1from django.db.models import signals
2from django.dispatch import receiver
4from apps.accounting.models import Accounting
6from .models import RewardClaim
9@receiver(signals.post_save, sender=RewardClaim)
10def update_balance_on_fan_reward_save(sender, instance, **kwargs):
11 account, _ = Accounting.objects.get_or_create(fan=instance.fan, organization=instance.reward.organization)
12 account.save()