From f5b4424b17a4dbbb2b7395bbc0ff31c9ff1e6d8d Mon Sep 17 00:00:00 2001 From: owocki Date: Fri, 17 Apr 2020 07:30:08 -0600 Subject: [PATCH 01/26] grants landing --- app/grants/templates/grants/shared/landing_hero.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/grants/templates/grants/shared/landing_hero.html b/app/grants/templates/grants/shared/landing_hero.html index 82c86e17682..6eae1ae0db5 100644 --- a/app/grants/templates/grants/shared/landing_hero.html +++ b/app/grants/templates/grants/shared/landing_hero.html @@ -16,7 +16,7 @@
- Final amounts will be announced on April 14th.
- - Payout instructions will be circulated by April 17th. + - Payout instructions will be circulated by April 21st.
- The next round starts June 15th. From bce1bc0710907cd720a5adb1a65378c57ae2b7c3 Mon Sep 17 00:00:00 2001 From: owocki Date: Fri, 17 Apr 2020 08:06:58 -0600 Subject: [PATCH 02/26] profile to location - stopgap for cronbox IOPS --- app/marketing/management/commands/assemble_leaderboards.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app/marketing/management/commands/assemble_leaderboards.py b/app/marketing/management/commands/assemble_leaderboards.py index bcdfe307aaa..37cf55cf37f 100644 --- a/app/marketing/management/commands/assemble_leaderboards.py +++ b/app/marketing/management/commands/assemble_leaderboards.py @@ -79,6 +79,7 @@ def default_ranks(): def profile_to_location(handle): + return [] # temporary stopgap because we think thaat this part of the job was crushing the cronox timeout = 60 * 20 key_salt = '1' key = f'profile_to_location{handle}_{key_salt}' From 3928971eb68036f07fe70740ada33e3b2d660e2d Mon Sep 17 00:00:00 2001 From: owocki Date: Fri, 17 Apr 2020 08:44:48 -0600 Subject: [PATCH 03/26] refactors the GEOIP object not to thrash the disk IOPS --- app/app/utils.py | 31 ++++++++++++++++--- .../commands/assemble_leaderboards.py | 1 - 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/app/app/utils.py b/app/app/utils.py index 36020f76f34..029c08a852f 100644 --- a/app/app/utils.py +++ b/app/app/utils.py @@ -376,6 +376,29 @@ def handle_location_request(request): return geolocation_data, ip_address +geoIPobject = None +geoIPCountryobject = None + +def get_geoIP_singleton(): + global geoIPobject + if not geoIPobject: + geoIPobject = GeoIP2() + print("loaded geoIP singleton from DISK") + else: + print("loaded geoIP singleton from CACHE") + return geoIPobject + +def get_geoIP_country_singleton(): + global geoIPCountryobject + db = f'{settings.GEOIP_PATH}GeoLite2-Country.mmdb' + if not geoIPCountryobject: + geoIPCountryobject = geoip2.database.Reader(db) + print("loaded geoIPCountry singleton FROM DISK") + else: + print("loaded geoIPCountry singleton FROM CACHE") + return geoIPCountryobject + + def get_location_from_ip(ip_address): """Get the location associated with the provided IP address. @@ -391,7 +414,7 @@ def get_location_from_ip(ip_address): return city try: - geo = GeoIP2() + geo = get_geoIP_singleton() try: city = geo.city(ip_address) except AddressNotFoundError: @@ -401,17 +424,15 @@ def get_location_from_ip(ip_address): return city -def get_country_from_ip(ip_address, db=None): +def get_country_from_ip(ip_address): """Get the user's country information from the provided IP address.""" country = {} - if db is None: - db = f'{settings.GEOIP_PATH}GeoLite2-Country.mmdb' if not ip_address: return country try: - reader = geoip2.database.Reader(db) + reader = get_geoIP_country_singleton() country = reader.country(ip_address) except AddressNotFoundError: pass diff --git a/app/marketing/management/commands/assemble_leaderboards.py b/app/marketing/management/commands/assemble_leaderboards.py index 37cf55cf37f..bcdfe307aaa 100644 --- a/app/marketing/management/commands/assemble_leaderboards.py +++ b/app/marketing/management/commands/assemble_leaderboards.py @@ -79,7 +79,6 @@ def default_ranks(): def profile_to_location(handle): - return [] # temporary stopgap because we think thaat this part of the job was crushing the cronox timeout = 60 * 20 key_salt = '1' key = f'profile_to_location{handle}_{key_salt}' From 4739fc600ed81a7c59f3aeb95112670ecd1c27e6 Mon Sep 17 00:00:00 2001 From: owocki Date: Fri, 17 Apr 2020 09:57:24 -0600 Subject: [PATCH 04/26] fixes the JS errors on expllrer --- app/assets/v2/js/shared.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/assets/v2/js/shared.js b/app/assets/v2/js/shared.js index 5c82a0fdbf0..5d3d560a009 100644 --- a/app/assets/v2/js/shared.js +++ b/app/assets/v2/js/shared.js @@ -77,6 +77,9 @@ var loading_button = function(button) { var cb_address; var reloadCbAddress = function() { + if(typeof web3 == 'undefined'){ + return; + } web3.eth.getCoinbase(function(error, result) { if (!error) { cb_address = result; From 3c8762074248132b7efa59bca910a25dc99f166e Mon Sep 17 00:00:00 2001 From: owocki Date: Fri, 17 Apr 2020 10:34:29 -0600 Subject: [PATCH 05/26] make fix, remove print statements --- app/app/utils.py | 6 ------ app/assets/v2/js/shared.js | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/app/app/utils.py b/app/app/utils.py index 029c08a852f..624153a0838 100644 --- a/app/app/utils.py +++ b/app/app/utils.py @@ -383,9 +383,6 @@ def get_geoIP_singleton(): global geoIPobject if not geoIPobject: geoIPobject = GeoIP2() - print("loaded geoIP singleton from DISK") - else: - print("loaded geoIP singleton from CACHE") return geoIPobject def get_geoIP_country_singleton(): @@ -393,9 +390,6 @@ def get_geoIP_country_singleton(): db = f'{settings.GEOIP_PATH}GeoLite2-Country.mmdb' if not geoIPCountryobject: geoIPCountryobject = geoip2.database.Reader(db) - print("loaded geoIPCountry singleton FROM DISK") - else: - print("loaded geoIPCountry singleton FROM CACHE") return geoIPCountryobject diff --git a/app/assets/v2/js/shared.js b/app/assets/v2/js/shared.js index 5d3d560a009..e89027dbed2 100644 --- a/app/assets/v2/js/shared.js +++ b/app/assets/v2/js/shared.js @@ -77,7 +77,7 @@ var loading_button = function(button) { var cb_address; var reloadCbAddress = function() { - if(typeof web3 == 'undefined'){ + if (typeof web3 == 'undefined') { return; } web3.eth.getCoinbase(function(error, result) { From afbe4c4292dd3dae16489f6f1cb4dfcafc7f31ea Mon Sep 17 00:00:00 2001 From: owocki Date: Fri, 17 Apr 2020 16:06:32 -0600 Subject: [PATCH 06/26] grants CSV export --- scripts/debug/grants_export.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 scripts/debug/grants_export.py diff --git a/scripts/debug/grants_export.py b/scripts/debug/grants_export.py new file mode 100644 index 00000000000..90594a6be49 --- /dev/null +++ b/scripts/debug/grants_export.py @@ -0,0 +1,33 @@ +from grants.models import * + +# total stats + +print("name, gitcoin url, project URL, created, category, sub-category, amount raised total, amount raised round 5, amount matched round 5, num contributors round 5, github_url") +for grant in Grant.objects.filter(active=True): + amount_round = 0 + try: + amount_round = grant.clr_prediction_curve[0][1] + except: + pass + print( + grant.title.replace(',',''), + ",", + "https://gitcoin.co" + grant.url, + ",", + grant.reference_url.replace("\n",''), + ",", + grant.created_on.strftime('%m/%d/%Y'), + ",", + grant.grant_type, + ",", + "::".join(grant.categories.values_list('category', flat=True)), + ",", + grant.amount_received, + ",", + grant.amount_received_in_round, + ",", + amount_round, + ",", + grant.positive_round_contributor_count, + ",", + ) From e315868c56091e909895846e10e74ab5fdb408aa Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Sun, 19 Apr 2020 19:22:11 +0530 Subject: [PATCH 07/26] chore: auto focus on search input --- app/assets/v2/js/search.js | 5 +++++ app/dashboard/templates/shared/search.html | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/assets/v2/js/search.js b/app/assets/v2/js/search.js index ef67cc7855f..5aa287d02f9 100644 --- a/app/assets/v2/js/search.js +++ b/app/assets/v2/js/search.js @@ -33,6 +33,11 @@ if (document.getElementById('gc-search')) { this.search(); }, methods: { + init: function() { + setTimeout(() => { + $('.has-search input').focus(); + }, 100); + }, search: async function() { let vm = this; diff --git a/app/dashboard/templates/shared/search.html b/app/dashboard/templates/shared/search.html index 7fc65f9f38d..b2516c068f2 100644 --- a/app/dashboard/templates/shared/search.html +++ b/app/dashboard/templates/shared/search.html @@ -17,7 +17,7 @@ {% load i18n static humanize %}
{% if not hackathon_not_started %} -
- +
+ + {% include 'dashboard/featured_bounties.html' %}
Loading ... diff --git a/app/dashboard/views.py b/app/dashboard/views.py index 042a5e92374..1ca8b3bd358 100644 --- a/app/dashboard/views.py +++ b/app/dashboard/views.py @@ -3623,7 +3623,7 @@ def hackathon(request, hackathon='', panel='prizes'): 'org_name': sponsor_profile.handle, 'follower_count': sponsor_profile.tribe_members.all().count(), 'followed': True if sponsor_profile.handle in following_tribes else False, - 'bounty_count': Bounty.objects.filter(bounty_owner_github_username=sponsor_profile.handle).count() + 'bounty_count': sponsor_profile.bounties.count() } orgs.append(org) if hasattr(request.user, 'profile') == False: From 85ea6efc2454bb9acc164194e95300722e922f8b Mon Sep 17 00:00:00 2001 From: owocki Date: Tue, 21 Apr 2020 10:20:05 -0600 Subject: [PATCH 18/26] small fix --- app/grants/management/commands/payout_round.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/grants/management/commands/payout_round.py b/app/grants/management/commands/payout_round.py index 51972dba3e2..72b1c9feda2 100644 --- a/app/grants/management/commands/payout_round.py +++ b/app/grants/management/commands/payout_round.py @@ -64,7 +64,7 @@ def handle(self, *args, **options): # get data scheduled_matches = CLRMatch.objects.filter(round_number=clr_round) - grants = Grant.objects.filter(active=True, network='mainnet', link_to_new_grant__isnull=False) + grants = Grant.objects.filter(active=True, network='mainnet', link_to_new_grant__isnull=True) # finalize rankings if what == 'finalize': From 58ba34c3980cd4768ac634aa52d88ab181255ced Mon Sep 17 00:00:00 2001 From: octavioamu Date: Tue, 21 Apr 2020 13:59:59 -0300 Subject: [PATCH 19/26] remove featured from bottom --- app/dashboard/templates/dashboard/index-vue.html | 1 - 1 file changed, 1 deletion(-) diff --git a/app/dashboard/templates/dashboard/index-vue.html b/app/dashboard/templates/dashboard/index-vue.html index 1b4d2623add..3882d22b76a 100644 --- a/app/dashboard/templates/dashboard/index-vue.html +++ b/app/dashboard/templates/dashboard/index-vue.html @@ -385,7 +385,6 @@

