Skip to content

Commit 73a3162

Browse files
committed
Merge branch 'stable'
2 parents 9c5b7cc + 94036cc commit 73a3162

11 files changed

Lines changed: 73 additions & 31 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 2.2.24 on 2021-10-02 01:56
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('dashboard', '0187_auto_20210928_0700'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='tribemember',
15+
name='status',
16+
field=models.CharField(blank=True, choices=[('accepted', 'accepted'), ('pending', 'pending'), ('rejected', 'rejected')], db_index=True, max_length=20),
17+
),
18+
]

app/dashboard/models.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4098,7 +4098,7 @@ def get_fulfilled_bounties(self, network=None):
40984098
def get_orgs_bounties(self, network=None):
40994099
network = network or self.get_network()
41004100
url = f"https://github.com/{self.handle}"
4101-
bounties = Bounty.objects.current().filter(network=network, github_url__istartswith=url)
4101+
bounties = Bounty.objects.current().filter(network=network, github_url__istartswith=url).cache()
41024102
return bounties
41034103

41044104
def get_leaderboard_index(self, key='weekly_earners'):
@@ -5555,7 +5555,8 @@ class TribeMember(SuperModel):
55555555
status = models.CharField(
55565556
max_length=20,
55575557
choices=MEMBER_STATUS,
5558-
blank=True
5558+
blank=True,
5559+
db_index=True
55595560
)
55605561
why = models.CharField(
55615562
max_length=20,

app/dashboard/views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2268,8 +2268,9 @@ def profile_activity(request, handle):
22682268
except (ProfileNotFoundException, ProfileHiddenException):
22692269
raise Http404
22702270

2271+
date = timezone.now() - timezone.timedelta(days=365)
22712272
activities = list(profile.get_various_activities().values_list('created_on', flat=True))
2272-
activities += list(profile.actions.values_list('created_on', flat=True))
2273+
activities += list(profile.actions.filter(created_on__gt=date).values_list('created_on', flat=True))
22732274
response = {}
22742275
prev_date = timezone.now()
22752276
for i in range(1, 12*30):

app/grants/views.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,15 +1329,14 @@ def grant_details(request, grant_id, grant_slug):
13291329
profile = get_profile(request)
13301330
add_cancel_params = False
13311331

1332-
13331332
try:
13341333
grant = None
13351334
try:
1336-
grant = Grant.objects.prefetch_related('subscriptions','team_members').get(
1335+
grant = Grant.objects.prefetch_related('team_members').get(
13371336
pk=grant_id, slug=grant_slug
13381337
)
13391338
except Grant.DoesNotExist:
1340-
grant = Grant.objects.prefetch_related('subscriptions','team_members').get(
1339+
grant = Grant.objects.prefetch_related('team_members').get(
13411340
pk=grant_id
13421341
)
13431342

@@ -1372,8 +1371,8 @@ def grant_details(request, grant_id, grant_slug):
13721371
# phantom_funds = grant.phantom_funding.all().cache(timeout=60)
13731372
# contributors = list(_contributions.distinct('subscription__contributor_profile')) + list(phantom_funds.distinct('profile'))
13741373
# activity_count = len(cancelled_subscriptions) + len(contributions)
1375-
user_subscription = grant.subscriptions.filter(contributor_profile=profile, active=True).first()
1376-
user_non_errored_subscription = grant.subscriptions.filter(contributor_profile=profile, active=True, error=False).first()
1374+
user_subscription = None
1375+
user_non_errored_subscription = None
13771376
add_cancel_params = user_subscription
13781377
except Grant.DoesNotExist:
13791378
raise Http404
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Generated by Django 2.2.24 on 2021-10-02 03:13
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('kudos', '0020_auto_20210924_0616'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='token',
15+
name='hidden',
16+
field=models.BooleanField(db_index=True, default=False, help_text='Hide from marketplace?'),
17+
),
18+
migrations.AlterField(
19+
model_name='token',
20+
name='num_clones_allowed',
21+
field=models.IntegerField(blank=True, db_index=True, null=True),
22+
),
23+
]

app/kudos/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class Meta:
103103

104104
# Kudos Struct (also in contract)
105105
price_finney = models.IntegerField()
106-
num_clones_allowed = models.IntegerField(null=True, blank=True)
106+
num_clones_allowed = models.IntegerField(null=True, blank=True, db_index=True)
107107
num_clones_in_wild = models.IntegerField(null=True, blank=True)
108108
num_clones_available_counting_indirect_send = models.IntegerField(blank=True, default=0)
109109

@@ -133,7 +133,7 @@ class Meta:
133133
contract = models.ForeignKey(
134134
'kudos.Contract', related_name='kudos_contract', on_delete=models.SET_NULL, null=True
135135
)
136-
hidden = models.BooleanField(default=False, help_text=('Hide from marketplace?'))
136+
hidden = models.BooleanField(default=False, help_text=('Hide from marketplace?'), db_index=True)
137137
hidden_token_details_page = models.BooleanField(default=False, help_text=('Hide token details page'))
138138
send_enabled_for_non_gitcoin_admins = models.BooleanField(default=True)
139139
preview_img_mode = models.CharField(max_length=255, default='png')

app/quests/views.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ def editquest(request, pk=None):
219219

220220

221221
def get_package_helper(quest_qs, request):
222-
return [(ele.is_unlocked_for(request.user), ele.is_beaten(request.user), ele.is_within_cooldown_period(request.user), ele) for ele in quest_qs]
222+
#return [(ele.is_unlocked_for(request.user), ele.is_beaten(request.user), ele.is_within_cooldown_period(request.user), ele) for ele in quest_qs]
223+
success = request.user.profile.quest_attempts.filter(success=True).values_list('quest', flat=True) if request.user.is_authenticated else []
224+
return [(True, ele.pk in success, False, ele) for ele in quest_qs]
223225

224226

225227
def index(request):
@@ -319,27 +321,27 @@ def index(request):
319321
point_value = sum(point_history.values_list('value', flat=True))
320322
print(f" phase4 at {round(time.time(),2)} ")
321323

322-
quests_attempts_per_day = (abs(round(QuestAttempt.objects.count() /
323-
(QuestAttempt.objects.first().created_on - timezone.now()).days, 1))
324-
if QuestAttempt.objects.count() else 0)
324+
quests_attempts_per_day = (abs(round(QuestAttempt.objects.cache().count() /
325+
(QuestAttempt.objects.cache().first().created_on - timezone.now()).days, 1))
326+
if QuestAttempt.objects.cache().count() else 0)
325327
success_ratio = int(success_count / attempt_count * 100) if attempt_count else 0
326328
# community_created
327329
params = {
328330
'profile': request.user.profile if request.user.is_authenticated else None,
329331
'quests': quests,
330332
'avg_play_count': round(QuestAttempt.objects.count()/(Quest.objects.count() or 1), 1),
331333
'quests_attempts_total': QuestAttempt.objects.count(),
332-
'quests_total': Quest.objects.filter(visible=True).count(),
334+
'quests_total': Quest.objects.cache().filter(visible=True).count(),
333335
'quests_attempts_per_day': quests_attempts_per_day,
334-
'total_visible_quest_count': Quest.objects.filter(visible=True).count(),
335-
'gitcoin_created': Quest.objects.filter(visible=True).filter(creator=Profile.objects.filter(handle='gitcoinbot').first()).count(),
336-
'community_created': Quest.objects.filter(visible=True).exclude(creator=Profile.objects.filter(handle='gitcoinbot').first()).count(),
336+
'total_visible_quest_count': Quest.objects.cache().filter(visible=True).count(),
337+
'gitcoin_created': Quest.objects.cache().filter(visible=True).filter(creator=Profile.objects.filter(handle='gitcoinbot').first()).count(),
338+
'community_created': Quest.objects.cache().filter(visible=True).exclude(creator=Profile.objects.filter(handle='gitcoinbot').first()).count(),
337339
'country_count': 87,
338-
'email_count': EmailSubscriber.objects.count(),
340+
'email_count': EmailSubscriber.objects.cache().count(),
339341
'attempt_count': attempt_count,
340342
'success_count': success_count,
341343
'success_ratio': success_ratio,
342-
'user_count': QuestAttempt.objects.distinct('profile').count(),
344+
'user_count': QuestAttempt.objects.cache().distinct('profile').count(),
343345
'leaderboard': leaderboard,
344346
'REFER_LINK': f'https://gitcoin.co/quests/?cb=ref:{request.user.profile.ref_code}' if request.user.is_authenticated else None,
345347
'rewards_schedule': rewards_schedule,

app/retail/templates/mission.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,12 @@ <h4>EthCC 2021 - DoingGud</h4>
205205
<br>
206206

207207

208+
<h4>Bankless 2021 - Layer 0 Interview with Kevin Owocki</h4>
209+
<iframe class="mw-100" width="650" height="350" src="https://www.youtube.com/embed/1uSggnVnAvk" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
210+
<br>
211+
<br>
212+
213+
208214

209215

210216
</div>

app/retail/templates/shared/activity.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,6 @@
4747
{% endfor %}
4848
</div>
4949
{% endif %}
50-
{% if row.profile.data.type == 'Organization'%}
51-
{% if row.profile.handle not in my_tribes|join:"," %}
52-
<div style="text-align:center">
53-
<a href=# class="align-middle btn btn-outline-primary btn-sm mt-2 font-smaller-7" onclick="joinTribeDirect(this);" data-jointribe='{{row.profile.handle}}'>follow</a>
54-
</div>
55-
{% endif %}
56-
{% endif %}
5750
</div>
5851
</div>
5952
<div class="col-10 col-sm-7 pl-3 activity_detail">

app/retail/views.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ def results(request, keyword=None):
741741

742742
def get_specific_activities(what, trending_only, user, after_pk, request=None):
743743
# create diff filters
744-
activities = Activity.objects.filter(hidden=False).order_by('-created_on').exclude(pin__what__iexact=what)
744+
activities = Activity.objects.filter(hidden=False).order_by('-created_on')
745745

746746
network = 'rinkeby' if settings.DEBUG else 'mainnet'
747747
filter_network = 'rinkeby' if network == 'mainnet' else 'mainnet'
@@ -849,8 +849,7 @@ def get_specific_activities(what, trending_only, user, after_pk, request=None):
849849
view_count_threshold = 40
850850
activities = activities.filter(view_count__gt=view_count_threshold)
851851

852-
activities = activities.filter().exclude(pin__what=what)
853-
852+
activities = activities
854853
return activities
855854

856855

@@ -893,7 +892,6 @@ def activity(request):
893892
'target': f'/activity?what={what}&trending_only={trending_only}&page={next_page}',
894893
'title': _('Activity Feed'),
895894
'TOKENS': request.user.profile.token_approvals.all() if request.user.is_authenticated and request.user.profile else [],
896-
'my_tribes': list(request.user.profile.tribe_members.values_list('org__handle',flat=True)) if request.user.is_authenticated else [],
897895
}
898896
context["activities"] = [a.view_props_for(request.user) for a in page]
899897

0 commit comments

Comments
 (0)