From b8443a7833fc49e0299fec5f910059897d4fa818 Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Mon, 21 Oct 2019 10:27:18 -0500 Subject: [PATCH 01/27] clr: update iterations to 200 --- app/grants/clr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/grants/clr.py b/app/grants/clr.py index 62697660226..8ac9420936d 100644 --- a/app/grants/clr.py +++ b/app/grants/clr.py @@ -198,7 +198,7 @@ def grants_clr_calculate (total_pot, grant_contributions, min_threshold, max_thr threshold = (max_threshold + min_threshold) / 2 total_clr, grants_clrs = calculate_clr(threshold, grant_contributions) - if iterations == 100 or total_pot == threshold or previous_threshold == threshold: + if iterations == 200 or total_pot == threshold or previous_threshold == threshold: # No more accuracy to be had return grants_clrs, total_clr, threshold, iterations if total_clr > total_pot: From be425f0c5d5113dce33253bab07ed7924ec14c4b Mon Sep 17 00:00:00 2001 From: octavioamu Date: Mon, 21 Oct 2019 13:40:45 -0300 Subject: [PATCH 02/27] fix tags --- app/dashboard/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/dashboard/views.py b/app/dashboard/views.py index 8218358e697..f1954fc9e60 100644 --- a/app/dashboard/views.py +++ b/app/dashboard/views.py @@ -3428,6 +3428,7 @@ def hackathon_registration(request): hackathon = request.POST.get('name') referer = request.POST.get('referer') + email = request.user.email if not profile: return JsonResponse( @@ -3447,7 +3448,7 @@ def hackathon_registration(request): client = MailChimp(mc_api=settings.MAILCHIMP_API_KEY, mc_user=settings.MAILCHIMP_USER) mailchimp_data = { - 'email_address': request.user.email, + 'email_address': email, 'status_if_new': 'subscribed', 'status': 'subscribed', @@ -3457,7 +3458,7 @@ def hackathon_registration(request): }, } - user_email_hash = hashlib.md5(profile.email.encode('utf')).hexdigest() + user_email_hash = hashlib.md5(email.encode('utf')).hexdigest() try: client.lists.members.create_or_update(settings.MAILCHIMP_LIST_ID_HACKERS, user_email_hash, mailchimp_data) From 79dafb564a52a08178b32afd9e1ac36b52a41544 Mon Sep 17 00:00:00 2001 From: Owocki Date: Mon, 21 Oct 2019 11:45:32 -0600 Subject: [PATCH 03/27] fixes active bounties link --- app/assets/v2/js/pages/quests.quest.quiz_style.js | 2 +- app/dashboard/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/v2/js/pages/quests.quest.quiz_style.js b/app/assets/v2/js/pages/quests.quest.quiz_style.js index 8351615f31d..78dd6767b4b 100644 --- a/app/assets/v2/js/pages/quests.quest.quiz_style.js +++ b/app/assets/v2/js/pages/quests.quest.quiz_style.js @@ -179,7 +179,7 @@ var advance_to_state = async function(new_state) { var new_html = $('#desc').html() + kudos_reward_html; $('#desc').html(new_html); - }, 3500); + }, 4500); await $('#desc').removeClass('hidden').fadeIn(); await sleep(4000); diff --git a/app/dashboard/views.py b/app/dashboard/views.py index 11541ca360f..555b280e6d8 100644 --- a/app/dashboard/views.py +++ b/app/dashboard/views.py @@ -2342,7 +2342,7 @@ def get_profile_tab(request, profile, tab, prev_context): if profile.cascaded_persona == 'org': active_bounties = profile.bounties.filter(idx_status__in=Bounty.WORK_IN_PROGRESS_STATUSES).filter(network='mainnet') elif profile.cascaded_persona == 'funder': - active_bounties = Bounty.objects.current().filter(bounty_owner_github_username=profile.handle).filter(idx_status__in=Bounty.WORK_IN_PROGRESS_STATUSES).filter(network='mainnet') + active_bounties = Bounty.objects.current().filter(bounty_owner_github_username__iexact=profile.handle).filter(idx_status__in=Bounty.WORK_IN_PROGRESS_STATUSES).filter(network='mainnet') elif profile.cascaded_persona == 'hunter': active_bounties = Bounty.objects.filter(pk__in=profile.active_bounties.filter(pending=False).values_list('bounty', flat=True)).filter(network='mainnet') else: From 39dea16a50ad567cacfc519bf5366cbc3fc8ad16 Mon Sep 17 00:00:00 2001 From: Owocki Date: Mon, 21 Oct 2019 11:58:22 -0600 Subject: [PATCH 04/27] only save earning for tip if it was actually sent :) --- app/dashboard/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/dashboard/models.py b/app/dashboard/models.py index 166e03b7470..86804763a64 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -1632,7 +1632,7 @@ def psave_tip(sender, instance, **kwargs): @receiver(post_save, sender=Tip, dispatch_uid="post_save_tip") def postsave_tip(sender, instance, **kwargs): - is_valid = instance.sender_profile != instance.recipient_profile + is_valid = instance.sender_profile != instance.recipient_profile and instance.txid if is_valid: Earning.objects.update_or_create( source_type=ContentType.objects.get(app_label='dashboard', model='tip'), From c0f20719d80df7469f256b44ba870962ca8b3ecb Mon Sep 17 00:00:00 2001 From: Owocki Date: Mon, 21 Oct 2019 12:34:05 -0600 Subject: [PATCH 05/27] make fix + adds quests/grants to sitemap --- app/app/sitemaps.py | 34 +++++++++++++++++++++++++- app/assets/v2/js/pages/quests.index.js | 4 +-- app/event_ethdenver2019/admin.py | 11 --------- 3 files changed, 35 insertions(+), 14 deletions(-) delete mode 100644 app/event_ethdenver2019/admin.py diff --git a/app/app/sitemaps.py b/app/app/sitemaps.py index cd2a4e95c7d..902c9cfdc14 100644 --- a/app/app/sitemaps.py +++ b/app/app/sitemaps.py @@ -3,7 +3,9 @@ from django.urls import reverse from dashboard.models import Bounty, Profile +from grants.models import Grant from kudos.models import Token +from quests.models import Quest class StaticViewSitemap(sitemaps.Sitemap): @@ -15,7 +17,7 @@ def items(self): return [ 'dashboard', 'new_funding', 'tip', 'terms', 'privacy', 'cookie', 'prirp', 'apitos', 'about', 'index', 'help', 'whitepaper', 'whitepaper_access', '_leaderboard', 'faucet', 'mission', 'slack', 'labs', 'results', - 'activity', 'kudos_main', 'kudos_marketplace', 'grants', 'funder_bounties' + 'activity', 'kudos_main', 'kudos_marketplace', 'grants', 'funder_bounties', 'quests_index', 'newquest' ] def location(self, item): @@ -100,6 +102,34 @@ def location(self, item): return f'/results/{item}' +class GrantsSitemap(Sitemap): + changefreq = "weekly" + priority = 0.6 + + def items(self): + return Grant.objects.filter(hidden=False).cache() + + def lastmod(self, obj): + return obj.modified_on + + def location(self, item): + return item.url + + +class QuestsSitemap(Sitemap): + changefreq = "weekly" + priority = 0.6 + + def items(self): + return Quest.objects.filter(visible=True).cache() + + def lastmod(self, obj): + return obj.modified_on + + def location(self, item): + return item.url + + sitemaps = { 'landers': ContributorLandingPageSitemap, 'results': ResultsSitemap, @@ -107,4 +137,6 @@ def location(self, item): 'issues': IssueSitemap, 'orgs': ProfileSitemap, 'kudos': KudosSitemap, + 'quests': QuestsSitemap, + 'grants': GrantsSitemap, } diff --git a/app/assets/v2/js/pages/quests.index.js b/app/assets/v2/js/pages/quests.index.js index c41d69bd477..20633716bfc 100644 --- a/app/assets/v2/js/pages/quests.index.js +++ b/app/assets/v2/js/pages/quests.index.js @@ -49,8 +49,8 @@ $(document).ready(function() { $('.difficulty_tab.' + target).removeClass('hidden'); $('html,body').animate({ - scrollTop: '+=1px' - }) + scrollTop: '+=1px' + }); }); $('.quest-card.available').click(function(e) { diff --git a/app/event_ethdenver2019/admin.py b/app/event_ethdenver2019/admin.py deleted file mode 100644 index 4509b6f7102..00000000000 --- a/app/event_ethdenver2019/admin.py +++ /dev/null @@ -1,11 +0,0 @@ -from django.contrib import admin - -from .models import Event_ETHDenver2019_Customizing_Kudos - - -class ETHDenver2019_CustomizingAdmin(admin.ModelAdmin): - ordering = ['-id'] - raw_id_fields = ['kudos_required'] - - -admin.site.register(Event_ETHDenver2019_Customizing_Kudos, ETHDenver2019_CustomizingAdmin) From a2392aa29af99c2d583cc59b332c84b4d96c82e8 Mon Sep 17 00:00:00 2001 From: Owocki Date: Mon, 21 Oct 2019 12:59:03 -0600 Subject: [PATCH 06/27] fixes negative quest point awards + also caches the sitemap so its not horridly slow --- app/app/urls.py | 3 ++- app/perftools/views.py | 9 ++++++++- app/quests/helpers.py | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/app/urls.py b/app/app/urls.py index 03f1cf5084c..12ffb5c0ac6 100644 --- a/app/app/urls.py +++ b/app/app/urls.py @@ -44,6 +44,7 @@ import linkshortener.views import marketing.views import marketing.webhookviews +import perftools.views import quests.views import retail.emails import retail.views @@ -542,7 +543,7 @@ # for robots url(r'^robots.txt/?', retail.views.robotstxt, name='robotstxt'), - url(r'^sitemap\.xml$', sitemap, {'sitemaps': sitemaps}, name='django.contrib.sitemaps.views.sitemap'), + url(r'^sitemap.xml/?', perftools.views.sitemap, name='sitemap'), # Interests path('interest/modal', dashboard.views.get_interest_modal, name='get_interest_modal'), path('actions/bounty//interest/new/', dashboard.views.new_interest, name='express-interest'), diff --git a/app/perftools/views.py b/app/perftools/views.py index 91ea44a218f..b2222daab88 100644 --- a/app/perftools/views.py +++ b/app/perftools/views.py @@ -1,3 +1,10 @@ from django.shortcuts import render +from django.views.decorators.cache import cache_page -# Create your views here. +from app.sitemaps import sitemaps + + +@cache_page(60 * 60 * 24 * 3) +def sitemap(request, section=None, template_name='sitemap.xml', mimetype='application/xml'): + from django.contrib.sitemaps.views import sitemap + return sitemap(request, sitemaps, section, template_name, mimetype) diff --git a/app/quests/helpers.py b/app/quests/helpers.py index 76c5b800596..042e523e261 100644 --- a/app/quests/helpers.py +++ b/app/quests/helpers.py @@ -51,7 +51,7 @@ def record_award_helper(qa, profile, layer=1, action='Beat', value_multiplier=1) return # record points - value = value_multiplier * qa.quest.value/(2**(layer-1)) + value = abs(value_multiplier * qa.quest.value/(2**(layer-1))) QuestPointAward.objects.create( questattempt=qa, profile=profile, From c1aa1c99841348e08efe7a3ad41161726367c57a Mon Sep 17 00:00:00 2001 From: Owocki Date: Mon, 21 Oct 2019 13:02:37 -0600 Subject: [PATCH 07/27] a few cached sitemap fixes --- app/app/urls.py | 2 +- app/perftools/views.py | 2 +- scripts/crontab | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/app/urls.py b/app/app/urls.py index 12ffb5c0ac6..4e1f4abad4c 100644 --- a/app/app/urls.py +++ b/app/app/urls.py @@ -543,7 +543,7 @@ # for robots url(r'^robots.txt/?', retail.views.robotstxt, name='robotstxt'), - url(r'^sitemap.xml/?', perftools.views.sitemap, name='sitemap'), + url(r'^sitemap.xml/?', perftools.views.sitemap, name='django.contrib.sitemaps.views.sitemap'), # Interests path('interest/modal', dashboard.views.get_interest_modal, name='get_interest_modal'), path('actions/bounty//interest/new/', dashboard.views.new_interest, name='express-interest'), diff --git a/app/perftools/views.py b/app/perftools/views.py index b2222daab88..d7dc16710d9 100644 --- a/app/perftools/views.py +++ b/app/perftools/views.py @@ -4,7 +4,7 @@ from app.sitemaps import sitemaps -@cache_page(60 * 60 * 24 * 3) +@cache_page(60 * 60 * 24) def sitemap(request, section=None, template_name='sitemap.xml', mimetype='application/xml'): from django.contrib.sitemaps.views import sitemap return sitemap(request, sitemaps, section, template_name, mimetype) diff --git a/scripts/crontab b/scripts/crontab index 7a15416ad94..e167d4fcbe1 100644 --- a/scripts/crontab +++ b/scripts/crontab @@ -72,6 +72,7 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/us 0 * * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash create_gas_history >> /var/log/gitcoin/create_gas_history.log 2>&1 5 */3 * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash create_page_cache >> /var/log/gitcoin/create_page_cache.log 2>&1 +1 * * * * curl https://gitcoin.co/sitemap.xml > /dev/null # warm sitemap cache ## INFRASTRUCTURE From 7ef08ee0c1876888709b43a15bd1bb0f137682ef Mon Sep 17 00:00:00 2001 From: Owocki Date: Mon, 21 Oct 2019 13:29:41 -0600 Subject: [PATCH 08/27] adds grants created to grants tab --- app/dashboard/models.py | 1 + .../profiles/tab_grant_contribs.html | 29 +++++++++++++++++-- app/dashboard/templates/profiles/tabs.html | 4 +-- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/app/dashboard/models.py b/app/dashboard/models.py index 86804763a64..5cce6df4b12 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -3544,6 +3544,7 @@ def to_dict(self): context['total_kudos_received_count'] = profile.received_kudos.count() context['total_grant_created'] = profile.grant_admin.count() context['total_grant_contributions'] = profile.grant_contributor.filter(subscription_contribution__success=True).values_list('subscription_contribution').count() + profile.grant_phantom_funding.count() + context['total_grant_actions'] = context['total_grant_created'] + context['total_grant_contributions'] context['total_tips_sent'] = profile.get_sent_tips.count() context['total_tips_received'] = profile.get_my_tips.count() diff --git a/app/dashboard/templates/profiles/tab_grant_contribs.html b/app/dashboard/templates/profiles/tab_grant_contribs.html index c8b8baf8280..c7065333d1d 100644 --- a/app/dashboard/templates/profiles/tab_grant_contribs.html +++ b/app/dashboard/templates/profiles/tab_grant_contribs.html @@ -22,16 +22,39 @@

{% trans "Grant Contribution History" %}

Monthly Summary

{% include "profiles/earningsgraph.html" with graph_type="grants" %} -

Transaction Detail

+

Grants Created ({{profile.grant_admin.count}})

+ {% if not profile.grant_admin.count %} +

+ No Grants Created. Create a Grant > +

+ {% endif %} + {% for transaction in profile.grant_admin.all %} +
+
+ {{ transaction.created_on|date:"Y-m-d" }} +
+
+ +
+ +
+ {% endfor %} +

Grant Contribution History ({{history|length}})

{% for transaction in history %}
-
+
{{ transaction.created_on }}
-
+
diff --git a/app/dashboard/templates/profiles/tabs.html b/app/dashboard/templates/profiles/tabs.html index f565413f8d2..f0094ad0540 100644 --- a/app/dashboard/templates/profiles/tabs.html +++ b/app/dashboard/templates/profiles/tabs.html @@ -53,11 +53,11 @@ {% endif %} - {% if total_grant_contributions %} + {% if total_grant_actions %} {% endif %} From 47b9d9e434bae2ec279342f7a46d1f4da2919422 Mon Sep 17 00:00:00 2001 From: Owocki Date: Mon, 21 Oct 2019 14:16:39 -0600 Subject: [PATCH 09/27] testing a new analytics tool: orbi --- app/retail/templates/shared/tag_manager_1.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/retail/templates/shared/tag_manager_1.html b/app/retail/templates/shared/tag_manager_1.html index 39a568f7d98..2c119277515 100644 --- a/app/retail/templates/shared/tag_manager_1.html +++ b/app/retail/templates/shared/tag_manager_1.html @@ -22,6 +22,12 @@ 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-WVPQHKX'); + + + + {% else %} +