Skip to content

Commit

Permalink
adds in latest activity again
Browse files Browse the repository at this point in the history
  • Loading branch information
owocki committed May 31, 2019
1 parent 9d97d1c commit 2e71b7f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
9 changes: 9 additions & 0 deletions app/dashboard/templates/shared/bounty-popover.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,13 @@
[[if expired !== ""]]<i class="far fa-clock expired-icon"></i>[[/if]][[:expired]]
</div>
</div>
[[if latest_activity]]
<div class="popover-bounty__footer">
<span class="title">{% trans "Latest Activity" %}</span>
<div class="d-flex justify-content-between">
<span>[[activitytext:latest_activity.activity_type]] {% trans "by" %} <b>[[:latest_activity.profile.handle]]</b></span>
<span>[[timedifference:latest_activity.created]]</span>
</div>
</div>
[[/if]]
</div>

0 comments on commit 2e71b7f

Please sign in to comment.