{% trans "No results found." %}

{% endif %}
- {% include 'dashboard/featured_bounties.html' %} {% else %}

Hackathon Coming Soon!

From 8479fe02be2b021822b16e4302978a42a1c67adc Mon Sep 17 00:00:00 2001 From: owocki Date: Tue, 21 Apr 2020 11:30:38 -0600 Subject: [PATCH 20/26] haxxor coupon code --- app/marketing/mails.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/marketing/mails.py b/app/marketing/mails.py index a6c7a99d588..9c481fa2e6c 100644 --- a/app/marketing/mails.py +++ b/app/marketing/mails.py @@ -939,9 +939,9 @@ def grant_match_distribution_test_txn(match): coupon = "Pick up ONE item of Gitcoin Schwag at http://store.gitcoin.co/ at 50% off with coupon code {settings.GRANTS_COUPON_50_OFF}" if match.amount > 1000: coupon = "Pick up ONE item of Gitcoin Schwag at http://store.gitcoin.co/ at 100% off with coupon code {settings.GRANTS_COUPON_100_OFF}" - # NOTE: WE WILL SCREEN AND APPROVE ANY ORDERS TO THE STORE, SO IF YOURE A CLEVER BISCOUT - # AND FOUND THIS BY READING OUR CODEBASE, THEN GOOD FOR YOU BUT (ENTER SEINFELD SOUPNNAAZZII VOICE ) - # "NO SCHWAG FOR U!" + # NOTE: IF YOURE A CLEVER BISCUT AND FOUND THIS BY READING OUR CODEBASE, + # THEN GOOD FOR YOU! HERE IS A 100% OFF COUPON CODE U CAN USE (LIMIT OF 1 FOR THE FIRST PERSON + # TO FIND THIS EASTER EGG) : GRANTS-ROUND-5-HAXXOR try: setup_lang(to_email) subject = f"💰 Grants Round {match.round_number} Match Distribution: {rounded_amount} DAI (Email 1 of 2)" From 2638888cd0ee3177641c3173e424ecd016354c2e Mon Sep 17 00:00:00 2001 From: owocki Date: Tue, 21 Apr 2020 13:07:22 -0600 Subject: [PATCH 21/26] fat finger is fat --- app/grants/management/commands/payout_round.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/grants/management/commands/payout_round.py b/app/grants/management/commands/payout_round.py index 72b1c9feda2..0fabbd4066c 100644 --- a/app/grants/management/commands/payout_round.py +++ b/app/grants/management/commands/payout_round.py @@ -196,7 +196,7 @@ def handle(self, *args, **options): subscription.is_postive_vote = True subscription.active = False subscription.error = True - subscription.contributor_address = '/NA' + subscription.contributor_address = 'N/A' subscription.amount_per_period = match.amount subscription.real_period_seconds = 2592000 subscription.frequency = 30 From 81b18935c30c2b020596ecc5da8956cae0794dc4 Mon Sep 17 00:00:00 2001 From: owocki Date: Tue, 21 Apr 2020 13:16:09 -0600 Subject: [PATCH 22/26] send admin warning emails (admin only) even if unsubbed --- app/marketing/mails.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/app/marketing/mails.py b/app/marketing/mails.py index 9c481fa2e6c..b5cdabd9f74 100644 --- a/app/marketing/mails.py +++ b/app/marketing/mails.py @@ -793,15 +793,14 @@ def warn_account_out_of_eth(account, balance, denomination): subject = account + str(_(" is out of gas")) body_str = _("is down to ") body = f"{account} {body_str} {balance} {denomination}" - if not should_suppress_notification_email(to_email, 'admin'): - send_mail( - from_email, - to_email, - subject, - body, - from_name=_("No Reply from Gitcoin.co"), - categories=['admin', func_name()], - ) + send_mail( + from_email, + to_email, + subject, + body, + from_name=_("No Reply from Gitcoin.co"), + categories=['admin', func_name()], + ) finally: translation.activate(cur_language) From 4bc3335dafc3f791c8ee756de1f668ec6053fffa Mon Sep 17 00:00:00 2001 From: owocki Date: Tue, 21 Apr 2020 13:40:24 -0600 Subject: [PATCH 23/26] busted coupon email --- app/marketing/mails.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/marketing/mails.py b/app/marketing/mails.py index b5cdabd9f74..23647b7c20d 100644 --- a/app/marketing/mails.py +++ b/app/marketing/mails.py @@ -933,11 +933,11 @@ def grant_match_distribution_test_txn(match): cur_language = translation.get_language() rounded_amount = round(match.amount, 2) token_name = f"CLR{match.round_number}" - coupon = "Pick up ONE item of Gitcoin Schwag at http://store.gitcoin.co/ at 25% off with coupon code {settings.GRANTS_COUPON_25_OFF}" + coupon = f"Pick up ONE item of Gitcoin Schwag at http://store.gitcoin.co/ at 25% off with coupon code {settings.GRANTS_COUPON_25_OFF}" if match.amount > 100: - coupon = "Pick up ONE item of Gitcoin Schwag at http://store.gitcoin.co/ at 50% off with coupon code {settings.GRANTS_COUPON_50_OFF}" + coupon = f"Pick up ONE item of Gitcoin Schwag at http://store.gitcoin.co/ at 50% off with coupon code {settings.GRANTS_COUPON_50_OFF}" if match.amount > 1000: - coupon = "Pick up ONE item of Gitcoin Schwag at http://store.gitcoin.co/ at 100% off with coupon code {settings.GRANTS_COUPON_100_OFF}" + coupon = f"Pick up ONE item of Gitcoin Schwag at http://store.gitcoin.co/ at 100% off with coupon code {settings.GRANTS_COUPON_100_OFF}" # NOTE: IF YOURE A CLEVER BISCUT AND FOUND THIS BY READING OUR CODEBASE, # THEN GOOD FOR YOU! HERE IS A 100% OFF COUPON CODE U CAN USE (LIMIT OF 1 FOR THE FIRST PERSON # TO FIND THIS EASTER EGG) : GRANTS-ROUND-5-HAXXOR From 65a2469dd38075e1f925b5f15c890599d464328d Mon Sep 17 00:00:00 2001 From: owocki Date: Tue, 21 Apr 2020 13:41:57 -0600 Subject: [PATCH 24/26] contribution can be blank - for admin updates --- app/grants/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/grants/models.py b/app/grants/models.py index 11a1f0853bf..f4b0fbe63d1 100644 --- a/app/grants/models.py +++ b/app/grants/models.py @@ -1234,6 +1234,7 @@ class CLRMatch(SuperModel): 'grants.Contribution', related_name='test_clr_match_payouts', null=True, + blank=True, on_delete=models.SET_NULL, help_text=_('Contribution for the test payout') ) @@ -1249,6 +1250,7 @@ class CLRMatch(SuperModel): 'grants.Contribution', related_name='clr_match_payouts', null=True, + blank=True, on_delete=models.SET_NULL, help_text=_('Contribution for the payout') ) From 3048590e3db7f13463fe6a82e06fa0f15a6592ce Mon Sep 17 00:00:00 2001 From: owocki Date: Tue, 21 Apr 2020 14:11:45 -0600 Subject: [PATCH 25/26] wait 15 secs between payouts --- app/grants/management/commands/payout_round.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/grants/management/commands/payout_round.py b/app/grants/management/commands/payout_round.py index 0fabbd4066c..847d155ecc7 100644 --- a/app/grants/management/commands/payout_round.py +++ b/app/grants/management/commands/payout_round.py @@ -36,6 +36,7 @@ ) from web3 import HTTPProvider, Web3 +WAIT_TIME_BETWEEN_PAYOUTS = 15 class Command(BaseCommand): @@ -249,3 +250,4 @@ def handle(self, *args, **options): } Activity.objects.create(**kwargs) + time.sleep(WAIT_TIME_BETWEEN_PAYOUTS) From d31b1c3898016311f1bafc220f3858448c8890b7 Mon Sep 17 00:00:00 2001 From: Dan Lipert Date: Wed, 22 Apr 2020 23:22:31 +0900 Subject: [PATCH 26/26] temp fix pydoc google analytics (#6490) --- pydocmd.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pydocmd.yml b/pydocmd.yml index 9388b663129..3eb5f038ac7 100644 --- a/pydocmd.yml +++ b/pydocmd.yml @@ -179,8 +179,6 @@ generate: - marketing.management.commands.debug_test++ - marketing/admin.md: - marketing.admin++ - - marketing/google_analytics.md: - - marketing.google_analytics++ - marketing/mails.md: - marketing.mails++ - marketing/models.md: