Skip to content

Commit

Permalink
Feat: Added issue count in rank page
Browse files Browse the repository at this point in the history
  • Loading branch information
VishalMinj committed Oct 21, 2024
1 parent 5f392cf commit ce47868
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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
4 changes: 3 additions & 1 deletion user_profile/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,10 @@ 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)

0 comments on commit ce47868

Please sign in to comment.