Skip to content

Commit

Permalink
Merge branch 'master' into homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
thelostone-mc authored Feb 5, 2019
2 parents 2aab12d + 17571ff commit 7b6dbbc
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 26 deletions.
2 changes: 1 addition & 1 deletion app/dashboard/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def claim(self, instance):

# Register your models here.
class BountyAdmin(admin.ModelAdmin):
raw_id_fields = ['interested', 'bounty_owner_profile']
raw_id_fields = ['interested', 'bounty_owner_profile', 'bounty_reserved_for_user']
ordering = ['-id']

search_fields = ['raw_data', 'title', 'bounty_owner_github_username', 'token_name']
Expand Down
1 change: 1 addition & 0 deletions app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ class Bounty(SuperModel):
FUNDED_STATUSES = ['open', 'started', 'submitted', 'done']
OPEN_STATUSES = ['open', 'started', 'submitted']
CLOSED_STATUSES = ['expired', 'unknown', 'cancelled', 'done']
WORK_IN_PROGRESS_STATUSES = ['open', 'started', 'submitted']
TERMINAL_STATUSES = ['done', 'expired', 'cancelled']

web3_type = models.CharField(max_length=50, default='bounties_network')
Expand Down
12 changes: 8 additions & 4 deletions app/dashboard/templates/profiles/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,25 +213,29 @@
</div>
{% endif %}

{% if activity_tabs %}
{% if tabs %}
<div class="row pt-4 py-2">
<div class="container profile-bounties profile-bounties--activities">
<div class="row">
<div class="col-12 px-4 px-lg-0">
<span class="font-caption profile-bounties__sort_label">{% trans 'By Created Date' %}</span>
</div>
<div id="activity-tabs" class="tab-container mt-4 font-body">
{% for tab in activity_tabs %}
{% for tab in tabs %}
<button type="button" id="{{ tab.id }}" class="section-tab">{{ tab.name }} ({{ tab.count }})</button>
{% endfor %}
</div>
<div id="activity-tabs-sections" class="tab-sections section">
{% for tab in activity_tabs %}
{% for tab in tabs %}
<div id="section-{{ tab.id }}" class="tab-section">
<div class="container">
<div class="row mb-3 p-2">
<div id="{{ tab.id }}" class="col-12 activities" count="{{ tab.count }}">
{% include 'profiles/profile_activities.html' with activities=tab.activities %}
{% if tab.type == 'activity' %}
{% include 'profiles/profile_activities.html' with activities=tab.objects %}
{% else %}
{% include 'profiles/profile_bounties.html' with bounties=tab.objects %}
{% endif %}
</div>
</div>
</div>
Expand Down
52 changes: 52 additions & 0 deletions app/dashboard/templates/profiles/profile_bounties.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{% for bounty in bounties %}
<a class="row result bounty_row {{ bounty.network }}" target="_blank"
{% if bounty.url %} href="{{ bounty.url }}"
{% elif bounty.github_url %} href="{{ bounty.github_url }}"
{% endif %}>
<div class="avatar-container col-1 justify-content-center special_tag hide_min_viewport">
{% if bounty.funding_organisation %}
<img class="avatar" src="{% url 'org_avatar' bounty.funding_organisation %}">
{% else %}
<img class="avatar" src="{% url 'org_avatar' bounty.bounty_owner_github_username %}">
{% endif %}
</div>
<div class="col-12 col-md-7 d-flex flex-column">
<div class="bounty-detail">
<div class="title font-subheader">
{{ bounty.title }}
</div>

<div class="bounty-summary col-12">
<div class="info font-caption">
{% if bounty.experience_level %}
{{ bounty.experience_level }} &bull;
{% endif %}
</div>
</div>
</div>
</div>
<div class="col-12 col-md-4 tags fixed font-caption align-items-center">
{% if bounty.network != 'mainnet' %}
<div class="tag network_warning">
<p>
<span>{{ bounty.network }}</span>
</p>
</div>
{% endif %}
<div class="tag token">
<p>
{{ bounty.value_true }}
<span>{{ bounty.token_name }}</span>
</p>
</div>
{% if bounty.value_in_usdt_now %}
<div class="tag usd">
<p>
{{ bounty.value_in_usdt_now }}
<span>USD</span>
</p>
</div>
{% endif %}
</div>
</a>
{% endfor %}
40 changes: 27 additions & 13 deletions app/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@

