Skip to content

Commit

Permalink
Merge pull request #186 from VishalMinj/main
Browse files Browse the repository at this point in the history
Feat: Added issue count in rank page
  • Loading branch information
meisabhishekpatel authored Oct 23, 2024
2 parents 2b47279 + eb5befe commit 8878b32
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
10 changes: 5 additions & 5 deletions user_profile/templates/user_profile/issue_card.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class='d-flex justify-content-center gap-3 mb-4 flex-wrap'>
<div class='d-flex justify-content-center gap-3 mb-4 ' style="height:15rem;">
<div class='px-5 py-3 fs-1 bg-white align-content-center' style='width: 200px; border-radius: 7px;'> <!-- Left column for total problems -->
<h5>Total Issues Solved:</h5>
<p>
Expand All @@ -9,16 +9,16 @@ <h5>Total Issues Solved:</h5>

<div class='d-flex flex-column p-3 bg-white' style='border-radius: 7px; height: 100%;'>
<div class="d-flex flex-column flex-grow-1 gap-1 ">
<div class="w-100 badge badge-pill flex-grow-1 align-content-center" style="background-color: #33b5e5; padding: .75rem 3rem;">
<div class="w-100 badge badge-pill flex-grow-1 align-content-center" style="background-color: #33b5e5; padding: .75rem 1.5rem;">
<div class="box fs-6">Very-easy Issue.: {{ veasyProblems }}</div>
</div>
<div class="w-100 badge badge-pill flex-grow-1 align-content-center" style="background-color: #00b74a; padding: .75rem 3rem;">
<div class="w-100 badge badge-pill flex-grow-1 align-content-center" style="background-color: #00b74a; padding: .75rem 1.5rem;">
<div class="box fs-6">Easy Issue: {{ easyProblems }}</div>
</div>
<div class="w-100 badge badge-pill flex-grow-1 align-content-center" style="background-color: #ffa900; padding: .75rem 3rem;">
<div class="w-100 badge badge-pill flex-grow-1 align-content-center" style="background-color: #ffa900; padding: .75rem 1.5rem;">
<div class="box fs-6">Medium Issue: {{ mediumProblems }}</div>
</div>
<div class="w-100 badge badge-pill flex-grow-1 align-content-center" style="background-color: #ff3547; padding: .75rem 3rem;">
<div class="w-100 badge badge-pill flex-grow-1 align-content-center" style="background-color: #ff3547; padding: .75rem 1.5rem;">
<div class="box fs-6">Hard Issue: {{ hardProblems }}</div>
</div>
</div>
Expand Down
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)

0 comments on commit 8878b32

Please sign in to comment.