Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

purge: amount_goal in Grants #6457

Merged
merged 3 commits into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/app/fixtures/dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -7768,7 +7768,6 @@
"grant_url": "/grants/3/my-test-grant-x3",
"grant_logo": null,
"token_name": "Any Token",
"amount_goal": "100000.00",
"value_in_token": "0.00"
},
"needs_review": false
Expand Down
3 changes: 0 additions & 3 deletions app/app/fixtures/grants.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"logo_svg": "",
"admin_address": "0xBcAfdD642118e5536024675e776d32413728dd08",
"contract_owner_address": "0xBcAfdD642118e5536024675e776d32413728dd08",
"amount_goal": "50.0000",
"monthly_amount_subscribed": "0.0000",
"amount_received": "5.0000",
"token_address": "0x8f2e097e79b1c51be9cba42658862f0192c3e487",
Expand Down Expand Up @@ -53,7 +52,6 @@
"logo_svg": "",
"admin_address": "0xE643cD48A9A902F6cE947324abE245b3Fe4106dc",
"contract_owner_address": "0xBcAfdD642118e5536024675e776d32413728dd08",
"amount_goal": "100000.0000",
"monthly_amount_subscribed": "47.5000",
"amount_received": "0.0000",
"token_address": "0x0000000000000000000000000000000000000000",
Expand Down Expand Up @@ -91,7 +89,6 @@
"logo_svg": "",
"admin_address": "0xCC4b3DE30576E161C8632786560Fa7DD3Fb33f77",
"contract_owner_address": "",
"amount_goal": "100000.0000",
"monthly_amount_subscribed": "0.0000",
"amount_received": "5.0000",
"token_address": "0x0000000000000000000000000000000000000000",
Expand Down
5 changes: 0 additions & 5 deletions app/assets/v2/js/grants/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const editableFields = [
'#form--input__reference-url',
'#contract_owner_address',
'#grant-members',
'#amount_goal',
'#grant-categories'
];

