Easy Issue: {{ easyProblems }}
+
Medium Issue: {{ mediumProblems }}
-
+
Hard Issue: {{ hardProblems }}
diff --git a/user_profile/templates/user_profile/rankings.html b/user_profile/templates/user_profile/rankings.html
index 12fcad1..e3a2dd4 100644
--- a/user_profile/templates/user_profile/rankings.html
+++ b/user_profile/templates/user_profile/rankings.html
@@ -19,15 +19,18 @@
Rank |
Username |
+ Issues Resolved |
Total Points |
Bonus Points |
Deducted Points |
- {% for contributor in contributors %}
+ {% for contributor,issues_resolved in contributors %}
{% if contributor.total_points > 0 %}
{{ forloop.counter }} |
@{{ contributor.user.username }} |
+ {{ issues_resolved }} |
+
{{ contributor.total_points }}
diff --git a/user_profile/views.py b/user_profile/views.py
index c2bde0b..5be4157 100644
--- a/user_profile/views.py
+++ b/user_profile/views.py
@@ -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)
|