Resolve NAN for divide by 0 on time tickets. IO-681
This commit is contained in:
@@ -29,6 +29,7 @@ export function TimeTicketModalContainer({
|
||||
bodyshop,
|
||||
}) {
|
||||
const [form] = Form.useForm();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const { t } = useTranslation();
|
||||
const [enterAgain, setEnterAgain] = useState(false);
|
||||
const [insertTicket] = useMutation(INSERT_NEW_TIME_TICKET);
|
||||
@@ -39,6 +40,7 @@ export function TimeTicketModalContainer({
|
||||
});
|
||||
|
||||
const handleFinish = (values) => {
|
||||
setLoading(true);
|
||||
const emps = EmployeeAutoCompleteData.employees.filter(
|
||||
(e) => e.id === values.employeeid
|
||||
);
|
||||
@@ -98,6 +100,7 @@ export function TimeTicketModalContainer({
|
||||
toggleModalVisible();
|
||||
}
|
||||
setEnterAgain(false);
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
const handleMutationError = (error) => {
|
||||
@@ -107,6 +110,7 @@ export function TimeTicketModalContainer({
|
||||
message: JSON.stringify(error),
|
||||
}),
|
||||
});
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
@@ -160,6 +164,7 @@ export function TimeTicketModalContainer({
|
||||
visible={timeTicketModal.visible}
|
||||
okText={t("general.actions.save")}
|
||||
onOk={() => form.submit()}
|
||||
okButtonProps={{ loading }}
|
||||
onCancel={handleCancel}
|
||||
forceRender
|
||||
afterClose={() => form.resetFields()}
|
||||
|
||||
@@ -146,7 +146,9 @@ export function TimeTicketsSummaryEmployees({
|
||||
<Statistic
|
||||
title={t("timetickets.fields.efficiency")}
|
||||
precision={1}
|
||||
value={(prodHrs / actHrs) * 100}
|
||||
value={
|
||||
actHrs === 0 || !actHrs ? "∞" : (prodHrs / actHrs) * 100
|
||||
}
|
||||
suffix={"%"}
|
||||
/>
|
||||
<Statistic
|
||||
|
||||
Reference in New Issue
Block a user