From 2e71b7f8a805f92cab813954c7f4f8c0bbfe3559 Mon Sep 17 00:00:00 2001 From: Owocki Date: Fri, 31 May 2019 13:41:52 -0600 Subject: [PATCH] adds in latest activity again --- app/dashboard/models.py | 8 ++++++++ app/dashboard/router.py | 2 +- app/dashboard/templates/shared/bounty-popover.html | 9 +++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/dashboard/models.py b/app/dashboard/models.py index c1466e9927e..f83465d9eb3 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -328,6 +328,14 @@ def save(self, *args, **kwargs): self.github_url = clean_bounty_url(self.github_url) super().save(*args, **kwargs) + @property + def latest_activity(self): + activity = Activity.objects.filter(bounty=self.pk).order_by('-pk') + if activity.exists(): + from dashboard.router import ActivitySerializer + return ActivitySerializer(activity.first()).data + return None + @property def profile_pairs(self): profile_handles = [] diff --git a/app/dashboard/router.py b/app/dashboard/router.py index 48728d660ba..0fb78603a5c 100644 --- a/app/dashboard/router.py +++ b/app/dashboard/router.py @@ -186,7 +186,7 @@ class Meta: 'url', 'title', 'experience_level', 'status', 'fulfillment_accepted_on', 'fulfillment_started_on', 'fulfillment_submitted_on', 'canceled_on', 'web3_created', 'bounty_owner_address', 'avatar_url', 'network', 'standard_bounties_id', 'github_org_name', 'interested', 'token_name', 'value_in_usdt', - 'keywords', 'value_in_token', 'project_type', 'is_open', 'expires_date' + 'keywords', 'value_in_token', 'project_type', 'is_open', 'expires_date', 'latest_activity' ) class BountyViewSet(viewsets.ModelViewSet): diff --git a/app/dashboard/templates/shared/bounty-popover.html b/app/dashboard/templates/shared/bounty-popover.html index 3f857b1ea39..7ea1365f5b2 100644 --- a/app/dashboard/templates/shared/bounty-popover.html +++ b/app/dashboard/templates/shared/bounty-popover.html @@ -48,4 +48,13 @@ [[if expired !== ""]][[/if]][[:expired]] + [[if latest_activity]] + + [[/if]]