BugFix decklist

This commit is contained in:
Your Name
2025-03-06 12:55:00 +01:00
parent 308e40ee9c
commit a718c87c63
3 changed files with 167 additions and 12 deletions

View File

@@ -502,25 +502,19 @@ export class DeckListComponent implements OnInit {
//const futureDueDates = dueDates.filter(date => date && date >= now);
if (dueDates.length > 0) {
const nextDate = dueDates.reduce((a, b) => (a < b ? a : b));
return nextDate;
return nextDate<today?today:nextDate;
}
return today;
}
getNextTrainingString(deck: Deck): string {
return this.daysSinceEpochToLocalDateString(this.getNextTrainingDate(deck));
}
// In deiner Component TypeScript Datei
isToday(epochDays: number): boolean {
return this.getTodayInDays() - epochDays === 0;
}
isBeforeToday(epochDays: number): boolean {
return this.getTodayInDays() - epochDays > 0;
}
// Methode zur Berechnung der Anzahl der zu bearbeitenden Wörter
getWordsToReview(deck: Deck): number {
const nextTraining = this.getNextTrainingDate(deck);
const today = this.getTodayInDays();
return deck.images.flatMap(image => image.boxes.map(box => (box.due ? box.due : null))).filter(e=>e===nextTraining).length;
return deck.images.flatMap(image => image.boxes.map(box => (box.due ? box.due : null))).filter(e=>e<=nextTraining).length;
}
getTodayInDays(): number {
const epoch = new Date(1970, 0, 1); // Anki uses UNIX epoch
@@ -541,4 +535,11 @@ export class DeckListComponent implements OnInit {
year: 'numeric',
}).format(utcDate);
}
// In deiner Component TypeScript Datei
isToday(epochDays: number): boolean {
return this.getTodayInDays() - epochDays === 0;
}
isBeforeToday(epochDays: number): boolean {
return this.getTodayInDays() - epochDays > 0;
}
}