fix: If no note is found with that vocab in SentKanji, look for VocabKanji

This commit is contained in:
Dendy 2025-04-16 09:23:12 +02:00
parent 1ff04811cb
commit 0eab07c497
1 changed files with 9 additions and 0 deletions

View File

@ -71,6 +71,15 @@ class CreateProductionCommand extends Command
$term->getKanji(),
SentenceNote::MODEL_NAME,
));
if (count($noteIds) <= 0) {
$noteIds = $this->ankiService->findNotesIds(sprintf(
'"VocabKanji:*%s*" "note:%s"',
$term->getKanji(),
SentenceNote::MODEL_NAME,
));
}
$sNote = $this->ankiService->getNote($noteIds[array_key_last($noteIds)]);
$newSlNote = SentenceListeningNote::fromNote($sNote, $term);