Skip to content

Commit

Permalink
add network filter to dashboard (#4926)
Browse files Browse the repository at this point in the history
  • Loading branch information
octavioamu authored and danlipert committed Aug 1, 2019
1 parent d5c513a commit a7bdc9c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion app/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2954,7 +2954,12 @@ def serialize_funder_dashboard_submitted_rows(bounties):


def funder_dashboard(request, bounty_type):
"""JSON data for the user dashboard"""
"""JSON data for the funder dashboard"""

if not settings.DEBUG:
network = 'mainnet'
else:
network = 'rinkeby'

user = request.user if request.user.is_authenticated else None
if not user:
Expand All @@ -2968,6 +2973,7 @@ def funder_dashboard(request, bounty_type):
bounties = list(Bounty.objects.filter(
Q(idx_status='open') | Q(override_status='open'),
current_bounty=True,
network=network,
bounty_owner_github_username=profile.handle,
).order_by('-interested__created'))
interests = list(Interest.objects.filter(
Expand All @@ -2980,6 +2986,7 @@ def funder_dashboard(request, bounty_type):
bounties = Bounty.objects.prefetch_related('fulfillments').filter(
Q(idx_status='submitted') | Q(override_status='submitted'),
current_bounty=True,
network=network,
fulfillments__accepted=False,
bounty_owner_github_username=profile.handle,
).order_by('-fulfillments__created_on')
Expand All @@ -2989,6 +2996,7 @@ def funder_dashboard(request, bounty_type):
bounties = Bounty.objects.filter(
Q(idx_status='expired') | Q(override_status='expired'),
current_bounty=True,
network=network,
bounty_owner_github_username=profile.handle,
).order_by('-expires_date')

Expand All @@ -3009,7 +3017,15 @@ def funder_dashboard(request, bounty_type):


def contributor_dashboard(request, bounty_type):
"""JSON data for the contributor dashboard"""

if not settings.DEBUG:
network = 'mainnet'
else:
network = 'rinkeby'

user = request.user if request.user.is_authenticated else None

if not user:
return JsonResponse(
{'error': _('You must be authenticated via github to use this feature!')},
Expand All @@ -3034,6 +3050,7 @@ def contributor_dashboard(request, bounty_type):
interested__status='okay',
interested__pending=pending,
idx_status__in=status,
network=network,
current_bounty=True).order_by('-interested__created')

return JsonResponse([{'title': b.title,
Expand Down

0 comments on commit a7bdc9c

Please sign in to comment.