V2-Dev-Stand: Skala 1-10, Benefits/Concerns, DEV-Isolation und Gitea-Doku.

Bündelt die Neuentwicklung in AssigmentMonitorV2 (eigene Ports/DB), die Umstellung auf numerische Bewertungen, Meeting-Checklisten, KI-Tagging und die geplante Feedback-Kaskade — als Basis für Versionsverwaltung in Gitea.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-08-08 17:35:05 +02:00
1 parent 782678a1cf
commit 234f87d408
71 files changed
+7567 -705

No files matched your search

+68 -32
View File
@@ -1,25 +1,22 @@
import { useEffect, useState } from 'react'
import { useNavigate, useParams } from 'react-router-dom'
import {
type Assignment, type AssignmentType, type PhaseTemplate, type MeetingInstance, type Consultant, type Assessment, type FeedbackRating, type FeedbackCategory, type FeedbackCriterionItem,
type Assignment, type AssignmentType, type PhaseTemplate, type MeetingInstance, type Consultant, type Assessment, type RatingScore, type FeedbackCategory, type FeedbackCriterionItem,
getAssignment, getAssignmentType,
listPhaseTemplatesForType,
listMeetingInstancesForAssignment, addMeetingInstance, softDeleteMeetingInstance, restoreMeetingInstance, hardDeleteMeetingInstance,
getConsultantsByIds,
listAssessmentsForMeetings,
listFeedbackCategoriesAll, listFeedbackCriterionItemsAll, filterVisibleFeedbackStructure,
listMeetingCategoryRatingsForMeetings,
loadFeedbackStructure, resolveVisibleStructure,
isAssignmentFeedbackComplete, softDeleteAssignment, archiveAssignment,
} from '../db'
import { exportMeetingAsMarkdown, exportMeetingAsJson, downloadFile } from '../utils/meetingExport'
import { weightedAverageRating } from '../utils/ratingTrend'
const RATING_BG: Record<FeedbackRating, string> = {
na: 'bg-gray-400 text-white',
not_client_ready: 'bg-red-500 text-white',
partially_client_ready: 'bg-orange-500 text-white',
nearly_client_ready: 'bg-green-400 text-white',
client_ready: 'bg-green-700 text-white',
}
import { exportAssignmentReportPdf, exportInstituteeFeedbackPdf } from '../utils/pdfExport'
import { resolveScoreStyle } from '../config/constants'
import { resolveCategoryChipScore } from '../utils/meetingCategoryScore'
import { useRatingColorBands } from '../hooks/useRatingColorBands'
import type { MeetingCategoryRating } from '../db'
interface PhaseRow {
template: PhaseTemplate
@@ -43,11 +40,14 @@ export default function AssignmentDetail() {
const [confirmSoftDelete, setConfirmSoftDelete] = useState<number | null>(null)
const [confirmHardDelete, setConfirmHardDelete] = useState<number | null>(null)
const [allAssessments, setAllAssessments] = useState<Assessment[]>([])
const [categoryRatings, setCategoryRatings] = useState<MeetingCategoryRating[]>([])
const [fbCategories, setFbCategories] = useState<FeedbackCategory[]>([])
const [fbItems, setFbItems] = useState<FeedbackCriterionItem[]>([])
const colorBands = useRatingColorBands()
const [feedbackComplete, setFeedbackComplete] = useState(false)
const [confirmAssignmentTrash, setConfirmAssignmentTrash] = useState(false)
const [confirmAssignmentArchive, setConfirmAssignmentArchive] = useState(false)
const [pdfExportingKey, setPdfExportingKey] = useState<string | null>(null)
const load = async () => {
const a = await getAssignment(assignmentId)
@@ -73,16 +73,17 @@ export default function AssignmentDetail() {
instances: active.filter(i => i.phaseTemplateId === t.id).sort((a, b) => a.phaseIndex - b.phaseIndex),
})))
const instIds = active.map(i => i.id!)
const [asmts, allCats, allItems, aType2] = await Promise.all([
const [asmts, catRatings, structure, aType2] = await Promise.all([
listAssessmentsForMeetings(instIds),
listFeedbackCategoriesAll(),
listFeedbackCriterionItemsAll(),
listMeetingCategoryRatingsForMeetings(instIds),
loadFeedbackStructure(),
getAssignmentType(a.assignmentTypeId),
])
setAllAssessments(asmts)
const { categories: visibleCats, items: visibleItems } = filterVisibleFeedbackStructure(allCats, allItems, aType2?.criteriaIds)
setFbItems(visibleItems)
setFbCategories(visibleCats)
setCategoryRatings(catRatings)
const visible = resolveVisibleStructure(structure.dimensions, structure.categories, structure.items, aType2?.criteriaIds)
setFbItems(visible.items)
setFbCategories(visible.categories)
}
useEffect(() => { load() }, [assignmentId])
@@ -147,6 +148,25 @@ export default function AssignmentDetail() {
navigate('/')
}
const handleExportReportPdf = async () => {
setPdfExportingKey('report')
try {
await exportAssignmentReportPdf(assignmentId)
} finally {
setPdfExportingKey(null)
}
}
const handleExportInstituteeFeedbackPdf = async (instituteeId: number) => {
const key = `inst-${instituteeId}`
setPdfExportingKey(key)
try {
await exportInstituteeFeedbackPdf(assignmentId, instituteeId)
} finally {
setPdfExportingKey(null)
}
}
const statusBadge = (status: MeetingInstance['status']) => {
const map = {
planned: 'bg-yellow-100 text-yellow-700',
@@ -176,6 +196,13 @@ export default function AssignmentDetail() {
className="text-xs px-3 py-1.5 border border-gray-200 rounded-lg text-gray-500 hover:border-brand hover:text-brand transition">
📜 Gesamtprotokoll
</button>
<button
onClick={handleExportReportPdf}
disabled={pdfExportingKey === 'report'}
title="Gesamtprotokoll + Feedback als PDF"
className="text-xs px-3 py-1.5 border border-gray-200 rounded-lg text-gray-500 hover:border-brand hover:text-brand transition disabled:opacity-50">
{pdfExportingKey === 'report' ? '⏳' : '⬇ PDF'}
</button>
<button
onClick={() => navigate(`/assignment/${assignmentId}/edit`)}
className="text-xs px-3 py-1.5 border border-gray-200 rounded-lg text-gray-500 hover:border-brand hover:text-brand transition">
@@ -269,11 +296,20 @@ export default function AssignmentDetail() {
<span className="text-sm text-amber-800 font-medium">Feedback-Entwürfe</span>
<div className="flex gap-2 flex-wrap">
{institutees.map(c => (
<button key={c.id}
onClick={() => navigate(`/assignment/${assignmentId}/feedback/${c.id}`)}
className="text-xs bg-amber-600 text-white px-3 py-1 rounded-lg">
{c.firstName}
</button>
<div key={c.id} className="flex items-center gap-1">
<button
onClick={() => navigate(`/assignment/${assignmentId}/feedback/${c.id}`)}
className="text-xs bg-amber-600 text-white px-3 py-1 rounded-lg">
{c.firstName}
</button>
<button
onClick={() => handleExportInstituteeFeedbackPdf(c.id!)}
disabled={pdfExportingKey === `inst-${c.id}`}
title={`Feedback für ${c.firstName} als PDF`}
className="text-xs bg-amber-100 text-amber-700 px-2 py-1 rounded-lg disabled:opacity-50">
{pdfExportingKey === `inst-${c.id}` ? '⏳' : '⬇'}
</button>
</div>
))}
</div>
</div>
@@ -323,24 +359,24 @@ export default function AssignmentDetail() {
{institutees.map(c => {
const chips = fbCategories.map(cat => {
const catItems = fbItems.filter(i => i.categoryId === cat.id)
const mode = weightedAverageRating(catItems, itemId => {
const asmt = allAssessments.find(a =>
a.meetingInstanceId === inst.id &&
a.instituteeId === c.id &&
a.criteriaId === itemId
)
return asmt?.score ?? null
const mode = resolveCategoryChipScore({
meetingId: inst.id!,
instituteeId: c.id!,
categoryId: cat.id!,
categoryRatings,
assessments: allAssessments,
catItems,
})
return mode ? { cat, mode } : null
}).filter(Boolean) as { cat: FeedbackCategory; mode: FeedbackRating }[]
}).filter(Boolean) as { cat: FeedbackCategory; mode: RatingScore }[]
if (chips.length === 0) return null
return (
<div key={c.id} className="mt-1">
<span className="text-xs text-gray-400 mr-1">{c.firstName}:</span>
{chips.map(({ cat, mode }) => (
<span key={cat.id} className={`inline-block text-xs px-2 py-0.5 rounded font-medium mr-1 ${RATING_BG[mode]}`}>
{cat.name}
<span key={cat.id} className={`inline-block text-xs px-2 py-0.5 rounded font-medium mr-1 tabular-nums ${resolveScoreStyle(mode, colorBands).active}`}>
{cat.name} {mode}
</span>
))}
</div>