This commit is contained in:
Team3
2026-07-05 00:54:21 +02:00
parent 219993ffd5
commit db58d52567
5 changed files with 114 additions and 4 deletions

View File

@@ -135,6 +135,16 @@ export async function resetGuideBoard(topic, format, abStage) {
return jsonOrThrow(res)
}
// Befunde beheben: Karten mit QA-Befunden zurück auf Prüfen + Resume-Lauf.
export async function repairGuideBoard(topic, format) {
const res = await fetch(`${BASE}/guides/board/repair`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ topic, format, ab_stage: 0 }),
})
return jsonOrThrow(res)
}
export async function cancelBlocks(topic) {
await fetch(`${BASE}/blocks/cancel?topic=${encodeURIComponent(topic)}`, { method: 'POST' })
}

View File

@@ -1,6 +1,6 @@
<script setup>
import { ref, computed, watch, onUnmounted } from 'vue'
import { fetchGuideBoard } from '../api.js'
import { fetchGuideBoard, repairGuideBoard } from '../api.js'
import KanbanBoard from './KanbanBoard.vue'
const props = defineProps({
@@ -32,7 +32,7 @@ const total = computed(() => columns.value.reduce((n, c) => n + c.total, 0))
const done = computed(() => columns.value.find((c) => c.key === 'done')?.total || 0)
// Stage-Index für ab_step (Reihenfolge = Spalten ohne "done").
const STAGES = ['lernziele', 'zuweisung', 'writer', 'fakten_gate', 'coverage', 'lesbarkeit']
const STAGES = ['lernziele', 'zuweisung', 'writer', 'pruefer', 'fix']
const sel = ref(null)
const selCard = ref(null)
const confirm = ref(null)
@@ -63,6 +63,23 @@ function arm(action, fn) {
if (confirm.value === action) { confirm.value = null; fn() }
else confirm.value = action
}
const repairBusy = ref(false)
const repairInfo = ref('')
async function repairClick() {
repairBusy.value = true
repairInfo.value = ''
try {
const r = await repairGuideBoard(props.topic, props.format)
repairInfo.value = (r.betroffen || []).length
? `${r.betroffen.length} Abschnitt(e) → Prüfen`
: 'keine Befunde im letzten QA-Report'
if ((r.betroffen || []).length) startPoll()
} catch (e) {
repairInfo.value = String(e.message || e)
} finally {
repairBusy.value = false
}
}
function restartHere() {
const s = sel.value
sel.value = null
@@ -93,6 +110,9 @@ function resetHere() {
<template v-else>
<button class="gb-act play" @click="emit('startGuide', { format, abStep: null }); startPoll()">{{ total && done < total ? 'Fortsetzen' : total ? 'Neu generieren' : 'Generieren' }}</button>
<button v-if="done === total && total" class="gb-act" @click="emit('preview')">Guide öffnen</button>
<button v-if="total && board?.qa_guide != null && board.qa_guide < 10" class="gb-act"
:disabled="repairBusy" @click="repairClick">{{ repairBusy ? 'Repariert' : 'Befunde beheben' }}</button>
<span v-if="repairInfo" class="gb-count">{{ repairInfo }}</span>
<button v-if="total" class="gb-act danger" :class="{ armed: confirm === 'delete' }" @click="arm('delete', () => { emit('removeFormat', format); setTimeout(poll, 600) })">{{ confirm === 'delete' ? 'Sure?' : 'Remove' }}</button>
</template>
</div>