Skip to content

Commit

Permalink
Adds fund branding organisation information with a bounty (#2039)
Browse files Browse the repository at this point in the history
* Adds fund branding organisation information with a bounty

* makes stickler happy

* Related to Kevin's comment

* Makes changes in the model file

* Update migration file

* Modifies migrations to prevent conflict
  • Loading branch information
SaptakS committed Sep 26, 2018
1 parent 1d74c9e commit 1bb6b1c
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 3 deletions.
3 changes: 3 additions & 0 deletions app/assets/v2/js/pages/bounty_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ var callbacks = {
'bounty_owner_name': function(key, val, result) {
return [ 'bounty_owner_name', result.bounty_owner_name ];
},
'funding_organisation': function(key, val, result) {
return [ 'funding_organisation', result.funding_organisation ];
},
'permission_type': function(key, val, result) {
if (val == 'approval') {
val = 'Approval Required';
Expand Down
2 changes: 2 additions & 0 deletions app/assets/v2/js/pages/new_bounty.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ $(document).ready(function() {
experienceLevel: data.experience_level,
projectLength: data.project_length,
bountyType: data.bounty_type,
fundingOrganisation: data.fundingOrganisation,
tokenName
};

Expand Down Expand Up @@ -256,6 +257,7 @@ $(document).ready(function() {
hiringRightNow: data.hiringRightNow,
jobDescription: data.jobDescription
},
funding_organisation: metadata.fundingOrganisation,
privacy_preferences: privacy_preferences,
funders: [],
categories: metadata.issueKeywords.split(','),
Expand Down
4 changes: 3 additions & 1 deletion app/dashboard/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ def create_new_bounty(old_bounties, bounty_payload, bounty_details, bounty_id):
'contract_address': bounty_details.get('token'),
'network': bounty_details.get('network'),
'bounty_type': metadata.get('bountyType', ''),
'funding_organisation': metadata.get('fundingOrganisation', ''),
'project_length': metadata.get('projectLength', ''),
'experience_level': metadata.get('experienceLevel', ''),
'project_type': bounty_payload.get('schemes', {}).get('project_type', 'traditional'),
Expand All @@ -428,7 +429,8 @@ def create_new_bounty(old_bounties, bounty_payload, bounty_details, bounty_id):
'project_length', 'experience_level', 'project_type', 'permission_type', 'attached_job_description',
'bounty_owner_github_username', 'bounty_owner_address', 'bounty_owner_email', 'bounty_owner_name',
'github_comments', 'override_status', 'last_comment_date', 'snooze_warnings_for_days',
'admin_override_and_hide', 'admin_override_suspend_auto_approval', 'admin_mark_as_remarket_ready'
'admin_override_and_hide', 'admin_override_suspend_auto_approval', 'admin_mark_as_remarket_ready',
'funding_organisation'
],
)
bounty_kwargs.update(latest_old_bounty_dict)
Expand Down
18 changes: 18 additions & 0 deletions app/dashboard/migrations/0107_bounty_funding_organisation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.1 on 2018-08-24 14:19

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('dashboard', '0106_auto_20180823_1626'),
]

operations = [
migrations.AddField(
model_name='bounty',
name='funding_organisation',
field=models.CharField(blank=True, default='', max_length=255),
),
]
1 change: 1 addition & 0 deletions app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ class Bounty(SuperModel):
idx_project_length = models.IntegerField(default=0, db_index=True)
idx_status = models.CharField(max_length=9, choices=STATUS_CHOICES, default='open', db_index=True)
issue_description = models.TextField(default='', blank=True)
funding_organisation = models.CharField(max_length=255, default='', blank=True)
standard_bounties_id = models.IntegerField(default=0)
num_fulfillments = models.IntegerField(default=0)
balance = models.DecimalField(default=0, decimal_places=2, max_digits=50)
Expand Down
3 changes: 2 additions & 1 deletion app/dashboard/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,12 @@ def build_github_notification(bounty, event_name, profile_pairs=None):
learn_more_msg = f"* Learn more [on the Gitcoin Issue Details page]({absolute_url})"
crowdfund_amount = f"(plus a crowdfund of {bounty.additional_funding_summary_sentence})" if bounty.additional_funding_summary_sentence else ""
crowdfund_thx = ", ".join(f"@{tip.from_username}" for tip in bounty.tips.filter(is_for_bounty_fulfiller=True) if tip.from_username)
funding_org = f"__ as part of the {bounty.funding_organisation} fund__" if bounty.funding_organisation else ""
if crowdfund_thx:
crowdfund_thx = f"Thanks to {crowdfund_thx} for their crowdfunded contributions to this bounty.\n\n"
if event_name == 'new_bounty':
msg = f"{status_header}__This issue now has a funding of {natural_value} {bounty.token_name} {usdt_value} " \
f"{crowdfund_amount} attached to it.__\n\n * If you would " \
f"{crowdfund_amount} attached to it{funding_org}.__\n\n * If you would " \
f"like to work on this issue you can 'start work' [on the Gitcoin Issue Details page]({absolute_url})." \
f"\n{crowdfund_msg}\n{help_msg}\n{openwork_msg}\n"
if event_name == 'increased_bounty':
Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class Meta:
'github_org_name', 'github_repo_name', 'idx_status', 'token_value_time_peg', 'fulfillment_accepted_on',
'fulfillment_submitted_on', 'fulfillment_started_on', 'canceled_on', 'action_urls', 'project_type',
'permission_type', 'attached_job_description', 'needs_review', 'github_issue_state', 'is_issue_closed',
'additional_funding_summary', 'paid',
'additional_funding_summary', 'funding_organisation', 'paid',
)

def create(self, validated_data):
Expand Down
4 changes: 4 additions & 0 deletions app/dashboard/templates/bounty/new.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ <h5 class="font-subheader">{% trans "Contact" %}</h5>
</div>
{% include 'shared/pricing.html' %}
<div class="w-100 mt-2">
<label class="form__label" for="fundingOrganisation">{% trans "Funding organisation" %}</label>
<input name='fundingOrganisation' id="fundingOrganisation" class="form__input" type="text" placeholder="Ethereum Community Foundation"/>
<hr class="mt-4">

<label class="form__label" for="hiringRightNow">{% trans "Hiring right now?" %}</label>
<div class="hiring_container">
<div class="form__checkbox">
Expand Down

0 comments on commit 1bb6b1c

Please sign in to comment.