from .helpers import get_bounty_data_for_activity, handle_bounty_views
from .models import (
Activity, Bounty, CoinRedemption, CoinRedemptionRequest, Interest, LabsResearch, Profile, ProfileSerializer,
Subscription, Tool, ToolVote, UserAction,
Activity, Bounty, BountyFulfillment, CoinRedemption, CoinRedemptionRequest, Interest, LabsResearch, Profile,
ProfileSerializer, Subscription, Tool, ToolVote, UserAction,
)
from .notifications import (
maybe_market_tip_to_email, maybe_market_tip_to_github, maybe_market_tip_to_slack, maybe_market_to_email,
Expand Down Expand Up @@ -1199,7 +1199,7 @@ def profile(request, handle):
handle = handle[:-1]
profile = profile_helper(handle, current_user=request.user)

tabs = [
activity_tabs = [
('all', _('All Activity')),
('new_bounty', _('Bounties Funded')),
('start_work', _('Work Started')),
Expand All @@ -1226,9 +1226,9 @@ def profile(request, handle):

context = profile.to_dict(tips=False)
all_activities = context.get('activities')
activity_tabs = []
tabs = []

for tab, name in tabs:
for tab, name in activity_tabs:
activities = profile_filter_activities(all_activities, tab)
activities_count = activities.count()

Expand All @@ -1237,15 +1237,15 @@ def profile(request, handle):

paginator = Paginator(activities, 10)

obj = {}
obj['id'] = tab
obj['name'] = name
obj['activities'] = paginator.get_page(1)
obj['count'] = activities_count
obj = {'id': tab,
'name': name,
'objects': paginator.get_page(1),
'count': activities_count,
'type': 'activity'
}
tabs.append(obj)

activity_tabs.append(obj)

context['activity_tabs'] = activity_tabs
context['tabs'] = tabs

except (Http404, ProfileHiddenException, ProfileNotFoundException):
status = 404
Expand All @@ -1271,6 +1271,20 @@ def profile(request, handle):
context['kudos_count'] = owned_kudos.count()
context['sent_kudos_count'] = sent_kudos.count()

currently_working_bounties = Bounty.objects.current().filter(interested__profile=profile).filter(interested__status='okay') \
.filter(interested__pending=False).filter(idx_status__in=Bounty.WORK_IN_PROGRESS_STATUSES)
currently_working_bounties_count = currently_working_bounties.count()
if currently_working_bounties_count > 0:
obj = {'id': 'currently_working',
'name': _('Currently Working'),
'objects': Paginator(currently_working_bounties, 10).get_page(1),
'count': currently_working_bounties_count,
'type': 'bounty'
}
if 'tabs' not in context:
context['tabs'] = []
context['tabs'].append(obj)

if request.method == 'POST' and request.is_ajax():
# Update profile address data when new preferred address is sent
validated = request.user.is_authenticated and request.user.username.lower() == profile.handle.lower()
Expand Down
1 change: 1 addition & 0 deletions app/grants/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class GrantAdmin(GeneralAdmin):
'network', 'amount_goal', 'amount_received', 'team_member_list',
'subscriptions_links', 'contributions_links', 'link',
]
raw_id_fields = ['admin_profile']

# Custom Avatars
def logo_svg_asset(self, instance):
Expand Down
5 changes: 4 additions & 1 deletion app/grants/management/commands/subminer.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,7 @@ def handle(self, *args, **options):
logger.info(" - %d has %d subs ready for execution", grant.pk, subs.count())

for subscription in subs:
process_subscription(subscription, live)
try:
process_subscription(subscription, live)
except Exception as e:
logger.exception(e)
4 changes: 2 additions & 2 deletions app/grants/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def __str__(self):

def percentage_done(self):
"""Return the percentage of token received based on the token goal."""
return ((self.monthly_amount_subscribed / self.amount_goal) * 100)
return ((self.amount_received / self.amount_goal) * 100)

@property
def abi(self):
Expand All @@ -216,7 +216,7 @@ def contract(self):
"""Return grants contract."""
from dashboard.utils import get_web3
web3 = get_web3(self.network)
grant_contract = web3.eth.contract(self.contract_address, abi=self.abi)
grant_contract = web3.eth.contract(Web3.toChecksumAddress(self.contract_address), abi=self.abi)
return grant_contract


Expand Down
4 changes: 2 additions & 2 deletions app/grants/templates/grants/card/front.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ <h2 class="grant-item__title font-subheader"><a href="{% url 'grants:details' gr
</div>
<div class="grant-item__funding mt-2">
<div class="grant-item__funding-item">
<div class="grant-item__funding-number font-body">{{ grant.monthly_amount_subscribed|floatformat:2|intcomma }} DAI</div>
<div class="grant-item__funding-label font-caption">{% trans 'Monthly Funded' %}</div>
<div class="grant-item__funding-number font-body">{{ grant.amount_received|floatformat:2|intcomma }} DAI</div>
<div class="grant-item__funding-label font-caption">{% trans 'Funded' %}</div>
</div>
<div class="grant-item__funding-item">
<div class="grant-item__funding-number font-body">{{ grant.amount_goal|floatformat:2|intcomma }} DAI</div>
Expand Down
6 changes: 3 additions & 3 deletions app/grants/templates/grants/detail/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ <h1 class="grant__title font-title-lg {% if is_admin %} mt-4 {% endif %}">
<div class="progress-text mt-2">
<div class="row">
<div class="col-6">
<span>{{ grant.monthly_amount_subscribed|floatformat:2|intcomma }} DAI</span>
<p>Monthly Funding</p>
<span>{{ grant.amount_received|floatformat:2|intcomma }} DAI</span>
<p>Total Funding</p>
</div>
<div class="col-6 text-right">
<span>{{ grant.amount_goal|floatformat:2|intcomma }} DAI</span>
Expand All @@ -180,7 +180,7 @@ <h1 class="grant__title font-title-lg {% if is_admin %} mt-4 {% endif %}">
</div>
</div>
<p>
{% trans 'Total Funding Received: '%} {{ grant.amount_received }}
{% trans 'Monthly Recurring Funding: '%} {{ grant.monthly_amount_subscribed }}
</p>
</div>
{% if grant_is_inactive %}
Expand Down

0 comments on commit 7b6dbbc

Please sign in to comment.