Revised the #isQueryMatched method to always does partial match in the JavaScript OriginalLineItem class. Removed the full match from the query values. It is really wierd to type in the half with no match until you type the full term. It may create misunderstanding that there is no further match if you keep typing.
This commit is contained in:
parent
8c1ecd6eac
commit
c865141583
@ -760,7 +760,7 @@ class JournalEntryLineItem(db.Model):
|
|||||||
setattr(self, "__net_balance", net_balance)
|
setattr(self, "__net_balance", net_balance)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def query_values(self) -> tuple[list[str], list[str]]:
|
def query_values(self) -> list[str]:
|
||||||
"""Returns the values to be queried.
|
"""Returns the values to be queried.
|
||||||
|
|
||||||
:return: The values to be queried.
|
:return: The values to be queried.
|
||||||
@ -772,8 +772,8 @@ class JournalEntryLineItem(db.Model):
|
|||||||
|
|
||||||
journal_entry_day: date = self.journal_entry.date
|
journal_entry_day: date = self.journal_entry.date
|
||||||
description: str = "" if self.description is None else self.description
|
description: str = "" if self.description is None else self.description
|
||||||
return ([description],
|
return [description,
|
||||||
[str(journal_entry_day.year),
|
str(journal_entry_day.year),
|
||||||
"{}/{}".format(journal_entry_day.year,
|
"{}/{}".format(journal_entry_day.year,
|
||||||
journal_entry_day.month),
|
journal_entry_day.month),
|
||||||
"{}/{}".format(journal_entry_day.month,
|
"{}/{}".format(journal_entry_day.month,
|
||||||
@ -782,7 +782,7 @@ class JournalEntryLineItem(db.Model):
|
|||||||
journal_entry_day.month,
|
journal_entry_day.month,
|
||||||
journal_entry_day.day),
|
journal_entry_day.day),
|
||||||
format_amount(self.amount),
|
format_amount(self.amount),
|
||||||
format_amount(self.net_balance)])
|
format_amount(self.net_balance)]
|
||||||
|
|
||||||
|
|
||||||
class Option(db.Model):
|
class Option(db.Model):
|
||||||
|
@ -273,7 +273,7 @@ class OriginalLineItem {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The values to query against
|
* The values to query against
|
||||||
* @type {string[][]}
|
* @type {string[]}
|
||||||
*/
|
*/
|
||||||
#queryValues;
|
#queryValues;
|
||||||
|
|
||||||
@ -366,16 +366,11 @@ class OriginalLineItem {
|
|||||||
if (query === "") {
|
if (query === "") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (const queryValue of this.#queryValues[0]) {
|
for (const queryValue of this.#queryValues) {
|
||||||
if (queryValue.toLowerCase().includes(query.toLowerCase())) {
|
if (queryValue.toLowerCase().includes(query.toLowerCase())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const queryValue of this.#queryValues[1]) {
|
|
||||||
if (queryValue === query) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user