Value .00 is not a valid Decimal(5,2) when draftActive after upgrade to @cap-js/hana 1.3.1
Closed this issue · 3 comments
LeoZhangSH commented
Description of erroneous behaviour
we have an entity
StudyTreatmentPeriods
defined as below, with Decimal(5,2) data type.
entity Studies: {
scenarios : Composition of many db.StudyScenarios on scenarios.study = $self;
}
entity StudyScenarios: {
randomizationGroups : db.RandomizationGroups on randomizationGroups.scenario = $self;
}
...
entity StudyTreatmentPeriods : cuid, managed {
...
overage : Decimal(5,2);
dropout : Decimal(5,2);
noSwitchRate : Decimal(5,2);
}
After we upgrade @cap-js/hana from 1.2.0 to 1.3.1, when we save study (draftActive), we got below error
[cds] - Error: Multiple errors occurred. Please see the details for more information.
at ApplicationService.commonGenericInput (/Users/I530479/Desktop/Dev/gitcode/ctsm/ctsm-v8/node_modules/@sap/cds/libx/_runtime/common/generic/input.js:242:27)
at ApplicationService.handle (/Users/I530479/Desktop/Dev/gitcode/ctsm/ctsm-v8/node_modules/@sap/cds/lib/srv/srv-dispatch.js:52:53)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ApplicationService.handle (/Users/I530479/Desktop/Dev/gitcode/ctsm/ctsm-v8/node_modules/@sap/cds/libx/_runtime/common/Service.js:84:16)
at async cds.ApplicationService.handle (/Users/I530479/Desktop/Dev/gitcode/ctsm/ctsm-v8/node_modules/@sap/cds/libx/_runtime/fiori/lean-draft.js:588:20) {
statusCode: 400,
details: [
{
message: 'Value .000 is not a valid Decimal(15,3)',
target: 'in/scenarios(ID=6c40da0d-3b8d-4127-9e2a-5a26d4ebc868,IsActiveEntity=false)/treatments(ID=ca5983fc-3328-4777-98c3-444ec1a8d067,IsActiveEntity=false)/kitTypeAssignments(ID=04d78411-6a43-4c07-9d60-d262c15f0372,IsActiveEntity=false)/kitQtyBasedOnBulk',
args: [Array]
},
{
message: 'Value .00 is not a valid Decimal(5,2)',
target: 'in/scenarios(ID=6c40da0d-3b8d-4127-9e2a-5a26d4ebc868,IsActiveEntity=false)/randomizationGroups(ID=d1e2a55a-be24-4946-a1ab-6e1a396a254f,IsActiveEntity=false)/treatmentSchedule(ID=b1d38b35-fd46-42f9-bc9b-060945fae070,IsActiveEntity=false)/treatmentPeriods(ID=6834cc5a-b3cb-40bc-9074-771e3f55fa97,IsActiveEntity=false)/dropout',
args: [Array]
},
...
In the after read handler, the data was like below, but it works on @cap-js/hana 1.3.0, after we upgrade to 1.3.1, it failed.
Detailed steps to reproduce
For example (→ replace by appropriate ones for your case):
- git clone https://github.wdf.sap.corp/ctsm/ctsm
Details about your project
Remove the lines not applicable, and fill in versions for remaining ones:
Your Project Name | https://github.wdf.sap.corp/ctsm/ctsm |
---|---|
Node.js | v20.11.1 |
@sap/cds | 8.2.2 |
@sap/cds-compiler | 5.3.2 |
@sap/cds-dk | 8.2.2 |
@sap/cds-dk (global) | 7.1.0 |
@sap/eslint-plugin-cds | 3.0.5 |
@sap/cds-mtxs | 2.1.0 |
Run
cds v -i
in your project root to generate this
johannes-vogel commented
LeoZhangSH commented
Thanks @johannes-vogel ,
I adjusted the PR code change in my local, and it works now.
Thanks
BRs
Leo
johannes-vogel commented
will be fixed with cap-js/hana 1.3.2 in a couple of minutes