diff --git a/src/accounts/templates/accounts/profile.html b/src/accounts/templates/accounts/profile.html
index c0609b4..ae13d56 100644
--- a/src/accounts/templates/accounts/profile.html
+++ b/src/accounts/templates/accounts/profile.html
@@ -4,32 +4,6 @@
{% load key_value %}
-
Challenges Solved by {{ user.username }}
{% if solves%}
@@ -68,6 +42,7 @@
- {{ user.username }}
- {% trans "Score" %} : {{ user.userprofileinfo.score }}
+ - {% trans "Rank" %} : {{ rank }}
{% if user.userprofileinfo.portfolio_site %}
-
diff --git a/src/accounts/views/views.py b/src/accounts/views/views.py
index af6cde5..4430c15 100644
--- a/src/accounts/views/views.py
+++ b/src/accounts/views/views.py
@@ -116,6 +116,8 @@ def profile(request, user_name):
catsDatas = []
user_obj = get_object_or_404(User, username=user_name)
+ all_users = list(UserProfileInfo.objects.select_related().order_by('-score', 'last_submission_date', 'user__username'))
+ rank = all_users.index(get_object_or_404(UserProfileInfo, user=user_obj)) + 1
cats = Category.objects.all()
pointDatas = {}
@@ -141,7 +143,8 @@ def profile(request, user_name):
for s in solves.reverse():
somme += s.ctf.points
solved.append([s.flag_date.timestamp() * 1000,somme])
- return render(request,'accounts/profile.html', {'user':user_obj, 'solves':solves,'solved':solved,'catsDatas': catsDatas, 'pointDatas': pointDatas})
+
+ return render(request,'accounts/profile.html', {'user':user_obj, 'solves':solves,'solved':solved,'catsDatas': catsDatas, 'pointDatas': pointDatas, 'rank': rank})
def rank(request, token):
all_users = UserProfileInfo.objects.filter(score__gt=0).select_related().order_by('-score', 'last_submission_date', 'user__username')