Expand Down Expand Up @@ -117,7 +116,6 @@ $(document).ready(function() {
$('#edit-details').addClass('hidden');
$('#save-details').removeClass('hidden');
$('#cancel-details').removeClass('hidden');
$('#edit-amount_goal').removeClass('hidden');
$('.grant__progress').addClass('hidden');

$('#section-nav-description .ql-toolbar').css('display', 'inherit');
Expand All @@ -134,22 +132,19 @@ $(document).ready(function() {
$('#edit-details').removeClass('hidden');
$('#save-details').addClass('hidden');
$('#cancel-details').addClass('hidden');
$('#edit-amount_goal').addClass('hidden');
$('.grant__progress').removeClass('hidden');

$('#section-nav-description .ql-toolbar').css('display', 'none');
$('#section-nav-description .ql-container').css('border-color', 'transparent');

let edit_title = $('#form--input__title').val();
let edit_reference_url = $('#form--input__reference-url').val();
let edit_amount_goal = $('#amount_goal').val();
let edit_grant_members = $('#grant-members').val();
let edit_categories = $('#grant-categories').val();

let data = {
'edit-title': edit_title,
'edit-reference_url': edit_reference_url,
'edit-amount_goal': edit_amount_goal,
'edit-grant_members[]': edit_grant_members,
'edit-categories[]': edit_categories
};
Expand Down
1 change: 0 additions & 1 deletion app/assets/v2/js/grants/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ const init = () => {
formData.append('contract_owner_address', $('#contract_owner_address').val());
formData.append('token_address', $('#token_address').val());
formData.append('token_symbol', $('#token_symbol').val());
formData.append('amount_goal', $('#amount_goal').val());
formData.append('contract_version', $('#contract_version').val());
formData.append('transaction_hash', $('#transaction_hash').val());
formData.append('network', $('#network').val());
Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Meta:
model = Grant
fields = ('id', 'active', 'grant_type', 'title', 'slug',
'description', 'description_rich', 'reference_url', 'logo',
'admin_address', 'contract_owner_address', 'amount_goal',
'admin_address', 'contract_owner_address',
'monthly_amount_subscribed', 'amount_received', 'token_address',
'token_symbol', 'contract_address', 'network',
'org', 'created_at', 'url', 'contribution_count', 'contributor_count'
Expand Down
1 change: 0 additions & 1 deletion app/dashboard/migrations/0034_data_for_old_grants.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def record_grant_activity_helper(activity_type, grant, profile, date):
metadata = {
'id': grant.id,
'value_in_token': '{0:.2f}'.format(grant.amount_received),
'amount_goal': '{0:.2f}'.format(grant.amount_goal),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This migration is cursed, would love to get rid of it somehow

'token_name': grant.token_symbol,
'title': grant.title,
'grant_logo': grant_logo,
Expand Down
1 change: 0 additions & 1 deletion app/dashboard/templates/profiles/tab_grant_contribs.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ <h2 class="font-title m-3 pb-3 title">
</div>
<div class="col-12 col-sm-6 col-md-2 my-auto">
<div class="info font-caption mt-4 mt-md-0 text-center text-sm-left">
<span class="font-weight-semibold">Goal: </span> {{ transaction.amount_goal}}<br>
<span class="font-weight-semibold">Received:</span> {{ transaction.amount_received }}<br>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion app/dashboard/tests/test_dashboard_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def new_grant(profile):
'contract_owner_address': '0x8B04e71007A783B4965BaFE068EC062D935E93b5',
'token_address': '0xFc1079D41D56D78e9FA2a857991F41D777104c74',
'token_symbol': 'E18R',
'amount_goal': Decimal('100.0000'),
'contract_version': Decimal('0'),
'deploy_tx_id': '0xa95d30415427f76c778207e789c78d436b5c4ca4339797cff52ed21de8419554',
'network': 'rinkeby',
Expand Down
4 changes: 2 additions & 2 deletions app/grants/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class GrantAdmin(GeneralAdmin):
fields = [
'migrated_to',
'title', 'description', 'reference_url', 'admin_address', 'active',
'amount_goal', 'amount_received', 'monthly_amount_subscribed',
'amount_received', 'monthly_amount_subscribed',
'deploy_tx_id', 'cancel_tx_id', 'admin_profile', 'token_symbol',
'token_address', 'contract_address', 'contract_version', 'network', 'required_gas_price', 'logo_svg_asset',
'logo_asset', 'created_on', 'modified_on', 'team_member_list',
Expand All @@ -89,7 +89,7 @@ class GrantAdmin(GeneralAdmin):
]
list_display =['pk', 'title', 'active','grant_type', 'link', 'hidden', 'migrated_to']
raw_id_fields = ['admin_profile']
search_fields = ['amount_goal', 'description', 'admin_profile__handle']
search_fields = ['description', 'admin_profile__handle']


# Custom Avatars
Expand Down
2 changes: 1 addition & 1 deletion app/grants/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Meta:

model = Grant
fields = (
'title', 'description', 'reference_url', 'logo', 'logo_svg', 'amount_goal', 'admin_address', 'deploy_tx_id',
'title', 'description', 'reference_url', 'logo', 'logo_svg', 'admin_address', 'deploy_tx_id',
'cancel_tx_id', 'amount_received', 'token_address', 'contract_address', 'metadata', 'network',
'required_gas_price', 'admin_profile', 'team_members'
)
17 changes: 17 additions & 0 deletions app/grants/migrations/0055_remove_grant_amount_goal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 2.2.4 on 2020-04-17 03:05

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('grants', '0054_auto_20200414_1141'),
]

operations = [
migrations.RemoveField(
model_name='grant',
name='amount_goal',
),
]
13 changes: 1 addition & 12 deletions app/grants/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,6 @@ class Meta:
default='0x0',
help_text=_('The wallet address that owns the subscription contract and is able to call endContract()'),
)
amount_goal = models.DecimalField(
default=1,
decimal_places=4,
max_digits=50,
help_text=_('The monthly contribution goal amount for the Grant in DAI.'),
)
amount_received_in_round = models.DecimalField(
default=0,
decimal_places=4,
Expand Down Expand Up @@ -314,12 +308,6 @@ def __str__(self):
"""Return the string representation of a Grant."""
return f"id: {self.pk}, active: {self.active}, title: {self.title}, type: {self.grant_type}"

def percentage_done(self):
"""Return the percentage of token received based on the token goal."""
if not self.amount_goal:
return 0
return ((float(self.amount_received_with_phantom_funds) / float(self.amount_goal)) * 100)


def updateActiveSubscriptions(self):
"""updates the active subscriptions list"""
Expand All @@ -328,6 +316,7 @@ def updateActiveSubscriptions(self):
handles.append(handle)
self.activeSubscriptions = handles


@property
def contributions(self):
pks = []
Expand Down
4 changes: 2 additions & 2 deletions app/grants/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class Meta:

model = Grant
fields = (
'active', 'title', 'slug', 'description', 'reference_url', 'logo', 'admin_address', 'amount_goal',
'active', 'title', 'slug', 'description', 'reference_url', 'logo', 'admin_address',
'amount_received', 'token_address', 'token_symbol', 'contract_address', 'metadata',
'network', 'required_gas_price', 'admin_profile', 'team_members', 'percentage_done',
'network', 'required_gas_price', 'admin_profile', 'team_members',
)


Expand Down
8 changes: 0 additions & 8 deletions app/grants/templates/grants/detail/info.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,6 @@ <h1 class="font-title-xl my-4 font-weight-bold">

<div class="mt-2 pt-2">
<!-- FUNDING AMOUNT-->
{% if is_team_member %}
<div id="edit-amount_goal" class="my-2 hidden">
<p class="sub-title mb-0">{% trans "Monthly Amount sought in DAI" %}</p>
<input id="amount_goal" class="p-0 m-0 inline-edit" value="{{ grant.amount_goal }}" disabled>
</div>
{% endif %}


<div class="row progress-container {% if clr_active %} mb-2 {% endif %} {% if not is_team_member %} mt-4 {% endif %}">
<div class="col-6 text-center text-xl-left offset-xl-0 col-xl-6 mb-xl-0 ">
Expand All @@ -195,7 +188,6 @@ <h1 class="font-title-xl my-4 font-weight-bold">
<p class="font-title mb-0 font-weight-bold">
{{ grant.monthly_amount_subscribed|floatformat:0|intcomma }} DAI
</p>
<p>of {{ grant.amount_goal|floatformat:0|intcomma }} DAI goal</p>
{% endif %}
</div>

Expand Down
1 change: 0 additions & 1 deletion app/grants/templates/grants/new.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ <h5 class="mt-4">Funding Information</h5>
<div class="form__group-horizontal pb-3">
<div class="row">
<div class="col-12 col-md-12">
<input type="hidden" id="amount_goal" name="amount_goal" class="form__input form__input-lg" min="0.001" step=".001" value="0" />
<label class="font-body">{% trans "Accepted Tokens" %}</label>
<div class="form__select2">
<select class='js-select2' name='denomination' id='js-token'></select>
Expand Down
14 changes: 3 additions & 11 deletions app/grants/templates/grants/newv0.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,10 @@ <h1 class="text-center font-title-xl">{% trans "Create a Grant" %}</h1>
</div>

<div class="form__group-horizontal pb-3">
<div class="row">
<div class="col-12 col-md-6">
<label class="font-body">{% trans "Monthly amount sought in DAI" %}</label>
<input type="number" id="amount_goal" name="amount_goal" class="form__input form__input-lg" min="0.001" step=".001" required />
<label class="font-body">{% trans "Required Token For Subscription" %}</label>
<div class="form__select2">
<select class='js-select2' name='denomination' id='js-token'></select>
</div>
<div class="col-12 col-md-6">
<label class="font-body">{% trans "Required Token For Subscription" %}</label>
<div class="form__select2">
<select class='js-select2' name='denomination' id='js-token'></select>
</div>
</div>
</div>
</div>

<div class="form__group-horizontal pb-3">
Expand Down
4 changes: 0 additions & 4 deletions app/grants/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,6 @@ def grant_details(request, grant_id, grant_slug):
elif 'edit-title' in request.POST:
grant.title = request.POST.get('edit-title')
grant.reference_url = request.POST.get('edit-reference_url')
grant.amount_goal = Decimal(request.POST.get('edit-amount_goal'))
team_members = request.POST.getlist('edit-grant_members[]')
team_members.append(str(grant.admin_profile.id))
grant.team_members.set(team_members)
Expand Down Expand Up @@ -598,7 +597,6 @@ def grant_new(request):
'contract_owner_address': request.POST.get('contract_owner_address', ''),
'token_address': request.POST.get('token_address', ''),
'token_symbol': request.POST.get('token_symbol', ''),
'amount_goal': request.POST.get('amount_goal', 1),
'contract_version': request.POST.get('contract_version', ''),
'deploy_tx_id': request.POST.get('transaction_hash', ''),
'network': request.POST.get('network', 'mainnet'),
Expand Down Expand Up @@ -695,7 +693,6 @@ def grant_new_v0(request):
'contract_owner_address': request.POST.get('contract_owner_address', ''),
'token_address': request.POST.get('token_address', ''),
'token_symbol': request.POST.get('token_symbol', ''),
'amount_goal': request.POST.get('amount_goal', 1),
'contract_version': request.POST.get('contract_version', ''),
'deploy_tx_id': request.POST.get('transaction_hash', ''),
'network': request.POST.get('network', 'mainnet'),
Expand Down Expand Up @@ -1125,7 +1122,6 @@ def record_grant_activity_helper(activity_type, grant, profile, amount=None, tok
metadata = {
'id': grant.id,
'value_in_token': '{0:.2f}'.format(grant.amount_received) if not amount else amount,
'amount_goal': '{0:.2f}'.format(grant.amount_goal) if not amount else amount,
'token_name': grant.token_symbol if not token else token,
'title': grant.title,
'grant_logo': grant_logo,
Expand Down
3 changes: 0 additions & 3 deletions app/retail/templates/emails/grants/new_grant.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ <h1>{% trans "New Grant Created" %}</h1>
<img id="grant-logo" src="{% if grant.logo and grant.logo.url %}{{ grant.logo.url }}{% else %}{% with grant_logo='v2/images/grants/logos/' id=grant.id|modulo:3 %}{% static grant_logo|addstr:id|add:'.png' %}{% endwith %}{% endif %}" alt="grant logo" >
<h1 class="grant-email-name">{{ grant.title }}</h1>
<p class="grant-description">{{ grant.description }}</p>
<div>
<p>{% trans "You are seeking " %}<strong>{{ grant.amount_goal }}</strong> {% trans "DAI monthly" %}</p>
</div>
<p>{% trans "To view or edit your grant click the button below." %}</p>
<p style="margin: 2rem;">
<a class="grant-button" href="{% url 'grants:details' grant.pk grant.slug %}">{% trans "View Grant" %}</a>
Expand Down
2 changes: 0 additions & 2 deletions app/retail/templates/emails/grants/new_grant.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@

{% trans "Description" %} : {{ grant.description }}

{% trans "Goal" %} : {{ grant.amount_goal }}

{% trans "The details of your grant can be seen here:" %} {{ grant.reference_url }}
Loading