Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Add support for filtering frequency metadata based on readings #450

Merged

Conversation

toasted-nutbread
Copy link
Collaborator

Resolves #382. Data format is as described in #382 (comment).

@toasted-nutbread toasted-nutbread added this to In progress in Database improvements Apr 12, 2020
@siikamiika
Copy link
Collaborator

Is the term metadata going to be imported into the database even if you switch data into an object? That part seems to be implicit to this code.

@toasted-nutbread
Copy link
Collaborator Author

Yeah, that is the intent. There is no conversion since the data is already validated by the schema and is in the expected format.

@siikamiika
Copy link
Collaborator

Ok, I was wondering if the DB schema had to be updated but seems that it supports storing objects as well.

@@ -562,6 +564,18 @@ class Translator {
return tagMetaList;
}

getFrequencyData(expression, data, dictionary, term) {
if (data !== null && typeof data === 'object') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use isObject as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one I think is fine to leave as-is; the Array.isArray check is not necessary for this case since it should have been validated during import. Additionally, even if somehow the value was an array, it won't be any more wrong than having an incorrectly formatted object.

@toasted-nutbread
Copy link
Collaborator Author

Ok, I was wondering if the DB schema had to be updated but seems that it supports storing objects as well.

Yeah, it's not an indexed property currently, but even indexes should be able to store any type of data:

Bear in mind that IndexedDB indexes can contain any JavaScript data type; IndexedDB uses the structured clone algorithm to serialize stored objects, which allows for storage of simple and complex objects.

@toasted-nutbread toasted-nutbread merged commit 9297eb4 into FooSoft:master Apr 18, 2020
Database improvements automation moved this from In progress to Done Apr 18, 2020
@toasted-nutbread toasted-nutbread mentioned this pull request Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Support for frequency lists with readings
2 participants