feat: aktualisiere Übungsanzeige, um synthetische Kapitel-MCs auszuschließen
All checks were successful
Deploy to production / deploy (push) Successful in 2m6s
All checks were successful
Deploy to production / deploy (push) Successful in 2m6s
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
class="tab-button"
|
||||
>
|
||||
{{ $t('socialnetwork.vocab.courses.exercises') }}
|
||||
<span v-if="hasExercises" class="exercise-count">({{ effectiveExercises?.length || 0 }})</span>
|
||||
<span v-if="hasExercises" class="exercise-count">({{ displayExercises?.length || 0 }})</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
</div>
|
||||
<div class="lesson-meta-item">
|
||||
<span class="lesson-meta-label">{{ $t('socialnetwork.vocab.courses.exerciseLoad') }}</span>
|
||||
<strong>{{ effectiveExercises?.length || 0 }} {{ $t('socialnetwork.vocab.courses.exercisesShort') }}</strong>
|
||||
<strong>{{ displayExercises?.length || 0 }} {{ $t('socialnetwork.vocab.courses.exercisesShort') }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@@ -557,7 +557,7 @@
|
||||
<div class="exercise-flow-header__stats">
|
||||
<div class="exercise-flow-stat">
|
||||
<span>{{ $t('socialnetwork.vocab.courses.exerciseProgressLabel') }}</span>
|
||||
<strong>{{ exerciseCorrectCount }}/{{ effectiveExercises.length }}</strong>
|
||||
<strong>{{ exerciseCorrectCount }}/{{ displayExercises.length }}</strong>
|
||||
</div>
|
||||
<div class="exercise-flow-stat">
|
||||
<span>{{ $t('socialnetwork.vocab.courses.successRate') }}</span>
|
||||
@@ -1367,15 +1367,30 @@ export default {
|
||||
}
|
||||
return [];
|
||||
},
|
||||
// Visible exercises for UI counts: exclude synthetic chapter MCs (ids starting with 'syn-')
|
||||
displayExercises() {
|
||||
try {
|
||||
const raw = this.effectiveExercises || [];
|
||||
return raw.filter((e) => {
|
||||
try {
|
||||
return !(typeof e.id === 'string' && e.id.startsWith('syn-'));
|
||||
} catch (err) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
return this.effectiveExercises || [];
|
||||
}
|
||||
},
|
||||
exerciseCorrectCount() {
|
||||
return this.effectiveExercises.filter((exercise) => Boolean(this.exerciseResults[exercise.id]?.correct)).length;
|
||||
return this.displayExercises.filter((exercise) => Boolean(this.exerciseResults[exercise.id]?.correct)).length;
|
||||
},
|
||||
exerciseAnsweredCount() {
|
||||
return this.effectiveExercises.filter((exercise) => Boolean(this.exerciseResults[exercise.id])).length;
|
||||
return this.displayExercises.filter((exercise) => Boolean(this.exerciseResults[exercise.id])).length;
|
||||
},
|
||||
exerciseProgressPercent() {
|
||||
if (!this.effectiveExercises.length) return 0;
|
||||
return Math.round((this.exerciseCorrectCount / this.effectiveExercises.length) * 100);
|
||||
if (!this.displayExercises.length) return 0;
|
||||
return Math.round((this.exerciseCorrectCount / this.displayExercises.length) * 100);
|
||||
},
|
||||
exerciseTargetScore() {
|
||||
return Number(this.lesson?.targetScorePercent) || 80;
|
||||
|
||||
Reference in New Issue
Block a user