diff --git a/src/scoreboard/templates/scoreboard/scoreboard.html b/src/scoreboard/templates/scoreboard/scoreboard.html
index c00c8d1..ff3064f 100644
--- a/src/scoreboard/templates/scoreboard/scoreboard.html
+++ b/src/scoreboard/templates/scoreboard/scoreboard.html
@@ -12,6 +12,7 @@
{% trans "Rank" %} |
{% trans "Username" %} |
{% trans "Website" %} |
+ {% trans "Campus" %} |
{% trans "Score" %} |
@@ -26,6 +27,12 @@
{{ s.user.userprofileinfo.portfolio_site }}
{% endif %}
+
+ {% if s.user.userprofileinfo.intra42_campus %}
+
+ {{ s.user.userprofileinfo.intra42_campus }}
+
+ {% endif %}
| {{ s.user.userprofileinfo.score }} |
{% endfor %}
diff --git a/src/scoreboard/urls.py b/src/scoreboard/urls.py
index ee31136..5f95344 100644
--- a/src/scoreboard/urls.py
+++ b/src/scoreboard/urls.py
@@ -4,5 +4,6 @@ from . import views
app_name = "scoreboard"
urlpatterns = [
- path('', views.scoreboard, name='scoreboard')
+ path('', views.scoreboard, name='scoreboard'),
+ path('campus/', views.campus, name='campus')
]
diff --git a/src/scoreboard/views.py b/src/scoreboard/views.py
index edeb925..1aeb356 100644
--- a/src/scoreboard/views.py
+++ b/src/scoreboard/views.py
@@ -8,5 +8,12 @@ def scoreboard(request):
page = request.GET.get('page')
scores_p = paginator.get_page(page)
return render(request, 'scoreboard/scoreboard.html', {'scores':scores_p})
-
+
+def campus(request, campus):
+ scores = UserProfileInfo.objects.filter(score__gt=0, intra42_campus__exact=campus).select_related().order_by('-score', 'last_submission_date', 'user__username')
+ paginator = Paginator(scores, 20)
+ page = request.GET.get('page')
+ scores_p = paginator.get_page(page)
+ return render(request, 'scoreboard/scoreboard.html', {'scores':scores_p})
+
# Create your views here.