feat: Change deck locations & use constants for SL

This commit is contained in:
Dendy 2025-09-20 06:53:05 +02:00
parent 14cde2ee70
commit 0da46316f2
4 changed files with 4 additions and 3 deletions

View File

@ -84,7 +84,7 @@ class CreateProductionCommand extends Command
$sNote = $this->ankiService->getNote($noteIds[array_key_last($noteIds)]); $sNote = $this->ankiService->getNote($noteIds[array_key_last($noteIds)]);
$newSlNote = SentenceListeningNote::fromNote($sNote, $term); $newSlNote = SentenceListeningNote::fromNote($sNote, $term);
if (!$this->ankiService->addNote($newSlNote, 'production')) { if (!$this->ankiService->addNote($newSlNote, SentenceListeningNote::DECK)) {
throw new \Exception('Failed to add note!'); throw new \Exception('Failed to add note!');
} }
} }

View File

@ -5,6 +5,7 @@ namespace App\Entity;
class SentenceListeningNote extends Note class SentenceListeningNote extends Note
{ {
const MODEL_NAME = 'Japanese sentences listening'; const MODEL_NAME = 'Japanese sentences listening';
const DECK = 'jp::production';
private ?array $mediaInfo = []; private ?array $mediaInfo = [];
private ?Term $term = null; private ?Term $term = null;

View File

@ -7,7 +7,7 @@ use App\Utils\Number;
class UnicodeNote extends Note class UnicodeNote extends Note
{ {
const string MODEL_NAME = 'Unicode'; const string MODEL_NAME = 'Unicode';
const string DECK = 'unicode'; const string DECK = 'jp::unicode';
private ?int $codepoint = null; private ?int $codepoint = null;
/** @var Term[] */ /** @var Term[] */

View File

@ -41,7 +41,7 @@ class AnkiService
public function addNote(Note &$note, string $deckName): bool public function addNote(Note &$note, string $deckName): bool
{ {
$note->setId($this->request('addNote', ['note' => [ $note->setId($this->request('addNote', ['note' => [
'deckName' => $deckName, 'deckName' => $deckName,
'modelName' => $note->getModel(), 'modelName' => $note->getModel(),
'fields' => $note->getFields(), 'fields' => $note->getFields(),
'options' => ['allowDuplicate' => false], 'options' => ['allowDuplicate' => false],