Refactor ClearSubmissionsDialog and DuplicateChainDialog components by removing unnecessary whitespace; improve code cleanliness and maintainability.
This commit is contained in:
@@ -75,3 +75,5 @@ export const ClearSubmissionsDialog: React.FC<ClearSubmissionsDialogProps> = ({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -104,3 +104,5 @@ export const DuplicateChainDialog: React.FC<DuplicateChainDialogProps> = ({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -409,13 +409,32 @@ router.get('/challenge/stats/v2', (req, res) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Фильтруем данные по выбранной цепочке
|
// Сначала проверяем наличие цепочки в chains.json
|
||||||
const filteredChain = statsV2.chainsDetailed.find(c => c.chainId === chainId);
|
const chains = getChains();
|
||||||
|
const chain = chains.find(c => c.id === chainId);
|
||||||
|
|
||||||
if (!filteredChain) {
|
if (!chain) {
|
||||||
return respondError(res, 'Chain not found', 404);
|
return respondError(res, 'Chain not found', 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ищем данные цепочки в stats-v2.json
|
||||||
|
let filteredChain = statsV2.chainsDetailed.find(c => c.chainId === chainId);
|
||||||
|
|
||||||
|
// Если цепочка не найдена в stats-v2.json, создаем пустую структуру на основе chains.json
|
||||||
|
if (!filteredChain) {
|
||||||
|
filteredChain = {
|
||||||
|
chainId: chain.id,
|
||||||
|
name: chain.name,
|
||||||
|
totalTasks: chain.tasks.length,
|
||||||
|
tasks: chain.tasks.map(t => ({
|
||||||
|
taskId: t.id,
|
||||||
|
title: t.title,
|
||||||
|
description: t.description || ''
|
||||||
|
})),
|
||||||
|
participantProgress: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Фильтруем tasksTable - только задания из этой цепочки
|
// Фильтруем tasksTable - только задания из этой цепочки
|
||||||
const chainTaskIds = new Set(filteredChain.tasks.map(t => t.taskId));
|
const chainTaskIds = new Set(filteredChain.tasks.map(t => t.taskId));
|
||||||
const filteredTasksTable = statsV2.tasksTable.filter(t => chainTaskIds.has(t.taskId));
|
const filteredTasksTable = statsV2.tasksTable.filter(t => chainTaskIds.has(t.taskId));
|
||||||
|
|||||||
Reference in New Issue
Block a user