Skip to content

Commit

Permalink
[FEATURE] Enables users to view highscores with all class members (he…
Browse files Browse the repository at this point in the history
…dyorg#3640)

**Description**
In this PR we change the design of the highscores slightly. Currently users are only able to view the highscores of users with a public profile. However, in the case of a class some users might not have a public profile while it is still fun to compare the amount of achievements.  We solve this by retrieving achievements of all users when a user visits the class highscores.

**Fixes**
This PR fixes hedyorg#3638

**How to test**
Make sure you are in a class with users that all have achievements but some might not have a public profile. Verify that these users are still visible when filtering the highscores on class.
  • Loading branch information
TiBiBa authored Nov 15, 2022
1 parent 3c5e861 commit f1175a0
Show file tree
Hide file tree
Showing 40 changed files with 1,133 additions and 1,579 deletions.
28 changes: 14 additions & 14 deletions messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2022-10-25 20:54-0400\n"
"POT-Creation-Date: 2022-11-14 09:21+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.10.3\n"
"Generated-By: Babel 2.10.1\n"

msgid "program_contains_error"
msgstr ""
Expand Down Expand Up @@ -587,6 +587,9 @@ msgstr ""
msgid "mandatory_mode"
msgstr ""

msgid "all_class_highscores"
msgstr ""

msgid "hide_cheatsheet"
msgstr ""

Expand Down Expand Up @@ -632,6 +635,9 @@ msgstr ""
msgid "hedy_choice_title"
msgstr ""

msgid "number_lines"
msgstr ""

msgid "creator"
msgstr ""

Expand All @@ -641,9 +647,6 @@ msgstr ""
msgid "report_program"
msgstr ""

msgid "number_lines"
msgstr ""

msgid "my_classes"
msgstr ""

Expand Down Expand Up @@ -719,6 +722,9 @@ msgstr ""
msgid "example_code_header"
msgstr ""

msgid "search"
msgstr ""

msgid "variables"
msgstr ""

Expand Down Expand Up @@ -797,9 +803,6 @@ msgstr ""
msgid "login"
msgstr ""

msgid "search"
msgstr ""

msgid "keyword_support"
msgstr ""

Expand Down Expand Up @@ -1358,9 +1361,6 @@ msgstr ""
msgid "teacher_account_success"
msgstr ""

msgid "only_teacher_create_class"
msgstr ""

msgid "class_name_invalid"
msgstr ""

Expand All @@ -1379,9 +1379,6 @@ msgstr ""
msgid "title_join-class"
msgstr ""

msgid "retrieve_class_error"
msgstr ""

msgid "username_empty"
msgstr ""

Expand All @@ -1394,6 +1391,9 @@ msgstr ""
msgid "student_already_invite"
msgstr ""

msgid "retrieve_class_error"
msgstr ""

msgid "title_class-overview"
msgstr ""

Expand Down
6 changes: 6 additions & 0 deletions templates/customize-class.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ <h3 class="px-4">{{_('other_settings')}}</h3>
<input class="other_settings_checkbox" id="developers_mode" type="checkbox" {% if "developers_mode" in customizations['other_settings'] %}checked{% endif %}>
</td>
</tr>
<tr>
<td class="text-left border-t border-r border-gray-400">{{_('all_class_highscores')}}</td>
<td class="border-t border-gray-400">
<input class="other_settings_checkbox" id="all_highscores" type="checkbox" {% if "all_highscores" in customizations['other_settings'] %}checked{% endif %}>
</td>
</tr>
<tr>
<td class="text-left border-t border-r border-gray-400">{{_('hide_cheatsheet')}}</td>
<td class="border-t border-gray-400">
Expand Down
16 changes: 14 additions & 2 deletions templates/highscores.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,22 @@ <h1 class="text-center mt-4">{{_('highscores')}}</h1>
{% for highscore in highscores %}
<tr>
<td class="font-bold border-r border-gray-500 text-center">{{ highscore.ranking }}.</td>
<td class="px-2"><a href="/user/{{highscore.username}}">{{highscore.username[0]|upper}}{{highscore.username[1:]}}</a></td>
<td class="px-2">
{% if not highscore.no_public_profile %}
<a href="/user/{{highscore.username}}">{{highscore.username[0]|upper}}{{highscore.username[1:]}}</a>
{% else %}
{{highscore.username[0]|upper}}{{highscore.username[1:]}}
{% endif %}
</td>
<td class="px-2">{{highscore.achievements}}</td>
<td class="px-2">{{get_country(highscore.country)}}</td>
<td class="px-2">{{_('ago')|replace("{timestamp}", highscore.last_achievement)}}</td>
<td class="px-2">
{% if not highscore.no_public_profile %}
{{_('ago')|replace("{timestamp}", highscore.last_achievement)}}
{% else %}
-
{% endif %}
</td>
</tr>
{% endfor %}
</table>
Expand Down
41 changes: 22 additions & 19 deletions translations/ar/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@

msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-10-25 20:54-0400\n"
"POT-Creation-Date: 2022-11-14 09:21+0100\n"
"PO-Revision-Date: 2022-10-26 14:14+0000\n"
"Last-Translator: Anonymous <[email protected]>\n"
"Language-Team: ar <[email protected]>\n"
"Language: ar\n"
"Language-Team: ar <[email protected]>\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
"X-Generator: Weblate 4.14.2-dev\n"
"Generated-By: Babel 2.10.3\n"
"Generated-By: Babel 2.10.1\n"

msgid "program_contains_error"
msgstr "هذا البرنامج يحتوي على خطأ، هل أنت متأكد من أنك تريد مشاركة البرنامج؟"
Expand Down Expand Up @@ -631,6 +630,9 @@ msgstr "اعدادات أخرى"
msgid "mandatory_mode"
msgstr "وضع المبرمج الإلزامي"

msgid "all_class_highscores"
msgstr ""

msgid "hide_cheatsheet"
msgstr "اخفاء ورقة الغش"

Expand Down Expand Up @@ -678,6 +680,10 @@ msgstr "البحث"
msgid "hedy_choice_title"
msgstr "اختيار هيدي"

#, fuzzy
msgid "number_lines"
msgstr "Number of lines"

msgid "creator"
msgstr "مبتكر"

Expand All @@ -688,10 +694,6 @@ msgstr "عرض البرنامج"
msgid "report_program"
msgstr "Are you sure you want to report this program?"

#, fuzzy
msgid "number_lines"
msgstr "Number of lines"

msgid "my_classes"
msgstr "صفوفي"

Expand Down Expand Up @@ -778,6 +780,9 @@ msgstr "انهاء الفحص السريع"
msgid "example_code_header"
msgstr "مثال توضيحي"

msgid "search"
msgstr "ابحث..."

msgid "variables"
msgstr "المتغيرات"

Expand Down Expand Up @@ -859,9 +864,6 @@ msgstr "تسجيل الخروج"
msgid "login"
msgstr "تسجيل الدخول"

msgid "search"
msgstr "ابحث..."

msgid "keyword_support"
msgstr "الأوامر البرمجية المترجمة"

Expand Down Expand Up @@ -1477,9 +1479,6 @@ msgstr "You already have a pending teacher request."
msgid "teacher_account_success"
msgstr "You successfully requested a teacher account."

msgid "only_teacher_create_class"
msgstr "يمكن للمعلمين فقط انشاء صفوف!"

msgid "class_name_invalid"
msgstr "اسم هذا الصف غير صالح."

Expand All @@ -1498,9 +1497,6 @@ msgstr "رابط الانضمام للصف غير صالح."
msgid "title_join-class"
msgstr "هيدي - انضم الى صف"

msgid "retrieve_class_error"
msgstr "يمكن للمعلمين فقط استرجاع الصفوف"

msgid "username_empty"
msgstr "لم تدخل اسم المستخدم!"

Expand All @@ -1513,6 +1509,9 @@ msgstr "هذا التلميذ بالفعل موجود في الصف الخاص
msgid "student_already_invite"
msgstr "هذا التلميذ بالفعل لديه دعوة قيد الإنتظار."

msgid "retrieve_class_error"
msgstr "يمكن للمعلمين فقط استرجاع الصفوف"

msgid "title_class-overview"
msgstr "هيدي - نظرة عامة على الصف"

Expand Down Expand Up @@ -1648,3 +1647,7 @@ msgstr "هيدي - انضم الى صف"

#~ msgid "create_account_explanation"
#~ msgstr "يسمح لك امتلاك حسابك الخاص بحفظ برامجك."

#~ msgid "only_teacher_create_class"
#~ msgstr "يمكن للمعلمين فقط انشاء صفوف!"

45 changes: 24 additions & 21 deletions translations/bg/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-10-25 20:54-0400\n"
"POT-Creation-Date: 2022-11-14 09:21+0100\n"
"PO-Revision-Date: 2022-10-26 14:14+0000\n"
"Last-Translator: Anonymous <[email protected]>\n"
"Language-Team: bg <[email protected]>\n"
"Language: bg\n"
"Language-Team: bg <[email protected]>\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.14.2-dev\n"
"Generated-By: Babel 2.10.3\n"
"Generated-By: Babel 2.10.1\n"

msgid "program_contains_error"
msgstr "В тази програма има грешка, сигурни ли сте че искате да я споделите?"
Expand Down Expand Up @@ -728,6 +728,9 @@ msgstr "Other settings"
msgid "mandatory_mode"
msgstr "Mandatory developer's mode"

msgid "all_class_highscores"
msgstr ""

#, fuzzy
msgid "hide_cheatsheet"
msgstr "Hide cheatsheet"
Expand Down Expand Up @@ -788,6 +791,10 @@ msgstr "Save & share code"
msgid "hedy_choice_title"
msgstr "Hedy's Choice"

#, fuzzy
msgid "number_lines"
msgstr "Number of lines"

#, fuzzy
msgid "creator"
msgstr "Creator"
Expand All @@ -800,10 +807,6 @@ msgstr "View program"
msgid "report_program"
msgstr "Are you sure you want to report this program?"

#, fuzzy
msgid "number_lines"
msgstr "Number of lines"

#, fuzzy
msgid "my_classes"
msgstr "My classes"
Expand Down Expand Up @@ -903,6 +906,10 @@ msgstr "Quiz"
msgid "example_code_header"
msgstr "Примерен код на Хеди"

#, fuzzy
msgid "search"
msgstr "Search..."

#, fuzzy
msgid "variables"
msgstr "Variables"
Expand Down Expand Up @@ -994,10 +1001,6 @@ msgstr "Изход"
msgid "login"
msgstr "Вход"

#, fuzzy
msgid "search"
msgstr "Search..."

#, fuzzy
msgid "keyword_support"
msgstr "Translated keywords"
Expand Down Expand Up @@ -1719,10 +1722,6 @@ msgstr "You already have a pending teacher request."
msgid "teacher_account_success"
msgstr "You successfully requested a teacher account."

#, fuzzy
msgid "only_teacher_create_class"
msgstr "Only teachers are allowed to create classes!"

#, fuzzy
msgid "class_name_invalid"
msgstr "This class name is invalid."
Expand All @@ -1747,10 +1746,6 @@ msgstr "Invalid link for joining the class."
msgid "title_join-class"
msgstr "Hedy - Join class"

#, fuzzy
msgid "retrieve_class_error"
msgstr "Only teachers can retrieve classes"

#, fuzzy
msgid "username_empty"
msgstr "You didn't enter an username!"
Expand All @@ -1767,6 +1762,10 @@ msgstr "This student is already in your class."
msgid "student_already_invite"
msgstr "This student already has a pending invitation."

#, fuzzy
msgid "retrieve_class_error"
msgstr "Only teachers can retrieve classes"

#, fuzzy
msgid "title_class-overview"
msgstr "Hedy - Class overview"
Expand Down Expand Up @@ -1933,3 +1932,7 @@ msgstr "Hedy - Join class"

#~ msgid "create_account_explanation"
#~ msgstr "Ако работиш от твой личен акаунт, ще можеш да си записваш програмите."

#~ msgid "only_teacher_create_class"
#~ msgstr "Only teachers are allowed to create classes!"

Loading

0 comments on commit f1175a0

Please sign in to comment.