Add detailed statistics API v2 documentation and implement frontend components for displaying statistics

This commit is contained in:
Primakov Alexandr Alexandrovich
2025-11-04 21:37:03 +03:00
parent b91ee56bf0
commit fd55d5a214
16 changed files with 2233 additions and 29 deletions

View File

@@ -113,7 +113,7 @@ export interface SystemStats {
// API Request/Response types
export interface APIResponse<T> {
error: any
error: unknown
data: T
}
@@ -139,3 +139,87 @@ export interface UpdateChainRequest {
taskIds?: string[]
}
// ========== Stats v2 Types ==========
export type TaskProgressStatus = 'not_started' | 'pending' | 'in_progress' | 'needs_revision' | 'completed'
export interface TaskTableItem {
taskId: string
title: string
totalAttempts: number
uniqueUsers: number
acceptedCount: number
successRate: number
averageAttemptsToSuccess: number
}
export interface ChainProgress {
chainId: string
chainName: string
totalTasks: number
completedTasks: number
progressPercent: number
}
export interface ActiveParticipant {
userId: string
nickname: string
totalSubmissions: number
completedTasks: number
chainProgress: ChainProgress[]
}
export interface TaskProgress {
taskId: string
taskTitle: string
status: TaskProgressStatus
}
export interface ParticipantProgress {
userId: string
nickname: string
taskProgress: TaskProgress[]
completedCount: number
progressPercent: number
}
export interface ChainTask {
taskId: string
title: string
description: string
}
export interface ChainDetailed {
chainId: string
name: string
totalTasks: number
tasks: ChainTask[]
participantProgress: ParticipantProgress[]
}
export interface SystemStatsV2 {
// Базовая статистика из v1
users: number
tasks: number
chains: number
submissions: {
total: number
accepted: number
rejected: number
pending: number
inProgress: number
}
averageCheckTimeMs: number
queue: {
queueLength: number
waiting: number
inProgress: number
maxConcurrency: number
currentlyProcessing: number
}
// Новые данные v2
tasksTable: TaskTableItem[]
activeParticipants: ActiveParticipant[]
chainsDetailed: ChainDetailed[]
}