Enhance Skill Scoring and Profile Features
Deploy Development / deploy (push) Successful in 39s
Test Suite / pytest-backend (push) Successful in 42s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m15s
Deploy Development / deploy (push) Successful in 39s
Test Suite / pytest-backend (push) Successful in 42s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m15s
- Updated the skill scoring specification to include club-specific metrics and improved aggregation methods for skill profiles. - Introduced new API endpoints for batch skill profile summaries, allowing for efficient retrieval of compact skill data. - Enhanced frontend components to display skill profiles with club comparisons, improving user interaction and visibility of skill strengths. - Added filtering options for skills in the framework programs, enabling users to refine selections based on training weight relative to club maximums. - Improved CSS styles for skill profile displays, ensuring a cohesive and user-friendly interface across the application.
This commit is contained in:
1 parent
5200895a73
commit
78c6c51520
15 files changed
+1131
-141
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import React from 'react'
|
||||
import NavStateLink from '../NavStateLink'
|
||||
import SkillProfileCompact from '../skills/SkillProfileCompact'
|
||||
import {
|
||||
frameworkSessionDurationLabel,
|
||||
splitFrameworkCommaAgg,
|
||||
@@ -26,7 +27,16 @@ function CatalogGroup({ label, items, variant }) {
|
||||
/**
|
||||
* Einzelkarte für die Rahmenprogramm-Bibliothek.
|
||||
*/
|
||||
export default function FrameworkProgramListCard({ row, returnContext, onDelete }) {
|
||||
export default function FrameworkProgramListCard({
|
||||
row,
|
||||
returnContext,
|
||||
onDelete,
|
||||
skillSummary = null,
|
||||
skillSummaryLoading = false,
|
||||
skillFilterIds = [],
|
||||
skillDisplayLimit = 6,
|
||||
onShowSkillProfile,
|
||||
}) {
|
||||
const title = (row.title || '').trim() || `Rahmen #${row.id}`
|
||||
const description = (row.description || '').trim()
|
||||
const durationLabel = frameworkSessionDurationLabel(row)
|
||||
@@ -112,6 +122,27 @@ export default function FrameworkProgramListCard({ row, returnContext, onDelete
|
||||
</section>
|
||||
) : null}
|
||||
|
||||
<section className="fw-prog-card__section fw-prog-card__section--skills">
|
||||
<div className="fw-prog-card__section-head">
|
||||
<h3 className="fw-prog-card__section-title">Fähigkeiten</h3>
|
||||
{onShowSkillProfile ? (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary btn-small fw-prog-card__skills-btn"
|
||||
onClick={() => onShowSkillProfile(row)}
|
||||
>
|
||||
Vollständiges Profil
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
<SkillProfileCompact
|
||||
summary={skillSummary}
|
||||
skillIds={skillFilterIds}
|
||||
loading={skillSummaryLoading}
|
||||
displayLimit={skillDisplayLimit}
|
||||
/>
|
||||
</section>
|
||||
|
||||
<footer className="fw-prog-card__actions">
|
||||
<NavStateLink
|
||||
to={`/planning/framework-programs/${row.id}`}
|
||||
|
||||
@@ -20,6 +20,8 @@ export default function FrameworkProgramsFilterBlock({
|
||||
catalogFocusAreas = [],
|
||||
catalogTrainingTypes = [],
|
||||
catalogTargetGroups = [],
|
||||
catalogSkills = [],
|
||||
skillSummaries = null,
|
||||
disabled = false,
|
||||
durationRadioName = 'fw-duration-mode',
|
||||
showHint = true,
|
||||
@@ -31,8 +33,8 @@ export default function FrameworkProgramsFilterBlock({
|
||||
)
|
||||
|
||||
const matchCount = useMemo(
|
||||
() => filterFrameworkPrograms(programs, filters).length,
|
||||
[programs, filters]
|
||||
() => filterFrameworkPrograms(programs, filters, skillSummaries).length,
|
||||
[programs, filters, skillSummaries]
|
||||
)
|
||||
|
||||
const totalCount = (programs || []).length
|
||||
@@ -43,8 +45,9 @@ export default function FrameworkProgramsFilterBlock({
|
||||
focusAreas: catalogFocusAreas,
|
||||
trainingTypes: catalogTrainingTypes,
|
||||
targetGroups: catalogTargetGroups,
|
||||
skills: catalogSkills,
|
||||
}),
|
||||
[filters, catalogFocusAreas, catalogTrainingTypes, catalogTargetGroups]
|
||||
[filters, catalogFocusAreas, catalogTrainingTypes, catalogTargetGroups, catalogSkills]
|
||||
)
|
||||
|
||||
const updateFilter = (patch) => onFiltersChange((prev) => ({ ...prev, ...patch }))
|
||||
@@ -285,6 +288,61 @@ export default function FrameworkProgramsFilterBlock({
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{catalogSkills.length > 0 ? (
|
||||
<div className="fw-import-catalog-block fw-import-catalog-block--skills">
|
||||
<span className="form-label">Fähigkeiten (Vereinsvergleich)</span>
|
||||
<p className="form-sub" style={{ margin: '0 0 8px' }}>
|
||||
Filtert nach Trainingsgewicht relativ zum stärksten Vereins-Programm je Fähigkeit — ohne
|
||||
Punktewerte eingeben.
|
||||
</p>
|
||||
<div className="framework-catalog-checkgrid fw-import-skill-grid">
|
||||
{catalogSkills.map((sk) => (
|
||||
<label key={sk.id} className="framework-catalog-check">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={(filters.skillIds || []).includes(String(sk.id))}
|
||||
onChange={() => toggleId('skillIds', sk.id)}
|
||||
disabled={disabled}
|
||||
/>
|
||||
<span>{sk.name}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
{(filters.skillIds || []).length > 0 ? (
|
||||
<div className="fw-import-skill-options">
|
||||
<div className="form-row" style={{ marginBottom: 8 }}>
|
||||
<label className="form-label">Mindest-Anteil am Vereins-Maximum</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={String(filters.skillMinClubPercent ?? 0)}
|
||||
disabled={disabled}
|
||||
onChange={(e) =>
|
||||
updateFilter({ skillMinClubPercent: Number(e.target.value) || 0 })
|
||||
}
|
||||
>
|
||||
<option value="0">Kein Minimum (nur markieren)</option>
|
||||
<option value="25">mind. 25%</option>
|
||||
<option value="50">mind. 50%</option>
|
||||
<option value="75">mind. 75%</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className="form-row" style={{ marginBottom: 0 }}>
|
||||
<label className="form-label">Sortierung</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={filters.skillSort || 'title'}
|
||||
disabled={disabled}
|
||||
onChange={(e) => updateFilter({ skillSort: e.target.value })}
|
||||
>
|
||||
<option value="title">Bibliotheks-Reihenfolge</option>
|
||||
<option value="skill_strength">Stärkste gewählte Fähigkeit zuerst</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
{showHint ? (
|
||||
<p className="form-sub fw-import-filter-panel__hint">
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
import React from 'react'
|
||||
import {
|
||||
artifactPath,
|
||||
artifactTypeLabel,
|
||||
compactSkillDisplayRows,
|
||||
formatClubPercent,
|
||||
} from '../../utils/skillProfileListHelpers'
|
||||
|
||||
function formatWeight(value) {
|
||||
const n = Number(value)
|
||||
if (!Number.isFinite(n)) return '0'
|
||||
return n % 1 === 0 ? String(n) : n.toFixed(1)
|
||||
}
|
||||
|
||||
/**
|
||||
* Kompakte Fähigkeiten-Zeile für Listen/Kacheln.
|
||||
*/
|
||||
export default function SkillProfileCompact({
|
||||
summary,
|
||||
skillIds = [],
|
||||
loading = false,
|
||||
emptyText = 'Noch keine Übungen mit Fähigkeiten',
|
||||
displayLimit = 6,
|
||||
showClubBest = true,
|
||||
}) {
|
||||
if (loading) {
|
||||
return <p className="skill-profile-compact skill-profile-compact--loading form-sub">Fähigkeiten werden berechnet…</p>
|
||||
}
|
||||
|
||||
const rows = compactSkillDisplayRows(summary, { skillIds, limit: displayLimit })
|
||||
|
||||
if (!rows.length) {
|
||||
return summary ? (
|
||||
<p className="skill-profile-compact skill-profile-compact--empty form-sub">{emptyText}</p>
|
||||
) : null
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="skill-profile-compact">
|
||||
<span className="skill-profile-compact__label">Fähigkeiten</span>
|
||||
<ul className="skill-profile-compact__list">
|
||||
{rows.map((sk) => {
|
||||
const best = sk.club_best
|
||||
const path = showClubBest && best ? artifactPath(best) : null
|
||||
return (
|
||||
<li key={sk.skill_id} className="skill-profile-compact__item">
|
||||
<span className="skill-profile-compact__name" title={sk.skill_name}>
|
||||
{sk.skill_name}
|
||||
</span>
|
||||
<span className="skill-profile-compact__metric" title="Trainingsgewicht und Anteil am Vereins-Maximum">
|
||||
{formatWeight(sk.weight)} · {formatClubPercent(sk.universal_percent)} Verein
|
||||
</span>
|
||||
{showClubBest && best && path && sk.universal_percent != null && sk.universal_percent < 100 ? (
|
||||
<span className="skill-profile-compact__best form-sub">
|
||||
Vereins-Top: {artifactTypeLabel(best.artifact_type)} „{best.artifact_title || best.artifact_id}“ (
|
||||
{formatWeight(best.weight)})
|
||||
</span>
|
||||
) : sk.universal_percent >= 100 ? (
|
||||
<span className="skill-profile-compact__best form-sub">Stärkste Vereins-Nutzung dieser Fähigkeit</span>
|
||||
) : null}
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import api from '../../utils/api'
|
||||
import SkillProfilePanel from './SkillProfilePanel'
|
||||
|
||||
/**
|
||||
* Vollständiges Fähigkeiten-Profil in einem Modal (Listen-Kontext).
|
||||
*/
|
||||
export default function SkillProfileFullModal({
|
||||
open,
|
||||
onClose,
|
||||
artifactType = 'framework_program',
|
||||
artifactId,
|
||||
title = 'Fähigkeiten-Profil',
|
||||
}) {
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [error, setError] = useState('')
|
||||
const [data, setData] = useState(null)
|
||||
|
||||
useEffect(() => {
|
||||
if (!open || !artifactId) return undefined
|
||||
let cancelled = false
|
||||
setLoading(true)
|
||||
setError('')
|
||||
setData(null)
|
||||
const load =
|
||||
artifactType === 'training_module'
|
||||
? api.getTrainingModuleSkillProfile(artifactId)
|
||||
: artifactType === 'progression_graph'
|
||||
? api.getProgressionGraphSkillProfile(artifactId)
|
||||
: api.getFrameworkProgramSkillProfile(artifactId)
|
||||
load
|
||||
.then((res) => {
|
||||
if (!cancelled) setData(res)
|
||||
})
|
||||
.catch((e) => {
|
||||
if (!cancelled) setError(e.message || 'Profil konnte nicht geladen werden')
|
||||
})
|
||||
.finally(() => {
|
||||
if (!cancelled) setLoading(false)
|
||||
})
|
||||
return () => {
|
||||
cancelled = true
|
||||
}
|
||||
}, [open, artifactId, artifactType])
|
||||
|
||||
if (!open) return null
|
||||
|
||||
return (
|
||||
<div className="skill-profile-modal" role="dialog" aria-modal="true" aria-labelledby="skill-profile-modal-title">
|
||||
<button type="button" className="skill-profile-modal__backdrop" aria-label="Schließen" onClick={onClose} />
|
||||
<div className="skill-profile-modal__panel card">
|
||||
<header className="skill-profile-modal__head">
|
||||
<h2 id="skill-profile-modal-title" className="skill-profile-modal__title">
|
||||
{title}
|
||||
</h2>
|
||||
<button type="button" className="btn btn-secondary btn-small" onClick={onClose}>
|
||||
Schließen
|
||||
</button>
|
||||
</header>
|
||||
<SkillProfilePanel
|
||||
profile={data?.overall}
|
||||
slots={artifactType === 'framework_program' ? data?.slots : null}
|
||||
loading={loading}
|
||||
error={error}
|
||||
title="Vollständiges Profil"
|
||||
defaultExpanded
|
||||
/>
|
||||
{data?.reference_scale?.scope === 'club' && !loading ? (
|
||||
<p className="form-sub skill-profile-modal__scale">
|
||||
Vergleichsbasis: {data.reference_scale.artifacts_scanned ?? 0} Vereins-Artefakte (
|
||||
{data.reference_scale.skills_in_corpus ?? 0} Fähigkeiten mit Referenz).
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -20,7 +20,7 @@ function barFillPercent(skill, maxWeight, hasReferenceScale) {
|
||||
|
||||
function metricLabel(skill, hasReferenceScale) {
|
||||
if (hasReferenceScale && skill?.universal_percent != null) {
|
||||
return `${skill.universal_percent}% Bibliothek`
|
||||
return `${skill.universal_percent}% vom Vereins-Maximum`
|
||||
}
|
||||
return formatWeight(skillWeight(skill))
|
||||
}
|
||||
@@ -43,7 +43,14 @@ function CategoryTopSkill({ skill, maxWeight, hasReferenceScale }) {
|
||||
</div>
|
||||
{hasReferenceScale ? (
|
||||
<span className="skill-profile__meta-hint">
|
||||
Absolut: {formatWeight(skillWeight(skill))} · Skala über alle Programme
|
||||
Trainingsgewicht {formatWeight(skillWeight(skill))}
|
||||
{skill.club_best ? (
|
||||
<>
|
||||
{' '}
|
||||
· Vereins-Top: {skill.club_best.artifact_title || skill.club_best.artifact_id} (
|
||||
{formatWeight(skill.club_best.weight)})
|
||||
</>
|
||||
) : null}
|
||||
</span>
|
||||
) : null}
|
||||
</li>
|
||||
@@ -111,7 +118,7 @@ export default function SkillProfilePanel({
|
||||
loading = false,
|
||||
error = '',
|
||||
title = 'Fähigkeiten-Profil',
|
||||
hint = 'Aus verknüpften Übungen berechnet (Dauer, Vorkommen, Intensität, Stufen von/bis). Trainingsgewicht ist über Programme vergleichbar; die Balken zeigen die Stärke relativ zur Bibliothek.',
|
||||
hint = 'Trainingsgewicht aus Dauer, Häufigkeit, Intensität und Stufen-Spanne. Vergleich nur im aktiven Verein (visibility=club). Pro Kategorie die stärkste Fähigkeit; Balken = Anteil am Vereins-Maximum dieser Fähigkeit.',
|
||||
defaultExpanded = true,
|
||||
}) {
|
||||
const [expanded, setExpanded] = useState(defaultExpanded)
|
||||
|
||||
Reference in new issue
Block a user