From 0eab07c49711b07fa09d13c1331b9b100b66df92 Mon Sep 17 00:00:00 2001 From: Dendy Faist Date: Wed, 16 Apr 2025 09:23:12 +0200 Subject: [PATCH] fix: If no note is found with that vocab in SentKanji, look for VocabKanji --- src/Command/CreateProductionCommand.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Command/CreateProductionCommand.php b/src/Command/CreateProductionCommand.php index 0cf76c2..7145d14 100644 --- a/src/Command/CreateProductionCommand.php +++ b/src/Command/CreateProductionCommand.php @@ -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);