From fd9eac06f67c178cf341fc1d74e64b18aad3a09c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sat, 18 Mar 2023 20:37:06 +0800 Subject: [PATCH] Merged the code in the #initializeSummaryEditors method into the constructor in the JavaScript JournalEntryEditor class. --- .../static/js/journal-entry-editor.js | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/accounting/static/js/journal-entry-editor.js b/src/accounting/static/js/journal-entry-editor.js index ec7efe3..5db61d8 100644 --- a/src/accounting/static/js/journal-entry-editor.js +++ b/src/accounting/static/js/journal-entry-editor.js @@ -200,7 +200,7 @@ class JournalEntryEditor { * The summary editors * @type {{debit: SummaryEditor, credit: SummaryEditor}} */ - #summaryEditors; + #summaryEditors = {}; /** * The account selectors @@ -230,7 +230,9 @@ class JournalEntryEditor { this.#accountError = document.getElementById(this.#prefix + "-account-error") this.#amount = document.getElementById(this.#prefix + "-amount"); this.#amountError = document.getElementById(this.#prefix + "-amount-error"); - this.#summaryEditors = this.#initializeSummaryEditors(); + for (const entryType of ["debit", "credit"]) { + this.#summaryEditors[entryType] = new SummaryEditor(this, entryType); + } for (const entryType of ["debit", "credit"]) { this.#accountSelectors[entryType] = new AccountSelector(this, entryType); } @@ -252,19 +254,6 @@ class JournalEntryEditor { }; } - /** - * Initializes the summary editors. - * - * @return {{debit: SummaryEditor, credit: SummaryEditor}} the summary editors - */ - #initializeSummaryEditors() { - const editors = {}; - for (const entryType of ["debit", "credit"]) { - editors[entryType] = new SummaryEditor(this, entryType); - } - return editors; - } - /** * Saves the original entry from the original entry selector. *