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

Feat: Added issue count in rank page #186

Merged
merged 5 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
5 changes: 4 additions & 1 deletion user_profile/templates/user_profile/rankings.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,18 @@
<tr>
<th>Rank</th>
<th>Username</th>
<th>Issues Resolved</th>
<th>Total Points</th>
<th>Bonus Points</th>
<th>Deducted Points</th>
</tr>
{% for contributor in contributors %}
{% for contributor,issues_resolved in contributors %}
{% if contributor.total_points > 0 %}
<tr>
<td><b>{{ forloop.counter }}</b></td>
<td><b>@{{ contributor.user.username }}</b></td>
<td><b class='badge bg-light text-dark'>{{ issues_resolved }}</b></td>

<td>
<span class="badge badge-pill badge-primary">
{{ contributor.total_points }}
Expand Down
6 changes: 5 additions & 1 deletion user_profile/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,12 @@ def edit_profile(request):
@login_required
def rankings(request):
contributors = UserProfile.objects.filter(role=UserProfile.STUDENT).order_by('-total_points')
issues_resolved = [
PullRequest.objects.filter(contributor=contributor.user, state=1).count() for contributor in contributors
]
contributors = zip(contributors, issues_resolved)
context = {
'contributors': contributors,
'contributors': list(contributors),
}
# TODO:ISSUE: Display number of Issues solved as well in the Rankings
return render(request, 'user_profile/rankings.html', context=context)
Loading