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,4 +1,9 @@
|
||||
import { formatDurationDisplay, formatSessionDurationRange } from './trainingDurationUtils'
|
||||
import {
|
||||
frameworkSkillSummaryKey,
|
||||
maxSelectedSkillClubPercent,
|
||||
skillEntryFromSummary,
|
||||
} from './skillProfileListHelpers'
|
||||
|
||||
export function frameworkSessionDurationLabel(row) {
|
||||
return formatSessionDurationRange(row?.session_duration_min, row?.session_duration_max, {
|
||||
@@ -109,6 +114,10 @@ export const EMPTY_FRAMEWORK_IMPORT_FILTERS = {
|
||||
durationRangeFrom: '',
|
||||
durationRangeTo: '',
|
||||
durationPresetMin: null,
|
||||
skillIds: [],
|
||||
skillSort: 'title',
|
||||
skillMinClubPercent: 0,
|
||||
skillDisplayLimit: 10,
|
||||
}
|
||||
|
||||
export function hasActiveFrameworkImportFilters(filters = {}) {
|
||||
@@ -122,6 +131,9 @@ export function hasActiveFrameworkImportFilters(filters = {}) {
|
||||
if (String(f.durationRangeTo || '').trim() !== '') return true
|
||||
}
|
||||
if (f.durationMode === 'preset' && f.durationPresetMin != null) return true
|
||||
if ((f.skillIds || []).length) return true
|
||||
if (Number(f.skillMinClubPercent) > 0) return true
|
||||
if (f.skillSort === 'skill_strength' && (f.skillIds || []).length) return true
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -136,6 +148,17 @@ export function summarizeFrameworkImportFilters(filters = {}, catalogs = {}) {
|
||||
|
||||
const nameById = (list, id) => list?.find((x) => String(x.id) === String(id))?.name || id
|
||||
|
||||
if ((f.skillIds || []).length) {
|
||||
const names = f.skillIds.map((id) => nameById(catalogs.skills, id))
|
||||
parts.push(`Fähigkeiten: ${names.join(', ')}`)
|
||||
}
|
||||
if (Number(f.skillMinClubPercent) > 0) {
|
||||
parts.push(`mind. ${f.skillMinClubPercent}% vom Vereins-Maximum`)
|
||||
}
|
||||
if (f.skillSort === 'skill_strength' && (f.skillIds || []).length) {
|
||||
parts.push('Sortierung: Fähigkeiten-Stärke')
|
||||
}
|
||||
|
||||
if ((f.focusAreaIds || []).length) {
|
||||
const names = f.focusAreaIds.map((id) => nameById(catalogs.focusAreas, id))
|
||||
parts.push(`Fokus: ${names.join(', ')}`)
|
||||
@@ -167,14 +190,16 @@ export function summarizeFrameworkImportFilters(filters = {}, catalogs = {}) {
|
||||
/**
|
||||
* Client-Filter für Rahmenprogramm-Auswahl (Liste / Import-Dialog).
|
||||
*/
|
||||
export function filterFrameworkPrograms(rows, filters = {}) {
|
||||
export function filterFrameworkPrograms(rows, filters = {}, skillSummaries = null) {
|
||||
const f = { ...EMPTY_FRAMEWORK_IMPORT_FILTERS, ...filters }
|
||||
const q = (f.query || '').trim().toLowerCase()
|
||||
const focusIds = new Set((f.focusAreaIds || []).map(String))
|
||||
const typeIds = new Set((f.trainingTypeIds || []).map(String))
|
||||
const tgIds = new Set((f.targetGroupIds || []).map(String))
|
||||
const skillIds = f.skillIds || []
|
||||
const minClubPct = Number(f.skillMinClubPercent) || 0
|
||||
|
||||
return (rows || []).filter((r) => {
|
||||
let list = (rows || []).filter((r) => {
|
||||
if (q) {
|
||||
const blob = [
|
||||
r.title,
|
||||
@@ -212,6 +237,32 @@ export function filterFrameworkPrograms(rows, filters = {}) {
|
||||
|
||||
return true
|
||||
})
|
||||
|
||||
if (skillIds.length && skillSummaries) {
|
||||
list = list.filter((r) => {
|
||||
const summary = skillSummaries[frameworkSkillSummaryKey(r.id)]
|
||||
if (!summary) return minClubPct === 0
|
||||
return skillIds.some((sid) => {
|
||||
const sk = skillEntryFromSummary(summary, sid)
|
||||
if (!sk) return false
|
||||
const pct = sk.universal_percent
|
||||
if (pct == null) return minClubPct === 0
|
||||
return pct >= minClubPct
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
if (f.skillSort === 'skill_strength' && skillIds.length && skillSummaries) {
|
||||
list = [...list].sort((a, b) => {
|
||||
const sa = skillSummaries[frameworkSkillSummaryKey(a.id)]
|
||||
const sb = skillSummaries[frameworkSkillSummaryKey(b.id)]
|
||||
const pa = maxSelectedSkillClubPercent(sa, skillIds) ?? -1
|
||||
const pb = maxSelectedSkillClubPercent(sb, skillIds) ?? -1
|
||||
return pb - pa
|
||||
})
|
||||
}
|
||||
|
||||
return list
|
||||
}
|
||||
|
||||
export function frameworkProgramOptionLabel(row) {
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
export function frameworkSkillSummaryKey(id) {
|
||||
return `framework_program:${id}`
|
||||
}
|
||||
|
||||
export function moduleSkillSummaryKey(id) {
|
||||
return `training_module:${id}`
|
||||
}
|
||||
|
||||
export function skillEntryFromSummary(summary, skillId) {
|
||||
if (!summary?.skills) return null
|
||||
return summary.skills.find((s) => String(s.skill_id) === String(skillId)) || null
|
||||
}
|
||||
|
||||
export function maxSelectedSkillClubPercent(summary, skillIds = []) {
|
||||
if (!summary || !skillIds.length) return null
|
||||
let max = null
|
||||
for (const id of skillIds) {
|
||||
const sk = skillEntryFromSummary(summary, id)
|
||||
if (!sk) continue
|
||||
const pct = sk.universal_percent
|
||||
if (pct == null) continue
|
||||
if (max == null || pct > max) max = pct
|
||||
}
|
||||
return max
|
||||
}
|
||||
|
||||
export function formatClubPercent(value) {
|
||||
if (value == null || !Number.isFinite(Number(value))) return '—'
|
||||
const n = Number(value)
|
||||
return n % 1 === 0 ? `${n}%` : `${n.toFixed(1)}%`
|
||||
}
|
||||
|
||||
export function artifactTypeLabel(type) {
|
||||
if (type === 'framework_program') return 'Rahmenprogramm'
|
||||
if (type === 'training_module') return 'Modul'
|
||||
if (type === 'progression_graph') return 'Regressionspfad'
|
||||
return type || 'Artefakt'
|
||||
}
|
||||
|
||||
export function artifactPath(ref) {
|
||||
if (!ref) return null
|
||||
if (ref.artifact_type === 'framework_program') {
|
||||
return `/planning/framework-programs/${ref.artifact_id}`
|
||||
}
|
||||
if (ref.artifact_type === 'training_module') {
|
||||
return `/planning/training-modules/${ref.artifact_id}`
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/** Zeilen für Kompakt-Anzeige: gewählte Fähigkeiten oder Top je Kategorie. */
|
||||
export function compactSkillDisplayRows(summary, { skillIds = [], limit = 6 } = {}) {
|
||||
if (!summary) return []
|
||||
if (skillIds.length) {
|
||||
return skillIds
|
||||
.map((id) => skillEntryFromSummary(summary, id))
|
||||
.filter(Boolean)
|
||||
.sort((a, b) => (b.universal_percent ?? 0) - (a.universal_percent ?? 0))
|
||||
.slice(0, limit)
|
||||
}
|
||||
return (summary.top_by_category || []).slice(0, limit)
|
||||
}
|
||||
Reference in new issue
Block a user