fix
This commit is contained in:
parent
af01e68047
commit
7bd832495b
@ -116,33 +116,32 @@ const GeneralItemTimeConv = ({
|
|||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(700));
|
const isMobile = useMediaQuery(theme.breakpoints.down(700));
|
||||||
|
|
||||||
const data = Object.entries(general)
|
const data = Object.entries(general).sort((a, b) => a[0] - b[0]);
|
||||||
.sort((a, b) => a[0] - b[0]);
|
|
||||||
|
|
||||||
const days = [...data].map(e => e[0])
|
const days = [...data].map((e) => e[0]);
|
||||||
|
|
||||||
let buffer = 0
|
let buffer = 0;
|
||||||
|
|
||||||
const time = [...data].map(e => {
|
const time = [...data].map((e) => {
|
||||||
if (e[1] > 0) {
|
if (e[1] > 0) {
|
||||||
buffer = e[1]
|
buffer = e[1];
|
||||||
}
|
}
|
||||||
return buffer
|
return buffer;
|
||||||
})
|
});
|
||||||
|
|
||||||
|
console.log("data", data);
|
||||||
console.log("data", data)
|
console.log(
|
||||||
console.log("time", time.reduce((a, b) => (Number(a) + Number(b)), 0))
|
"time",
|
||||||
console.log("time", getCalculatedTime(time.reduce((a, b) => (Number(a) + Number(b)), 0)))
|
time.reduce((a, b) => Number(a) + Number(b), 0),
|
||||||
console.log("days", days.length)
|
);
|
||||||
const numberValue = calculateTime ?
|
console.log(
|
||||||
(
|
"time",
|
||||||
(time.reduce((a, b) => (Number(a) + Number(b)), 0))
|
getCalculatedTime(time.reduce((a, b) => Number(a) + Number(b), 0)),
|
||||||
/
|
);
|
||||||
(days.length)
|
console.log("days", days.length);
|
||||||
) || 0
|
const numberValue = calculateTime
|
||||||
:
|
? time.reduce((a, b) => Number(a) + Number(b), 0) / days.length || 0
|
||||||
conversionValue
|
: conversionValue;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
Object.keys(general).length === 0 ||
|
Object.keys(general).length === 0 ||
|
||||||
@ -153,7 +152,6 @@ const GeneralItemTimeConv = ({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper
|
<Paper
|
||||||
sx={{
|
sx={{
|
||||||
@ -164,7 +162,9 @@ const GeneralItemTimeConv = ({
|
|||||||
>
|
>
|
||||||
<Typography sx={{ margin: "20px 20px 0" }}>{title}</Typography>
|
<Typography sx={{ margin: "20px 20px 0" }}>{title}</Typography>
|
||||||
<Typography sx={{ margin: "10px 20px 0", fontWeight: "bold" }}>
|
<Typography sx={{ margin: "10px 20px 0", fontWeight: "bold" }}>
|
||||||
{calculateTime ? `${getCalculatedTime(numberValue)} с` : `${numberValue.toFixed(2)}%`}
|
{calculateTime
|
||||||
|
? `${getCalculatedTime(numberValue)} с`
|
||||||
|
: `${numberValue.toFixed(2)}%`}
|
||||||
</Typography>
|
</Typography>
|
||||||
<LineChart
|
<LineChart
|
||||||
xAxis={[
|
xAxis={[
|
||||||
@ -178,10 +178,11 @@ const GeneralItemTimeConv = ({
|
|||||||
{
|
{
|
||||||
data: Object.values(time),
|
data: Object.values(time),
|
||||||
valueFormatter: (value) => {
|
valueFormatter: (value) => {
|
||||||
console.log("log", value)
|
console.log("log", value);
|
||||||
return calculateTime ? getCalculatedTime(value) : String((value*100).toFixed(2)) + "%"
|
return calculateTime
|
||||||
}
|
? getCalculatedTime(value)
|
||||||
,
|
: String((value * 100).toFixed(2)) + "%";
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
// dataset={Object.entries(general).map(([, v]) => moment.unix(v).format("ss:mm:HH")).reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {})}
|
// dataset={Object.entries(general).map(([, v]) => moment.unix(v).format("ss:mm:HH")).reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {})}
|
||||||
@ -196,7 +197,6 @@ const GeneralItemTimeConv = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const General: FC<GeneralProps> = ({ data, day }) => {
|
export const General: FC<GeneralProps> = ({ data, day }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
|
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
|
||||||
|
@ -462,7 +462,8 @@ export default function InstallQuiz() {
|
|||||||
отображаться автоматически после сохранения.
|
отображаться автоматически после сохранения.
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography>
|
<Typography>
|
||||||
Для установки размера добавьте в тег значения высоты и ширины, например:
|
Для установки размера добавьте в тег значения высоты и
|
||||||
|
ширины, например:
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography>
|
<Typography>
|
||||||
{`<div id="idpena" style="width: 600px;height: 600px;"></div>`}
|
{`<div id="idpena" style="width: 600px;height: 600px;"></div>`}
|
||||||
|
Loading…
Reference in New Issue
Block a user