From ba1411b599117409326e3b7ab798ee5cb3898d70 Mon Sep 17 00:00:00 2001 From: Owocki Date: Mon, 14 Oct 2019 03:31:50 -0600 Subject: [PATCH] kudos transactions were duplicated --- app/dashboard/admin.py | 2 +- .../templates/profiles/scorecard_hunter.html | 2 +- app/kudos/models.py | 16 +++++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/dashboard/admin.py b/app/dashboard/admin.py index 67c9362950e..bd0433af427 100644 --- a/app/dashboard/admin.py +++ b/app/dashboard/admin.py @@ -57,7 +57,7 @@ class PortfolioItemAdmin(admin.ModelAdmin): class EarningAdmin(admin.ModelAdmin): ordering = ['-id'] list_display = ['created_on', '__str__'] - raw_id_fields = ['from_profile', 'to_profile'] + raw_id_fields = ['from_profile', 'to_profile', 'org_profile'] search_fields = ['from_profile__handle', 'to_profile__handle'] diff --git a/app/dashboard/templates/profiles/scorecard_hunter.html b/app/dashboard/templates/profiles/scorecard_hunter.html index 13262ac47d5..3a0c5cf3bcf 100644 --- a/app/dashboard/templates/profiles/scorecard_hunter.html +++ b/app/dashboard/templates/profiles/scorecard_hunter.html @@ -25,7 +25,7 @@
  • - {{ count_bounties_completed }} - Bounties Completed + Bounties completed
  • {% if no_times_been_removed %}
  • diff --git a/app/kudos/models.py b/app/kudos/models.py index 8a2c224c6cb..ddca5fef779 100644 --- a/app/kudos/models.py +++ b/app/kudos/models.py @@ -451,15 +451,17 @@ def psave_kt(sender, instance, **kwargs): from django.contrib.contenttypes.models import ContentType from dashboard.models import Earning Earning.objects.update_or_create( - created_on=instance.created_on, - from_profile=instance.sender_profile, - org_profile=instance.org_profile, - to_profile=instance.recipient_profile, - value_usd=instance.value_in_usdt_then, source_type=ContentType.objects.get(app_label='kudos', model='kudostransfer'), source_id=instance.pk, - url=instance.kudos_token_cloned_from.url, - network=instance.network, + defaults={ + "created_on":instance.created_on, + "from_profile":instance.sender_profile, + "org_profile":instance.org_profile, + "to_profile":instance.recipient_profile, + "value_usd":instance.value_in_usdt_then, + "url":instance.kudos_token_cloned_from.url, + "network":instance.network, + } )