From d95c1d00c5094de98aeda5caa103175334ba18a1 Mon Sep 17 00:00:00 2001 From: zino Date: Wed, 4 Aug 2021 16:00:13 +0200 Subject: [PATCH] fixed sort highest amount: needed parseFloat for right sort, were strings before --- client/src/modules/state.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/src/modules/state.ts b/client/src/modules/state.ts index ef9ceaf..5ad6304 100644 --- a/client/src/modules/state.ts +++ b/client/src/modules/state.ts @@ -2,6 +2,7 @@ import { config } from "./config"; import * as I from "../types/types"; import * as XMLHelper from "./xmlhelper"; import * as jBoxHelper from "./jBoxHelper"; +import Utils from "./utils"; export function addSeatToState(inSelectedSeat: I.JSCSelectedSeat): void { addSeatObjToState(inSelectedSeat); @@ -11,7 +12,7 @@ export function addSeatToState(inSelectedSeat: I.JSCSelectedSeat): void { if (pricescaleObj) { //const firstBuyerTypeID: string = pricescaleObj.buyer_type[0].id[0]; // needs to be highest amount const mostExpensiveBuyerTypeID: string = pricescaleObj.buyer_type.reduce((prev, current) => { - return (prev.price[0] > current.price[0]) ? prev : current + return (parseFloat(prev.price[0]) > parseFloat(current.price[0])) ? prev : current }).id[0] const buyerTypeCode: string | undefined = XMLHelper.getBuyerTypeCodeByBuyerTypeID(mostExpensiveBuyerTypeID); @@ -19,7 +20,7 @@ export function addSeatToState(inSelectedSeat: I.JSCSelectedSeat): void { addSeatsItemToState(selectedSeatsArrItem); } else - console.warn(`Cannot find corresponding venueXML pricescaleObj for pricescale with ID ${pricescaleID}`); + Utils.consoleLog(`Cannot find corresponding venueXML pricescaleObj for pricescale with ID ${pricescaleID}`); } export function removeSeatFromState(inSelectedSeat: I.JSCSelectedSeat): void {