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 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
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)
Loading