IO-1911 Round TTSB to 1 decimal.
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
import { Card } from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import {
|
||||
Bar,
|
||||
CartesianGrid,
|
||||
ComposedChart,
|
||||
LabelList,
|
||||
Legend,
|
||||
ReferenceLine,
|
||||
ResponsiveContainer,
|
||||
@@ -69,7 +67,7 @@ export function ScoreboardTicketsBar({ data, bodyshop }) {
|
||||
// barSize={20}
|
||||
fill={data.colors[idx]}
|
||||
>
|
||||
<LabelList position="top" />
|
||||
{/* <LabelList position="top" /> */}
|
||||
</Bar>
|
||||
))}
|
||||
</ComposedChart>
|
||||
|
||||
@@ -216,7 +216,10 @@ export default function ScoreboardTimeTickets() {
|
||||
|
||||
ret2.push(r);
|
||||
});
|
||||
|
||||
roundObject(ret);
|
||||
roundObject(totals);
|
||||
roundObject(ret2);
|
||||
console.log(ret);
|
||||
return {
|
||||
fixed: ret,
|
||||
timeperiod: {
|
||||
@@ -299,3 +302,18 @@ function getColorArray(num) {
|
||||
// }
|
||||
// return result;
|
||||
}
|
||||
|
||||
function roundObject(inputObj) {
|
||||
for (var key of Object.keys(inputObj)) {
|
||||
if (typeof inputObj[key] === "number" && inputObj[key] !== 0) {
|
||||
inputObj[key] =
|
||||
inputObj[key] && inputObj[key].toFixed
|
||||
? inputObj[key].toFixed(1)
|
||||
: inputObj[key]; //Math.round(inputObj[key] * 100) / 100;
|
||||
} else if (Array.isArray(inputObj[key])) {
|
||||
inputObj[key].forEach((item) => roundObject(item));
|
||||
} else if (typeof inputObj[key] === "object") {
|
||||
roundObject(inputObj[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,13 +73,13 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||
<Col span={12}>
|
||||
<Statistic
|
||||
title={t("scoreboard.labels.lastweek")}
|
||||
value={data.totalLastWeek.toFixed(1)}
|
||||
value={data.totalLastWeek}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Statistic
|
||||
title={t("scoreboard.labels.lastmonth")}
|
||||
value={data.totalLastMonth.toFixed(1)}
|
||||
value={data.totalLastMonth}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
@@ -87,13 +87,13 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||
<Col span={12}>
|
||||
<Statistic
|
||||
title={t("scoreboard.labels.thisweek")}
|
||||
value={data.totalThisWeek.toFixed(1)}
|
||||
value={data.totalThisWeek}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Statistic
|
||||
title={t("scoreboard.labels.thismonth")}
|
||||
value={data.totalThisMonth.toFixed(1)}
|
||||
value={data.totalThisMonth}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
@@ -101,7 +101,7 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||
<Col span={12}>
|
||||
<Statistic
|
||||
title={t("scoreboard.labels.totaloverperiod")}
|
||||
value={data.totalOverPeriod.toFixed(1)}
|
||||
value={data.totalOverPeriod}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
Reference in New Issue
Block a user