Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
  • Loading branch information
chibie committed Oct 4, 2021
2 parents 9c5b7cc + 94036cc commit 73a3162
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 31 deletions.
18 changes: 18 additions & 0 deletions app/dashboard/migrations/0188_auto_20211002_0156.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.24 on 2021-10-02 01:56

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('dashboard', '0187_auto_20210928_0700'),
]

operations = [
migrations.AlterField(
model_name='tribemember',
name='status',
field=models.CharField(blank=True, choices=[('accepted', 'accepted'), ('pending', 'pending'), ('rejected', 'rejected')], db_index=True, max_length=20),
),
]
5 changes: 3 additions & 2 deletions app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4098,7 +4098,7 @@ def get_fulfilled_bounties(self, network=None):
def get_orgs_bounties(self, network=None):
network = network or self.get_network()
url = f"https://github.com/{self.handle}"
bounties = Bounty.objects.current().filter(network=network, github_url__istartswith=url)
bounties = Bounty.objects.current().filter(network=network, github_url__istartswith=url).cache()
return bounties

def get_leaderboard_index(self, key='weekly_earners'):
Expand Down Expand Up @@ -5555,7 +5555,8 @@ class TribeMember(SuperModel):
status = models.CharField(
max_length=20,
choices=MEMBER_STATUS,
blank=True
blank=True,
db_index=True
)
why = models.CharField(
max_length=20,
Expand Down
3 changes: 2 additions & 1 deletion app/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2268,8 +2268,9 @@ def profile_activity(request, handle):
except (ProfileNotFoundException, ProfileHiddenException):
raise Http404

date = timezone.now() - timezone.timedelta(days=365)
activities = list(profile.get_various_activities().values_list('created_on', flat=True))
activities += list(profile.actions.values_list('created_on', flat=True))
activities += list(profile.actions.filter(created_on__gt=date).values_list('created_on', flat=True))
response = {}
prev_date = timezone.now()
for i in range(1, 12*30):
Expand Down
9 changes: 4 additions & 5 deletions app/grants/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1329,15 +1329,14 @@ def grant_details(request, grant_id, grant_slug):
profile = get_profile(request)
add_cancel_params = False


try:
grant = None
try:
grant = Grant.objects.prefetch_related('subscriptions','team_members').get(
grant = Grant.objects.prefetch_related('team_members').get(
pk=grant_id, slug=grant_slug
)
except Grant.DoesNotExist:
grant = Grant.objects.prefetch_related('subscriptions','team_members').get(
grant = Grant.objects.prefetch_related('team_members').get(
pk=grant_id
)

Expand Down Expand Up @@ -1372,8 +1371,8 @@ def grant_details(request, grant_id, grant_slug):
# phantom_funds = grant.phantom_funding.all().cache(timeout=60)
# contributors = list(_contributions.distinct('subscription__contributor_profile')) + list(phantom_funds.distinct('profile'))
# activity_count = len(cancelled_subscriptions) + len(contributions)
user_subscription = grant.subscriptions.filter(contributor_profile=profile, active=True).first()
user_non_errored_subscription = grant.subscriptions.filter(contributor_profile=profile, active=True, error=False).first()
user_subscription = None
user_non_errored_subscription = None
add_cancel_params = user_subscription
except Grant.DoesNotExist:
raise Http404
Expand Down
23 changes: 23 additions & 0 deletions app/kudos/migrations/0021_auto_20211002_0313.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 2.2.24 on 2021-10-02 03:13

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('kudos', '0020_auto_20210924_0616'),
]

operations = [
migrations.AlterField(
model_name='token',
name='hidden',
field=models.BooleanField(db_index=True, default=False, help_text='Hide from marketplace?'),
),
migrations.AlterField(
model_name='token',
name='num_clones_allowed',
field=models.IntegerField(blank=True, db_index=True, null=True),
),
]
4 changes: 2 additions & 2 deletions app/kudos/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class Meta:

# Kudos Struct (also in contract)
price_finney = models.IntegerField()
num_clones_allowed = models.IntegerField(null=True, blank=True)
num_clones_allowed = models.IntegerField(null=True, blank=True, db_index=True)
num_clones_in_wild = models.IntegerField(null=True, blank=True)
num_clones_available_counting_indirect_send = models.IntegerField(blank=True, default=0)

Expand Down Expand Up @@ -133,7 +133,7 @@ class Meta:
contract = models.ForeignKey(
'kudos.Contract', related_name='kudos_contract', on_delete=models.SET_NULL, null=True
)
hidden = models.BooleanField(default=False, help_text=('Hide from marketplace?'))
hidden = models.BooleanField(default=False, help_text=('Hide from marketplace?'), db_index=True)
hidden_token_details_page = models.BooleanField(default=False, help_text=('Hide token details page'))
send_enabled_for_non_gitcoin_admins = models.BooleanField(default=True)
preview_img_mode = models.CharField(max_length=255, default='png')
Expand Down
22 changes: 12 additions & 10 deletions app/quests/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ def editquest(request, pk=None):


def get_package_helper(quest_qs, request):
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]
#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]
success = request.user.profile.quest_attempts.filter(success=True).values_list('quest', flat=True) if request.user.is_authenticated else []
return [(True, ele.pk in success, False, ele) for ele in quest_qs]


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

quests_attempts_per_day = (abs(round(QuestAttempt.objects.count() /
(QuestAttempt.objects.first().created_on - timezone.now()).days, 1))
if QuestAttempt.objects.count() else 0)
quests_attempts_per_day = (abs(round(QuestAttempt.objects.cache().count() /
(QuestAttempt.objects.cache().first().created_on - timezone.now()).days, 1))
if QuestAttempt.objects.cache().count() else 0)
success_ratio = int(success_count / attempt_count * 100) if attempt_count else 0
# community_created
params = {
'profile': request.user.profile if request.user.is_authenticated else None,
'quests': quests,
'avg_play_count': round(QuestAttempt.objects.count()/(Quest.objects.count() or 1), 1),
'quests_attempts_total': QuestAttempt.objects.count(),
'quests_total': Quest.objects.filter(visible=True).count(),
'quests_total': Quest.objects.cache().filter(visible=True).count(),
'quests_attempts_per_day': quests_attempts_per_day,
'total_visible_quest_count': Quest.objects.filter(visible=True).count(),
'gitcoin_created': Quest.objects.filter(visible=True).filter(creator=Profile.objects.filter(handle='gitcoinbot').first()).count(),
'community_created': Quest.objects.filter(visible=True).exclude(creator=Profile.objects.filter(handle='gitcoinbot').first()).count(),
'total_visible_quest_count': Quest.objects.cache().filter(visible=True).count(),
'gitcoin_created': Quest.objects.cache().filter(visible=True).filter(creator=Profile.objects.filter(handle='gitcoinbot').first()).count(),
'community_created': Quest.objects.cache().filter(visible=True).exclude(creator=Profile.objects.filter(handle='gitcoinbot').first()).count(),
'country_count': 87,
'email_count': EmailSubscriber.objects.count(),
'email_count': EmailSubscriber.objects.cache().count(),
'attempt_count': attempt_count,
'success_count': success_count,
'success_ratio': success_ratio,
'user_count': QuestAttempt.objects.distinct('profile').count(),
'user_count': QuestAttempt.objects.cache().distinct('profile').count(),
'leaderboard': leaderboard,
'REFER_LINK': f'https://gitcoin.co/quests/?cb=ref:{request.user.profile.ref_code}' if request.user.is_authenticated else None,
'rewards_schedule': rewards_schedule,
Expand Down
6 changes: 6 additions & 0 deletions app/retail/templates/mission.html
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ <h4>EthCC 2021 - DoingGud</h4>
<br>


<h4>Bankless 2021 - Layer 0 Interview with Kevin Owocki</h4>
<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>
<br>
<br>




</div>
Expand Down
7 changes: 0 additions & 7 deletions app/retail/templates/shared/activity.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@
{% endfor %}
</div>
{% endif %}
{% if row.profile.data.type == 'Organization'%}
{% if row.profile.handle not in my_tribes|join:"," %}
<div style="text-align:center">
<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>
</div>
{% endif %}
{% endif %}
</div>
</div>
<div class="col-10 col-sm-7 pl-3 activity_detail">
Expand Down
6 changes: 2 additions & 4 deletions app/retail/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ def results(request, keyword=None):

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

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

activities = activities.filter().exclude(pin__what=what)

activities = activities
return activities


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

Expand Down
1 change: 1 addition & 0 deletions app/townsquare/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ def ignored_suggested_tribe(request, tribeId):


def get_suggested_tribes(request):
return []
following_tribes = []
tribe_limit = 5

Expand Down

0 comments on commit 73a3162

Please sign in to comment.