Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix repeated rating cards on profile after rated and reload #5101

Merged
merged 4 commits into from
Aug 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def has_applicant(self):
activities__activity_type='worker_applied',
activities__needs_review=False,
)

def warned(self):
"""Filter results by bounties that have been warned for inactivity."""
return self.prefetch_related('activities') \
Expand Down Expand Up @@ -442,7 +442,7 @@ def get_natural_value(self):
@property
def no_of_applicants(self):
return self.interested.count()

@property
def has_applicant(self):
"""Filter results by bounties that have applicants."""
Expand All @@ -451,7 +451,7 @@ def has_applicant(self):
activities__activity_type='worker_applied',
activities__needs_review=False,
)

@property
def warned(self):
"""Filter results by bounties that have been warned for inactivity."""
Expand All @@ -460,7 +460,7 @@ def warned(self):
activities__activity_type='bounty_abandonment_warning',
activities__needs_review=True,
)

@property
def escalated(self):
"""Filter results by bounties that have been escalated for review."""
Expand Down Expand Up @@ -1847,7 +1847,6 @@ def view_props(self):
for fk in ['bounty', 'tip', 'kudos', 'profile']:
if getattr(self, fk):
activity[fk] = getattr(self, fk).to_standard_dict(properties=properties)
print(activity['kudos'])
activity['secondary_avatar_url'] = self.secondary_avatar_url
# KO notes 2019/01/30
# this is a bunch of bespoke information that is computed for the views
Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/templates/shared/profile_kudos.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
{% endcomment %}
{% load i18n staticfiles kudos_extras %}
{% load i18n static kudos_extras %}

<ul class="nav nav-tabs my-5" id="myTab" role="tablist">
<li class="nav-item">
Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/templates/shared/rate_bounties.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
{% endcomment %}
{% load i18n staticfiles %}
{% load i18n static %}
<div class="container">
{% if unrated_contributed_bounties|length > 0 or unrated_funded_bounties|length > 0 %}
<ul class="nav nav-tabs border-0" id="ratingTabs" role="tablist">
Expand Down
32 changes: 12 additions & 20 deletions app/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,23 +334,18 @@ def post_comment(request):
'msg': '',
})

# sbid = request.POST.get('standard_bounties_id')
bounty_id = request.POST.get('bounty_id')
# bountyObj = Bounty.objects.filter(standard_bounties_id=sbid).first()
bountyObj = Bounty.objects.get(pk=bounty_id)
# fbAmount = FeedbackEntry.objects.filter(
# sender_profile=profile_id,
# feedbackType=request.POST.get('review[reviewType]', 'approver'),
# bounty=bountyObj
# ).count()
# if fbAmount > 0:
# return JsonResponse({
# 'success': False,
# 'msg': 'There is already a approval comment',
# })
# if request.POST.get('review[reviewType]') == 'worker':
# receiver_profile = bountyObj.bounty_owner_github_username
# else:
fbAmount = FeedbackEntry.objects.filter(
sender_profile=profile_id,
bounty=bountyObj
).count()
if fbAmount > 0:
return JsonResponse({
'success': False,
'msg': 'There is already a approval comment',
})

receiver_profile = Profile.objects.filter(handle=request.POST.get('review[receiver]')).first()
kwargs = {
'bounty': bountyObj,
Expand Down Expand Up @@ -938,9 +933,6 @@ def get_user_bounties(request):
bounty_json['url'] = bounty.url

results.append(bounty_json)
# else:
# raise Http404
print(open_bounties)
params['data'] = json.loads(json.dumps(results, default=str))
params['is_funder'] = is_funder
return JsonResponse(params, status=200, safe=False)
Expand Down Expand Up @@ -2083,15 +2075,15 @@ def profile(request, handle):
).exclude(
feedbacks__feedbackType='approver',
feedbacks__sender_profile=profile,
).distinct('pk')
).distinct('pk').nocache()

context['unrated_contributed_bounties'] = Bounty.objects.current().prefetch_related('feedbacks').filter(interested__profile=profile, network=network,) \
.filter(interested__status='okay') \
.filter(interested__pending=False).filter(idx_status='done') \
.exclude(
feedbacks__feedbackType='worker',
feedbacks__sender_profile=profile
).distinct('pk')
).distinct('pk').nocache()

currently_working_bounties = Bounty.objects.current().filter(interested__profile=profile).filter(interested__status='okay') \
.filter(interested__pending=False).filter(idx_status__in=Bounty.WORK_IN_PROGRESS_STATUSES)
Expand Down
2 changes: 1 addition & 1 deletion app/kudos/templates/shared/kudos_card.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
{% endcomment %}
{% load i18n staticfiles %}
{% load i18n static %}
{% load kudos_extras matches %}
<div class="kd-card {% if listing.num_clones_available == 0 %}ghost{% endif %}">
<a href="{% url 'kudos_details' listing.id listing.name %}" class="{% if 'cellarius' in listing.tags %}cellarius-partner{% endif %}">
Expand Down
3 changes: 1 addition & 2 deletions app/retail/templates/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
along with this program. If not,see
<http://www.gnu.org/licenses/>.
{% endcomment %}
{% load staticfiles %}
{% load humanize i18n static %}
{% load kudos_extras %}

Expand Down Expand Up @@ -418,4 +417,4 @@ <h2 class="text-center">{% trans "Browse More Results, By Programming Language"
</body>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script src="{% static "v2/js/pages/results.js" %}"></script>
</html>
</html>