Skip to content

Commit

Permalink
debugging and improving signals
Browse files Browse the repository at this point in the history
  • Loading branch information
helrond committed Aug 27, 2019
1 parent 6901694 commit e8a926e
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions aurora/bag_transfer/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ def set_is_staff(sender, instance, **kwargs):
instance.save()


def update_dashboard_data(sender, instance, **kwargs):
@receiver(post_save, sender=Archives)
@receiver(post_delete, sender=Archives)
def dashboard_data(sender, instance, **kwargs):
today = date.today()
current = today - relativedelta(years=1)
if instance.process_status >= sender.TRANSFER_COMPLETED:
Expand Down Expand Up @@ -59,13 +61,3 @@ def update_dashboard_data(sender, instance, **kwargs):
)[0]
data.count = Archives.objects.filter(organization=organization, metadata__record_type=label).count()
data.save()


@receiver(post_save, sender=Archives)
def dashboard_data(sender, instance, **kwargs):
update_dashboard_data(sender, instance, **kwargs)


@receiver(post_delete, sender=Archives)
def dashboard_data(sender, instance, **kwargs):
update_dashboard_data(sender, instance, **kwargs)

0 comments on commit e8a926e

Please sign in to comment.