From f3f34f691fa6a7833b1ded01039cfc441630c661 Mon Sep 17 00:00:00 2001 From: kn Date: Tue, 27 Nov 2018 10:49:23 +0900 Subject: [PATCH] Add a field to store estimated hours for bounties Refs: https://github.com/gitcoinco/web/issues/2117 --- .../migrations/0121_bounty_estimated_hours.py | 18 ++++++++++++++++++ app/dashboard/models.py | 1 + app/dashboard/tests/test_dashboard_models.py | 4 +++- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 app/dashboard/migrations/0121_bounty_estimated_hours.py diff --git a/app/dashboard/migrations/0121_bounty_estimated_hours.py b/app/dashboard/migrations/0121_bounty_estimated_hours.py new file mode 100644 index 00000000000..4e6bd0a9174 --- /dev/null +++ b/app/dashboard/migrations/0121_bounty_estimated_hours.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.2 on 2018-11-27 00:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dashboard', '0120_merge_20181126_2232'), + ] + + operations = [ + migrations.AddField( + model_name='bounty', + name='estimated_hours', + field=models.IntegerField(blank=True, null=True), + ), + ] diff --git a/app/dashboard/models.py b/app/dashboard/models.py index 2d0daa1e778..2765c014f0f 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -221,6 +221,7 @@ class Bounty(SuperModel): token_address = models.CharField(max_length=50) bounty_type = models.CharField(max_length=50, choices=BOUNTY_TYPES, blank=True) project_length = models.CharField(max_length=50, choices=PROJECT_LENGTHS, blank=True) + estimated_hours = models.IntegerField(blank=True, null=True) experience_level = models.CharField(max_length=50, choices=EXPERIENCE_LEVELS, blank=True) github_url = models.URLField(db_index=True) github_issue_details = JSONField(default=dict, blank=True, null=True) diff --git a/app/dashboard/tests/test_dashboard_models.py b/app/dashboard/tests/test_dashboard_models.py index f3718c69b1a..5abc2f974ca 100644 --- a/app/dashboard/tests/test_dashboard_models.py +++ b/app/dashboard/tests/test_dashboard_models.py @@ -67,6 +67,7 @@ def test_bounty(): bounty_type='Feature', experience_level='Intermediate', raw_data={}, + estimated_hours=7, ) bounty_fulfillment = BountyFulfillment.objects.create( fulfiller_address='0x0000000000000000000000000000000000000000', @@ -76,7 +77,7 @@ def test_bounty(): bounty=bounty, profile=fulfiller_profile, ) - assert str(bounty) == f'5: foo, 0 ETH @ {naturaltime(bounty.web3_created)}' + assert str(bounty) == f'{bounty.pk}: foo, 0 ETH @ {naturaltime(bounty.web3_created)}' assert bounty.url == f'{settings.BASE_URL}issue/gitcoinco/web/11/{bounty.standard_bounties_id}' assert bounty.title_or_desc == 'foo' assert bounty.issue_description_text == 'hello world' @@ -92,6 +93,7 @@ def test_bounty(): assert 'ago 5 Feature Intermediate' in bounty.desc assert bounty.is_legacy is False assert bounty.get_github_api_url() == 'https://api.github.com/repos/gitcoinco/web/issues/11' + assert bounty.estimated_hours == 7 assert bounty_fulfillment.profile.handle == 'fred' assert bounty_fulfillment.bounty.title == 'foo'