From f3e0a0c0bec8ea637067d8b23638a115cf48c8f0 Mon Sep 17 00:00:00 2001 From: Clinton Alexander Date: Thu, 7 Jul 2016 22:59:05 +0100 Subject: [PATCH] Fixed error in submitting the a new deal via web form. --- src/main/webdemo/js/app.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/webdemo/js/app.js b/src/main/webdemo/js/app.js index 0f5e093324..46c1c9785b 100644 --- a/src/main/webdemo/js/app.js +++ b/src/main/webdemo/js/app.js @@ -127,6 +127,14 @@ let dealViewModel = { notary: "Bank A" }; +// TODO: Fill out this lookup table and use it to inject into the view. +let dayCountBasisLookup = { + "30/360": { + "day": "D30", + "year": "Y360" + } +} + let Deal = function(dealViewModel) { let now = new Date(); let tradeId = `T${now.getUTCFullYear()}-${now.getUTCMonth()}-${now.getUTCDate()}.${now.getUTCHours()}:${now.getUTCMinutes()}:${now.getUTCSeconds()}:${now.getUTCMilliseconds()}` @@ -145,8 +153,16 @@ let Deal = function(dealViewModel) { common.tradeID = tradeId; fixedLeg.effectiveDate = formatDateForNode(fixedLeg.effectiveDate); fixedLeg.terminationDate = formatDateForNode(fixedLeg.terminationDate); + fixedLeg.fixedRate = { ratioUnit: { value: fixedLeg.fixedRate } }; + fixedLeg.dayCountBasisDay = dayCountBasisLookup[fixedLeg.dayCountBasis].day; + fixedLeg.dayCountBasisYear = dayCountBasisLookup[fixedLeg.dayCountBasis].year; + delete fixedLeg.dayCountBasis; + floatingLeg.effectiveDate = formatDateForNode(floatingLeg.effectiveDate); floatingLeg.terminationDate = formatDateForNode(floatingLeg.terminationDate); + floatingLeg.dayCountBasisDay = dayCountBasisLookup[floatingLeg.dayCountBasis].day; + floatingLeg.dayCountBasisYear = dayCountBasisLookup[floatingLeg.dayCountBasis].year; + delete floatingLeg.dayCountBasis; let json = { fixedLeg: fixedLeg,