Update Skill Scoring Specification and Implementation to v1.2
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 38s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m27s
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 38s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m27s
- Enhanced the skill scoring system with category grouping and a universal scale for improved comparability across programs. - Introduced new calculations for artifact share percentage and universal percent, allowing for a more nuanced understanding of skill contributions. - Updated the API to reflect changes in the skill profile structure, including main category and top skill details. - Improved frontend components to display skills by main category, enhancing user experience in skill discovery and profile visualization. - Adjusted tests to validate the new scoring logic and ensure accurate representation of skills and their weights.
This commit is contained in:
1 parent
8f8bdf6d8b
commit
5200895a73
8 files changed
+604
-139
No files matched your search
@@ -2591,6 +2591,46 @@ html.modal-scroll-locked .app-main {
|
||||
color: var(--text3);
|
||||
margin-top: 3px;
|
||||
}
|
||||
.skill-profile__by-category {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
}
|
||||
.skill-profile__main-cat {
|
||||
padding: 10px 12px;
|
||||
border-radius: 10px;
|
||||
background: var(--surface2);
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
.skill-profile__main-cat-title {
|
||||
margin: 0 0 8px;
|
||||
font-size: 0.82rem;
|
||||
font-weight: 700;
|
||||
color: var(--text2);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
.skill-profile__cat-list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
.skill-profile__cat-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
.skill-profile__cat-label {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: var(--text3);
|
||||
}
|
||||
.skill-profile__cat-row {
|
||||
list-style: none;
|
||||
}
|
||||
.skill-profile__categories {
|
||||
margin-top: 0.85rem;
|
||||
}
|
||||
@@ -2744,6 +2784,25 @@ html.modal-scroll-locked .app-main {
|
||||
font-size: 0.85rem;
|
||||
color: var(--text2);
|
||||
}
|
||||
.skill-discovery__result-cats {
|
||||
list-style: none;
|
||||
margin: 0 0 8px;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
font-size: 0.8rem;
|
||||
color: var(--text2);
|
||||
}
|
||||
.skill-discovery__result-cats li {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
.skill-discovery__result-cat-name {
|
||||
font-weight: 600;
|
||||
color: var(--text3);
|
||||
}
|
||||
.skill-discovery__result-link {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,12 @@ const ARTIFACT_LABELS = {
|
||||
progression_graph: 'Regressionspfad',
|
||||
}
|
||||
|
||||
function formatScore(value) {
|
||||
const n = Number(value)
|
||||
if (!Number.isFinite(n)) return '0'
|
||||
return n % 1 === 0 ? String(n) : n.toFixed(1)
|
||||
}
|
||||
|
||||
/**
|
||||
* Vorschläge für Planungsartefakte anhand gewählter Fähigkeiten (Phase 3).
|
||||
*/
|
||||
@@ -60,8 +66,8 @@ export default function SkillDiscoveryPanel({ skills = [] }) {
|
||||
<h2 className="skill-discovery__title">Planungs-Vorschläge</h2>
|
||||
<p className="form-sub skill-discovery__lead">
|
||||
Wähle Fähigkeiten, die du schwerpunktmäßig entwickeln willst — Shinkan schlägt passende
|
||||
Rahmenprogramme, Trainingsmodule und Regressionspfade aus der Bibliothek vor (gewichtet nach
|
||||
Übungs-Verknüpfungen).
|
||||
Rahmenprogramme, Trainingsmodule und Regressionspfade vor. Sortierung nach absolutem
|
||||
Trainingsgewicht (nicht nach Anteil innerhalb des Plans).
|
||||
</p>
|
||||
|
||||
<div className="form-row">
|
||||
@@ -122,35 +128,51 @@ export default function SkillDiscoveryPanel({ skills = [] }) {
|
||||
|
||||
{result?.suggestions?.length > 0 ? (
|
||||
<ul className="skill-discovery__results">
|
||||
{result.suggestions.map((item) => (
|
||||
<li key={`${item.artifact_type}-${item.artifact_id}`} className="skill-discovery__result card">
|
||||
<div className="skill-discovery__result-head">
|
||||
<span className="skill-discovery__result-type">
|
||||
{ARTIFACT_LABELS[item.artifact_type] || item.artifact_type}
|
||||
</span>
|
||||
<span className="skill-discovery__result-match">
|
||||
Passung {item.match?.match_percent ?? 0}%
|
||||
</span>
|
||||
</div>
|
||||
<strong className="skill-discovery__result-title">
|
||||
{item.artifact_title || `#${item.artifact_id}`}
|
||||
</strong>
|
||||
{item.match?.matched_skills?.length > 0 ? (
|
||||
<p className="skill-discovery__result-skills">
|
||||
{item.match.matched_skills.map((m) => m.skill_name).join(' · ')}
|
||||
</p>
|
||||
) : null}
|
||||
{item.path ? (
|
||||
<Link to={item.path} className="btn btn-secondary btn-small skill-discovery__result-link">
|
||||
Öffnen
|
||||
</Link>
|
||||
) : item.artifact_type === 'progression_graph' ? (
|
||||
<p className="form-sub" style={{ margin: '8px 0 0' }}>
|
||||
Regressionspfad in der Übungsliste unter „Progressionsgraph“ bearbeiten.
|
||||
</p>
|
||||
) : null}
|
||||
</li>
|
||||
))}
|
||||
{result.suggestions.map((item) => {
|
||||
const matchScore = item.match?.match_score ?? item.match?.match_weight ?? 0
|
||||
const focusPct = item.match?.artifact_focus_percent ?? item.match?.match_percent
|
||||
const topByCat = item.skill_profile_summary?.top_by_category || []
|
||||
return (
|
||||
<li key={`${item.artifact_type}-${item.artifact_id}`} className="skill-discovery__result card">
|
||||
<div className="skill-discovery__result-head">
|
||||
<span className="skill-discovery__result-type">
|
||||
{ARTIFACT_LABELS[item.artifact_type] || item.artifact_type}
|
||||
</span>
|
||||
<span className="skill-discovery__result-match" title="Summe der Trainingsgewichte der gewählten Fähigkeiten">
|
||||
Gewicht {formatScore(matchScore)}
|
||||
</span>
|
||||
</div>
|
||||
<strong className="skill-discovery__result-title">
|
||||
{item.artifact_title || `#${item.artifact_id}`}
|
||||
</strong>
|
||||
{item.match?.matched_skills?.length > 0 ? (
|
||||
<p className="skill-discovery__result-skills">
|
||||
{item.match.matched_skills.map((m) => m.skill_name).join(' · ')}
|
||||
{focusPct != null ? ` (${formatScore(focusPct)}% des Plans)` : null}
|
||||
</p>
|
||||
) : null}
|
||||
{topByCat.length > 0 ? (
|
||||
<ul className="skill-discovery__result-cats">
|
||||
{topByCat.slice(0, 4).map((row) => (
|
||||
<li key={`${row.category_name}-${row.skill_id}`}>
|
||||
<span className="skill-discovery__result-cat-name">{row.category_name}</span>
|
||||
<span>{row.skill_name}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : null}
|
||||
{item.path ? (
|
||||
<Link to={item.path} className="btn btn-secondary btn-small skill-discovery__result-link">
|
||||
Öffnen
|
||||
</Link>
|
||||
) : item.artifact_type === 'progression_graph' ? (
|
||||
<p className="form-sub" style={{ margin: '8px 0 0' }}>
|
||||
Regressionspfad in der Übungsliste unter „Progressionsgraph“ bearbeiten.
|
||||
</p>
|
||||
) : null}
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
) : result && !loading ? (
|
||||
<p className="form-sub skill-discovery__no-hit">
|
||||
|
||||
@@ -1,25 +1,107 @@
|
||||
import React, { useMemo, useState } from 'react'
|
||||
|
||||
function SkillBar({ skill, maxShare }) {
|
||||
const pct = maxShare > 0 ? Math.min(100, (skill.share_percent / maxShare) * 100) : 0
|
||||
function skillWeight(skill) {
|
||||
return Number(skill?.weight ?? skill?.score ?? 0)
|
||||
}
|
||||
|
||||
function formatWeight(value) {
|
||||
const n = Number(value)
|
||||
if (!Number.isFinite(n)) return '0'
|
||||
return n % 1 === 0 ? String(n) : n.toFixed(1)
|
||||
}
|
||||
|
||||
function barFillPercent(skill, maxWeight, hasReferenceScale) {
|
||||
if (hasReferenceScale && skill?.universal_percent != null) {
|
||||
return Math.min(100, Number(skill.universal_percent))
|
||||
}
|
||||
const w = skillWeight(skill)
|
||||
return maxWeight > 0 ? Math.min(100, (w / maxWeight) * 100) : 0
|
||||
}
|
||||
|
||||
function metricLabel(skill, hasReferenceScale) {
|
||||
if (hasReferenceScale && skill?.universal_percent != null) {
|
||||
return `${skill.universal_percent}% Bibliothek`
|
||||
}
|
||||
return formatWeight(skillWeight(skill))
|
||||
}
|
||||
|
||||
function CategoryTopSkill({ skill, maxWeight, hasReferenceScale }) {
|
||||
if (!skill) return null
|
||||
const pct = barFillPercent(skill, maxWeight, hasReferenceScale)
|
||||
return (
|
||||
<li className="skill-profile__row">
|
||||
<li className="skill-profile__cat-row">
|
||||
<div className="skill-profile__row-head">
|
||||
<span className="skill-profile__name" title={skill.skill_name}>
|
||||
{skill.skill_name}
|
||||
</span>
|
||||
<span className="skill-profile__pct">{skill.share_percent}%</span>
|
||||
<span className="skill-profile__pct" title="Trainingsgewicht (gewichtete Minuten)">
|
||||
{metricLabel(skill, hasReferenceScale)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="skill-profile__bar-track" aria-hidden="true">
|
||||
<div
|
||||
className="skill-profile__bar-fill"
|
||||
style={{ width: `${pct}%` }}
|
||||
/>
|
||||
<div className="skill-profile__bar-fill" style={{ width: `${pct}%` }} />
|
||||
</div>
|
||||
{hasReferenceScale ? (
|
||||
<span className="skill-profile__meta-hint">
|
||||
Absolut: {formatWeight(skillWeight(skill))} · Skala über alle Programme
|
||||
</span>
|
||||
) : null}
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
function CategoryGroupedProfile({ profile, ariaLabel }) {
|
||||
const groups = profile?.by_main_category || []
|
||||
const hasReferenceScale = Boolean(profile?.has_reference_scale)
|
||||
const maxWeight = useMemo(() => {
|
||||
let max = 1
|
||||
for (const mc of groups) {
|
||||
for (const cat of mc.categories || []) {
|
||||
const w = skillWeight(cat.top_skill)
|
||||
if (w > max) max = w
|
||||
}
|
||||
}
|
||||
return max
|
||||
}, [groups])
|
||||
|
||||
if (!groups.length) return null
|
||||
|
||||
return (
|
||||
<div className="skill-profile__by-category" aria-label={ariaLabel}>
|
||||
{groups.map((mc) => (
|
||||
<section key={mc.main_category_id ?? mc.main_category_name} className="skill-profile__main-cat">
|
||||
<h4 className="skill-profile__main-cat-title">{mc.main_category_name}</h4>
|
||||
<ul className="skill-profile__cat-list">
|
||||
{(mc.categories || []).map((cat) => (
|
||||
<li key={cat.category_id ?? cat.category_name} className="skill-profile__cat-item">
|
||||
<span className="skill-profile__cat-label">{cat.category_name}</span>
|
||||
<CategoryTopSkill
|
||||
skill={cat.top_skill}
|
||||
maxWeight={maxWeight}
|
||||
hasReferenceScale={hasReferenceScale}
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function topCategoryBadge(profile) {
|
||||
const parts = []
|
||||
for (const mc of profile?.by_main_category || []) {
|
||||
for (const cat of mc.categories || []) {
|
||||
const top = cat.top_skill
|
||||
if (!top) continue
|
||||
parts.push(`${cat.category_name}: ${top.skill_name}`)
|
||||
if (parts.length >= 2) return parts.join(' · ')
|
||||
}
|
||||
}
|
||||
return parts.join(' · ')
|
||||
}
|
||||
|
||||
/**
|
||||
* Gewichtetes Fähigkeiten-Profil (Phase 3) — Anzeige für Planungsartefakte.
|
||||
*/
|
||||
@@ -29,17 +111,13 @@ export default function SkillProfilePanel({
|
||||
loading = false,
|
||||
error = '',
|
||||
title = 'Fähigkeiten-Profil',
|
||||
hint = 'Aus verknüpften Übungen berechnet (Dauer, Vorkommen, Intensität, Stufen von/bis).',
|
||||
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.',
|
||||
defaultExpanded = true,
|
||||
}) {
|
||||
const [expanded, setExpanded] = useState(defaultExpanded)
|
||||
const [slotOpenId, setSlotOpenId] = useState(null)
|
||||
|
||||
const skills = profile?.skills || []
|
||||
const maxShare = useMemo(
|
||||
() => Math.max(...skills.map((s) => s.share_percent || 0), 1),
|
||||
[skills]
|
||||
)
|
||||
const badge = useMemo(() => topCategoryBadge(profile), [profile])
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
@@ -61,6 +139,11 @@ export default function SkillProfilePanel({
|
||||
!profile ||
|
||||
(profile.exercise_occurrence_count === 0 && profile.distinct_exercise_count === 0)
|
||||
|
||||
const categoryCount = (profile?.by_main_category || []).reduce(
|
||||
(n, mc) => n + (mc.categories?.length || 0),
|
||||
0
|
||||
)
|
||||
|
||||
return (
|
||||
<div className="card skill-profile">
|
||||
<button
|
||||
@@ -70,10 +153,8 @@ export default function SkillProfilePanel({
|
||||
aria-expanded={expanded}
|
||||
>
|
||||
<span className="skill-profile__toggle-title">{title}</span>
|
||||
{!noData && skills.length > 0 ? (
|
||||
<span className="skill-profile__toggle-badge">
|
||||
Top: {skills[0].skill_name} ({skills[0].share_percent}%)
|
||||
</span>
|
||||
{!noData && badge ? (
|
||||
<span className="skill-profile__toggle-badge">{badge}</span>
|
||||
) : null}
|
||||
<span className="skill-profile__toggle-icon" aria-hidden="true">
|
||||
{expanded ? '▾' : '▸'}
|
||||
@@ -101,31 +182,20 @@ export default function SkillProfilePanel({
|
||||
<strong>{profile.distinct_exercise_count}</strong> Übungen
|
||||
</span>
|
||||
<span>
|
||||
<strong>{skills.length}</strong> Fähigkeiten
|
||||
<strong>{profile.skills?.length ?? 0}</strong> Fähigkeiten
|
||||
</span>
|
||||
<span>
|
||||
<strong>{profile.exercise_occurrence_count}</strong> Positionen
|
||||
<strong>{categoryCount}</strong> Kategorien
|
||||
</span>
|
||||
<span>
|
||||
<strong>{formatWeight(profile.total_score ?? profile.total_weight)}</strong> Gesamt-Gewicht
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<ul className="skill-profile__list" aria-label="Fähigkeiten nach Gewicht">
|
||||
{skills.slice(0, 12).map((sk) => (
|
||||
<SkillBar key={sk.skill_id} skill={sk} maxShare={maxShare} />
|
||||
))}
|
||||
</ul>
|
||||
|
||||
{profile.by_category?.length > 1 ? (
|
||||
<div className="skill-profile__categories">
|
||||
<span className="skill-profile__categories-label">Nach Kategorie</span>
|
||||
<div className="skill-profile__category-chips">
|
||||
{profile.by_category.slice(0, 6).map((c) => (
|
||||
<span key={c.category} className="skill-profile__category-chip">
|
||||
{c.category} {c.share_percent}%
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
<CategoryGroupedProfile
|
||||
profile={profile}
|
||||
ariaLabel="Top-Fähigkeit je Kategorie"
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -135,7 +205,7 @@ export default function SkillProfilePanel({
|
||||
<ul className="skill-profile__slot-list">
|
||||
{slots.map((sl) => {
|
||||
const open = slotOpenId === sl.slot_id
|
||||
const top = sl.profile?.skills?.[0]
|
||||
const slotBadge = topCategoryBadge(sl.profile)
|
||||
return (
|
||||
<li key={sl.slot_id} className="skill-profile__slot-item">
|
||||
<button
|
||||
@@ -147,29 +217,19 @@ export default function SkillProfilePanel({
|
||||
<span>
|
||||
{(sl.slot_title || '').trim() || `Session ${(sl.sort_order ?? 0) + 1}`}
|
||||
</span>
|
||||
{top ? (
|
||||
<span className="skill-profile__slot-top">
|
||||
{top.skill_name} {top.share_percent}%
|
||||
</span>
|
||||
{slotBadge ? (
|
||||
<span className="skill-profile__slot-top">{slotBadge}</span>
|
||||
) : (
|
||||
<span className="skill-profile__slot-top skill-profile__slot-top--muted">
|
||||
{sl.exercise_occurrence_count > 0 ? 'ohne Fähigkeiten' : 'kein Ablauf'}
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
{open && sl.profile?.skills?.length > 0 ? (
|
||||
<ul className="skill-profile__list skill-profile__list--nested">
|
||||
{sl.profile.skills.slice(0, 6).map((sk) => (
|
||||
<SkillBar
|
||||
key={sk.skill_id}
|
||||
skill={sk}
|
||||
maxShare={Math.max(
|
||||
...sl.profile.skills.map((x) => x.share_percent || 0),
|
||||
1
|
||||
)}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
{open && sl.profile?.by_main_category?.length > 0 ? (
|
||||
<CategoryGroupedProfile
|
||||
profile={sl.profile}
|
||||
ariaLabel={`Fähigkeiten Session ${(sl.sort_order ?? 0) + 1}`}
|
||||
/>
|
||||
) : null}
|
||||
</li>
|
||||
)
|
||||
|
||||
@@ -975,7 +975,7 @@ export default function TrainingFrameworkProgramEditPage() {
|
||||
{!isNew ? (
|
||||
<SkillProfilePanel
|
||||
title="Fähigkeiten-Schwerpunkte (aus Übungen)"
|
||||
hint="Gewichtung nach geplanter Dauer, Häufigkeit, Intensität (niedrig/mittel/hoch) und Stufen-Spanne (von/bis). Vergleichbar mit manuell gesetzten Fokusbereichen in den Stammdaten."
|
||||
hint="Trainingsgewicht aus Dauer, Häufigkeit, Intensität und Stufen-Spanne. Pro Kategorie die stärkste Fähigkeit — Balken relativ zur Bibliothek, nicht 100 % innerhalb des Plans."
|
||||
profile={skillProfileData?.overall}
|
||||
slots={skillProfileData?.slots}
|
||||
loading={skillProfileLoading}
|
||||
|
||||
Reference in new issue
Block a user