From 89b6712d526e76833fe1f1e6f19ea4cd3819022a Mon Sep 17 00:00:00 2001 From: Philemon Ukane Date: Mon, 28 Aug 2023 20:25:20 +0100 Subject: [PATCH] review changes Signed-off-by: Philemon Ukane --- client/webserver/site/src/html/bodybuilder.tmpl | 2 +- client/webserver/site/src/js/markets.ts | 2 +- client/webserver/site/src/js/orderutil.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/webserver/site/src/html/bodybuilder.tmpl b/client/webserver/site/src/html/bodybuilder.tmpl index 669f8f569b..58f2988ef4 100644 --- a/client/webserver/site/src/html/bodybuilder.tmpl +++ b/client/webserver/site/src/html/bodybuilder.tmpl @@ -103,7 +103,7 @@ {{end}} {{define "bottom"}} - + {{end}} diff --git a/client/webserver/site/src/js/markets.ts b/client/webserver/site/src/js/markets.ts index 20318851ff..c0ca165c45 100644 --- a/client/webserver/site/src/js/markets.ts +++ b/client/webserver/site/src/js/markets.ts @@ -1568,7 +1568,7 @@ export default class MarketsPage extends BasePage { market order rate. */ marketOrderRateString (ord: Order, mkt: CurrentMarket) :string { - if (!ord.matches) return intl.prep(intl.ID_MARKET_ORDER) + if (!ord.matches?.length) return intl.prep(intl.ID_MARKET_ORDER) let rateStr = Doc.formatRateFullPrecision(OrderUtil.averageRate(ord), mkt.baseUnitInfo, mkt.quoteUnitInfo, mkt.cfg.ratestep) if (ord.matches.length > 1) rateStr = '~ ' + rateStr // ~ only makes sense if the order has more than one match return rateStr diff --git a/client/webserver/site/src/js/orderutil.ts b/client/webserver/site/src/js/orderutil.ts index 2641551e83..70222df2e3 100644 --- a/client/webserver/site/src/js/orderutil.ts +++ b/client/webserver/site/src/js/orderutil.ts @@ -123,7 +123,7 @@ export function settled (order: Order) { /* averageRateString returns a formatting string containing the average rate of the matches that have been filled for a market order. */ export function averageMarketOrderRateString (ord: Order): string { - if (!ord.matches) return intl.prep(intl.ID_MARKET_ORDER) + if (!ord.matches?.length) return intl.prep(intl.ID_MARKET_ORDER) let rateStr = Doc.formatCoinValue(app().conventionalRate(ord.baseID, ord.quoteID, averageRate(ord))) if (ord.matches.length > 1) rateStr = '~ ' + rateStr // "~" only makes sense if the order has more than one match. return rateStr @@ -132,7 +132,7 @@ export function averageMarketOrderRateString (ord: Order): string { /* averageRate returns a the average rate of the matches that have been filled in an order. */ export function averageRate (ord: Order): number { - if (!ord.matches) return 0 + if (!ord.matches?.length) return 0 let rateProduct = 0 let baseQty = 0 for (const m of ord.matches) {