feat(vocab): restore manual hard vocabulary removal

This commit is contained in:
Torsten Schulz (local)
2026-08-27 10:42:01 +02:00
parent 0f8142c386
commit 9d0164aa0d
2 changed files with 28 additions and 2 deletions

View File

@@ -78,6 +78,9 @@
<button v-else-if="showSkipButton" @click="skip"> <button v-else-if="showSkipButton" @click="skip">
{{ $t('socialnetwork.vocab.practice.skip') }} {{ $t('socialnetwork.vocab.practice.skip') }}
</button> </button>
<button v-if="isCurrentMarkedHard" @click="unmarkCurrentAsHard">
{{ $t('socialnetwork.vocab.practice.unmarkHard') }}
</button>
</div> </div>
<div v-if="lastWrongReview" class="solution-card solution-card--persistent"> <div v-if="lastWrongReview" class="solution-card solution-card--persistent">
@@ -414,12 +417,13 @@ export default {
}); });
return true; return true;
}, },
unmarkCurrentAsHard() { async unmarkCurrentAsHard() {
if (!this.current) return; if (!this.current) return;
const matchingKey = this.findMatchingHardKey(this.current); const matchingKey = this.findMatchingHardKey(this.current);
if (!matchingKey) return; if (!matchingKey) return;
this.removeHardEntriesForItem(this.current); this.removeHardEntriesForItem(this.current);
this.saveHardVocabMap(); this.saveHardVocabMap();
await this.clearSrsHardStatus(this.current);
this.maybeFinishHardPhase(); this.maybeFinishHardPhase();
}, },
addCurrentToCycle() { addCurrentToCycle() {
@@ -1252,7 +1256,7 @@ export default {
clearSrsHardStatus(item) { clearSrsHardStatus(item) {
const itemKey = String(item?.itemKey || item?.id || '').trim(); const itemKey = String(item?.itemKey || item?.id || '').trim();
if (!itemKey || !this.openParams?.courseId) return; if (!itemKey || !this.openParams?.courseId) return;
apiClient.patch('/api/vocab/srs/hard', { return apiClient.patch('/api/vocab/srs/hard', {
courseId: this.openParams.courseId, courseId: this.openParams.courseId,
itemKey itemKey
}).catch((error) => { }).catch((error) => {

View File

@@ -46,6 +46,13 @@
<strong>{{ entry.learning }}</strong> <strong>{{ entry.learning }}</strong>
<span>{{ entry.reference }}</span> <span>{{ entry.reference }}</span>
</div> </div>
<button
type="button"
class="button-secondary course-hard-list__remove"
@click="unmarkHardVocab(entry)"
>
{{ $t('socialnetwork.vocab.courses.unmarkVocabHard') }}
</button>
</div> </div>
</div> </div>
</section> </section>
@@ -606,6 +613,21 @@ export default {
this.hardVocabList = []; this.hardVocabList = [];
} }
}, },
async unmarkHardVocab(entry) {
const itemKey = String(entry?.itemKey || entry?.key || '').trim();
if (!itemKey || !this.courseId) return;
try {
await apiClient.patch('/api/vocab/srs/hard', {
courseId: this.courseId,
itemKey
});
this.hardVocabList = this.hardVocabList
.filter((item) => String(item?.itemKey || item?.key || '').trim() !== itemKey);
} catch (error) {
console.warn('Konnte die Hart-Markierung nicht entfernen:', error);
await this.refreshHardVocabList();
}
},
handleWindowFocus() { handleWindowFocus() {
this.refreshHardVocabList(); this.refreshHardVocabList();
this.syncSrsSessionProgress(); this.syncSrsSessionProgress();