Add user filtering and progress overview to submissions page; enhance localization for user selection and progress display
This commit is contained in:
@@ -61,6 +61,32 @@ const getStatsV2 = () => {
|
||||
return statsV2Cache;
|
||||
};
|
||||
|
||||
// Enrich SystemStatsV2 with real user ids/nicknames from users.json
|
||||
const getStatsV2WithUsers = () => {
|
||||
const statsV2 = getStatsV2();
|
||||
const users = getUsers();
|
||||
|
||||
const mapParticipant = (participant, index) => {
|
||||
const user = users[index];
|
||||
if (!user) return participant;
|
||||
|
||||
return {
|
||||
...participant,
|
||||
userId: user.id,
|
||||
nickname: user.nickname,
|
||||
};
|
||||
};
|
||||
|
||||
return {
|
||||
...statsV2,
|
||||
activeParticipants: statsV2.activeParticipants.map(mapParticipant),
|
||||
chainsDetailed: statsV2.chainsDetailed.map((chain) => ({
|
||||
...chain,
|
||||
participantProgress: chain.participantProgress.map(mapParticipant),
|
||||
})),
|
||||
};
|
||||
};
|
||||
|
||||
router.use(timer());
|
||||
|
||||
// ============= TASKS =============
|
||||
@@ -282,7 +308,7 @@ router.get('/challenge/stats', (req, res) => {
|
||||
|
||||
// GET /api/challenge/stats/v2
|
||||
router.get('/challenge/stats/v2', (req, res) => {
|
||||
const statsV2 = getStatsV2();
|
||||
const statsV2 = getStatsV2WithUsers();
|
||||
const chainId = req.query.chainId;
|
||||
|
||||
// Если chainId не передан, возвращаем все данные
|
||||
|
||||
Reference in New Issue
Block a user