This is unfortunately not production-ready code, but we need to get
something out there in the meantime. The RatingServicePublish's docblock
mentions some of the shortcomings, which will be addressed in the near
future.
There is also more documentation to come once we settle on an implementation.
DEV-4400
Forward validation failures were never updated to use the new Failure
object, so they ended up showing the default message. The problem was that
`ui.invalidateForm' was replacing the Failure object with a new one with an
empty message.
This change just does the same thing as the change and save events.
* src/client/Client.js (_forwardValidate): Invoke `#_genValidationMessages'
and `_dataValidator.updateFailures'. Stop calling `ui.invalidateForm'.
It looks like the metabucket is never initialized, so saving the quote is
right now the only thing that sets default values. That should be fixed in
the future.
This also begins adding tests for the terrible MongoServerDao, that could
use some refactoring.
* src/server/db/MongoServerDao.js: Make `meta' mutable. I had forgotten to
remove the code that mutates it (since our version of v8 right now does
not blow up for const assignments), so this is all that's needed.
* test/server/db/MongoServerDaoTest.js: New file to test this situation.
The metabucket expects vectors, not scalars. This causes the value
to be inaccessible when loaded by the ProcessManager for rating,
because it uses the Bucket implementation expecting vectors.
This wasn't noticed at first because it works through TAME's map.
* doc/bucket.texi (Metabucket): Clarify expected data format.
* src/server/db/MongoServerDao.js (saveQuote): Store
`meta.liza_timestamp_initial_rated' as a vector.
This value already existed on the document, but was inaccessible to external
systems. This is now accessible to e.g. raters.
* doc/bucket.texi (Metabucket): New section.
* src/server/db/MongoServerDao.js (saveQuote): Set initial quoted date as
liza_timestamp_initial_rated. Update metabucket keys individually so as
not to inadvertently overwrite the entire metabucket.
DEV-3715
Default data was converted to an empty array if the data evaluated to
false. We only want to convert it if it is undefined so values that are
false remain false.
Note that this permits animation if you just add:
transition: transform 0.25s;
for example to `dt.stack-header::before'. I didn't add that because nothing
else is animated atm, and so it seems out-of-place.
* src/css/base.css: Add styling for Accordion group.
DEV-3989
* src/client/ClientDependencyFactory.js: Remove old AccordionGroupUi
require, add new one.
* src/ui/group/AccordionGroupUi.js: New class.
* src/ui/group/GroupUi.js (postAddRow): Make virtual.
The `*_label' fields were not being properly set because they were being
considered just as every other expanded field, which is subject to other
considerations to ensure that we do not overwrite user data. Label fields,
on the other hand, _must_ always be set whenever the value changes, and are
_not_ modifiable by the user.
This codifies that `_label' assumption that I would like removed in the
future, but time does not permit that sort of refactoring right
now. Ideally, labels would be treated generically like any other expanded
field and have an attribute set of them that would change their expansion
behavior.
* src/client/dapi/DataApiMediator.js (_updateFieldData): Pass label field id
to `_populateWithMap'.
(_populateWithMap): Use it to always populate the label field when the key
matches, ignoring the other expansion criteria that would inhibit it.
* test/client/dapi/DataApiMediatorTest.js: Update test accordingly.
* src/dapi/DataApiManager.js (triggerFieldUpdate): Provide id to
`_genUiFieldData'.
(_genUiFieldData)[label_id]: New field. Return it as part of the return
object's `label_id' field.
DEV-4077
The postProcessResults method occasionally failed to be overridden in
local environments due to issues with how npm handled its dependencies.
For some reason, changing this to a public method corrected the issue. I
am changing this to, hopefully, prevent future frustrations.
* src/program/ProgramInit.js (_isKnownType): Account for ancient qtype
representation (as a string).
* src/server/quote/ProgramQuoteCleaner.js (_isKnownType): Likewise.
* test/program/ProgramInitTest.js: New test case for this situation.
* test/server/quote/ProgramQuoteCleanerTest.js: Modify existing test case
for this situation.
If only one supplier returns this datum and that supplier is ineligible,
then the value may not exist if this is not defined as an external
value. (Really, that's the bigger problem, but let's be resilient.)
* src/ui/group/TabbedBlockGroupUi.js (visit): Ignore missing index value.
These denote fields that are generated but do not actually have any data
associated with them. For example, select options with predicates have a
field generated so that they contribute to the group field count (so that
the group will automatically show/hide appropriately), but those should
never have values associated with them in the bucket.
This was manifesting as a nasty bug: The bucket contained a key for
generated options. When the quote is loaded, the client "empties" the
bucket. In doing so, it set the option value to the empty string, which had
the effect of rendering the dropdown useless---every value was the empty
string!
* src/program/ProgramInit.js (_isKnownType): New method.
(init): Use it and ignore fields with unknown types.
* src/server/Server.js: Add note that we shouldn't have this logic
duplicated between ProgramInit and ProgramQuoteCleaner.
* src/server/quote/ProgramQuoteCleaner.js (_fixGroup): Ignore fields with
unknown types.
(_isKnownType): New method.
* test/program/ProgramInitTest.js: Update existing tests. Add new.
* test/server/quote/ProgramQuoteCleanerTest.js: Test this case.
The new checkbox question type is setup with an empty validator. When
checked, it was not unchecking because it was trying to behave like the
"noyes" questions. I updated the logic to not behave like that if there
is only one checkbox in a group.
* src/server/quote/ProgramQuoteCleaner.js (clean): Add docblock.
Replace previous linked group cleaning with call to `_fixGroup'.
(_fixGroup): New method. Similar logic to previous linked group cleaning,
except that fields are never truncated.
(_fixLinkedGroups, _getLinkedIndexLength): Remove methods.
(_getGroupLength): New method determining group size from leader length,
which also accounts for linked groups.
* test/server/quote/ProgramQuoteCleanerTest.js: New test case.
* src/server/daemon/Daemon.js (getProgramController): Do not initialize
`no_results_url' to an empty string if not provided; instead, keep any
existing value. Otherwise, later calls with no arguments will clear
previously-set values.
DEV-3254