优化: LEGACY_STATUS_MAP 映射抽 mapLegacyStatus 函数收敛
This commit is contained in:
@@ -92,14 +92,17 @@ const LEGACY_STATUS_MAP: Record<string, string> = {
|
||||
abandoned: 'cancelled',
|
||||
}
|
||||
|
||||
/** 老DB 旧态映射(completed→done / review_ready→in_review 等),新 DB 无此数据 */
|
||||
function mapLegacyStatus(status: string): string {
|
||||
return LEGACY_STATUS_MAP[status] ?? status
|
||||
}
|
||||
|
||||
export function taskStatusLabel(status: string): string {
|
||||
const mapped = LEGACY_STATUS_MAP[status] ?? status
|
||||
return TASK_STATUS_LABELS[mapped] ?? 'tasks.status.todo'
|
||||
return TASK_STATUS_LABELS[mapLegacyStatus(status)] ?? 'tasks.status.todo'
|
||||
}
|
||||
|
||||
export function taskStatusClass(status: string): string {
|
||||
const mapped = LEGACY_STATUS_MAP[status] ?? status
|
||||
return TASK_STATUS_CLASS[mapped] ?? 'status-todo'
|
||||
return TASK_STATUS_CLASS[mapLegacyStatus(status)] ?? 'status-todo'
|
||||
}
|
||||
|
||||
// ── 任务优先级 ──
|
||||
|
||||
Reference in New Issue
Block a user