fix: Fix kanji card creation
This commit is contained in:
parent
bc2b3ac0b4
commit
5469ce7fec
|
@ -84,7 +84,8 @@ class CreateProductionCommand extends Command
|
|||
$sNote = $this->ankiService->getNote($noteIds[array_key_last($noteIds)]);
|
||||
|
||||
$newSlNote = SentenceListeningNote::fromNote($sNote, $term);
|
||||
if (!$this->ankiService->addNote($newSlNote, SentenceListeningNote::DECK)) {
|
||||
dd($newSlNote);
|
||||
if (!$this->ankiService->addNote($newSlNote)) {
|
||||
throw new \Exception('Failed to add note!');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,8 @@ class SentenceListeningNote extends Note
|
|||
}
|
||||
public function setTerm(Term $term): static
|
||||
{
|
||||
$this->fields['Vocab'] = $term->getKanji();
|
||||
$this->fields['VocabKanji'] = $term->getKanji();
|
||||
$this->fields['VocabFurigana'] = $term->getReading();
|
||||
$this->fields['VocabDef'] = $term->toAnkiVocabDef();
|
||||
$this->fields['SentKanji'] = $this->stringHighlight(
|
||||
$this->fields['SentKanji'],
|
||||
|
@ -50,9 +51,9 @@ class SentenceListeningNote extends Note
|
|||
return $note;
|
||||
}
|
||||
|
||||
public static function fromNote(Note $origNote, Term $term): static
|
||||
public static function fromNote(Note $origNote, Term $term): self
|
||||
{
|
||||
$slNote = new static();
|
||||
$slNote = new self();
|
||||
foreach (get_object_vars($origNote) as $prop => $value) {
|
||||
$slNote->$prop = $value;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue