Dieser Commit ist enthalten in:
Claude Project Manager
2025-10-16 09:05:11 +02:00
Ursprung 4d509d255f
Commit 4b5fec1903
2 geänderte Dateien mit 51 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -53,16 +53,21 @@ const splitPathAndTask = (value?: string | null): { path: string; task?: string
const normalized = normalizeDepartment(value)
if (!normalized) return { path: '' }
const separator = ' -> '
const lastIndex = normalized.lastIndexOf(separator)
if (lastIndex === -1) {
const segments = normalized.split(separator).map(s => s.trim()).filter(Boolean)
if (segments.length <= 1) {
return { path: normalized }
}
const path = normalized.slice(0, lastIndex)
const task = normalized.slice(lastIndex + separator.length)
return {
path: path || normalized,
task: task || undefined
const lastSeg = segments[segments.length - 1]
// Heuristik: Wenn das letzte Segment wie ein Organisationscode aussieht (z. B. "Abt 4", "Dez 41", "SG 41.1"),
// ist es Teil der Hierarchie und KEIN Aufgaben-Text. In dem Fall nichts abtrennen.
const CODE_LIKE_REGEX = /^(dir|lka\s*nrw|lstab|za(\s*\d+)?|abt\.?\s*\d+|abteilung\s*\d+|dez\.?\s*\d+[a-z]?|dezernat\s*\d+[a-z]?|sg\s*\d+(?:\.\d+)?|td\s*\d+(?:\.\d+)?)$/i
if (CODE_LIKE_REGEX.test(lastSeg)) {
return { path: normalized }
}
// Andernfalls letzte Komponente als Aufgaben-Text behandeln
const path = segments.slice(0, -1).join(separator)
const task = lastSeg
return { path: path || normalized, task: task || undefined }
}
export const formatDepartmentWithDescription = (