criterios aceptacion: parsear Quill HTML a lista JSON + tooltip en dashboard

This commit is contained in:
2026-05-27 22:51:30 -05:00
parent 0a240ea146
commit 0339aa23f6
4 changed files with 49 additions and 5 deletions
+9 -2
View File
@@ -3,6 +3,7 @@ import { ref, computed } from 'vue'
import { kappa } from '@/services/kappa-api'
import { tauriDb, type UserStoryRecord, type EpicRecord } from '@/services/tauri-db'
import { stripHtml } from '@/services/clean-html'
import { criteriaToJson, parseQuillList } from '@/services/clean-html'
import { parseHierarchy, stripHierarchy, getItemType, type ItemType } from '@/services/hierarchy'
import type { KappaUserStory, KappaLogbookEntry, KappaPlanningEntry, KappaEpicDevelopment } from '@/types/kappa'
@@ -10,6 +11,7 @@ export interface EnrichedUserStory extends KappaUserStory {
_itemType: ItemType
_hierarchyPath: string | null
_cleanTitle: string
_criteriaList: string[]
}
export interface EnrichedEpic extends KappaEpicDevelopment {
@@ -55,15 +57,20 @@ export const useWorkItemsStore = defineStore('workitems', () => {
}
}
function enrichHU(hu: { title?: string; id?: number }, initiativeId: number): EnrichedUserStory {
function enrichHU(hu: { title?: string; id?: number; acceptance_criteria?: string | null; criterios_aceptacion?: string | null }, initiativeId: number): EnrichedUserStory {
const h = parseHierarchy(hu.title || '')
const rawCriteria = hu.acceptance_criteria || hu.criterios_aceptacion || ''
const criteriaList = rawCriteria ? parseQuillList(rawCriteria) : []
return {
id: hu.id ?? 0,
title: hu.title || '',
acceptance_criteria: rawCriteria,
criterios_aceptacion: rawCriteria,
initiative: initiativeId,
_itemType: h?.items[h.items.length - 1]?.type || 'U',
_hierarchyPath: h?.fullPath ?? null,
_cleanTitle: h ? stripHierarchy(hu.title || '') : (hu.title || ''),
_criteriaList: criteriaList,
}
}
@@ -166,7 +173,7 @@ export const useWorkItemsStore = defineStore('workitems', () => {
code: safeStr(hu.code),
title: String(hu.title || ''),
description: stripHtml(String(hu.description || '')),
acceptance_criteria: safeStr(hu.acceptance_criteria),
acceptance_criteria: (hu.acceptance_criteria || hu.criterios_aceptacion || null) as string | null,
status: safeStr(hu.status),
priority: safeStr(hu.priority),
story_points: null,