diff --git a/frontend/src/pages/Test.vue b/frontend/src/pages/Test.vue
index 5133fcc8..420d53dd 100644
--- a/frontend/src/pages/Test.vue
+++ b/frontend/src/pages/Test.vue
@@ -9,7 +9,7 @@
-
+
Ваша позиция
@@ -110,6 +110,10 @@
{{ activeGroupLabel }} - Топ {{ currentLeaderboard.length }}
+
+
+ * Бонусные баллы рассчитываются как 1 балл за каждые 100 очков активности (максимум 10)
+
@@ -154,22 +158,22 @@
-
-
-
-
Бонус
-
- {{ user.bonus }}
- ⭐
-
-
+
+
+
+
Бонус
+
+ {{ user.bonus }}
+ ⭐
+
+
-
-
-
Очки
-
{{ user.points }}
-
-
+
+
+
Очки
+
{{ user.points }}
+
+
@@ -345,9 +349,9 @@ function getGroupButtonClass(role) {
function getGroupGradientClass(role) {
const classes = {
- 'LMS Student': 'from-teal-300 to-teal-400',
- 'Course Creator': 'from-teal-500 to-teal-600',
- 'LMS Schoolchild': 'from-teal-100 to-teal-200'
+ 'LMS Student': 'from-teal-400 to-teal-500',
+ 'Course Creator': 'from-teal-600 to-teal-700',
+ 'LMS Schoolchild': 'from-teal-200 to-teal-300'
}
return classes[role] || 'from-blue-500 to-blue-600'
}
@@ -370,6 +374,17 @@ function getGroupStats(role) {
}
}
+function calculateLeaderboard() {
+ if (!logsResource.data) return
+
+ const pointsMap = {}
+
+ // Считаем сумму очков для каждого пользователя
+ logsResource.data.forEach(log => {
+ if (!pointsMap[log.user]) pointsMap[log.user] = 0
+ pointsMap[log.user] += log.points
+ })
+
function calculateLeaderboard() {
if (!logsResource.data) return
@@ -396,13 +411,23 @@ function calculateLeaderboard() {
if (!hasValidRole) return null
+ // Пропускаем пользователей с отрицательными или нулевыми баллами
+ if (pointsMap[user] < 0) return null
+
+ // Определяем является ли пользователь школьником
+ const isSchoolchild = u.roles.includes('LMS Schoolchild')
+
+ // Вычисляем бонус только для школьников
+ const bonus = isSchoolchild ? Math.min(Math.floor(pointsMap[user] / 100), 10) : 0
+
return {
user,
points: pointsMap[user],
full_name: u.full_name,
username: u.email?.split('@')[0] || user.split('@')[0],
roles: u.roles || [],
- bonus: Math.min(Math.floor(pointsMap[user] / 100), 10)
+ bonus: bonus,
+ isSchoolchild: isSchoolchild // Добавляем флаг для удобства
}
})
.filter(user => user !== null)