refactor: Simplify average calculations in Detail component

- Streamlined the calculation of average RPM and average TPM by removing unnecessary function calls and directly applying the `toFixed(3)` method within the JSX.
- Improved code readability and maintainability by reducing the number of lines and enhancing clarity in the calculation logic.
This commit is contained in:
CalciumIon
2024-12-12 19:21:08 +08:00
parent 5d338337a0
commit 263547ebb7

View File

@@ -490,20 +490,16 @@ const Detail = (props) => {
<Card>
<Descriptions row size='small'>
<Descriptions.Item itemKey='平均RPM'>
{renderNumber(
times /
((Date.parse(end_timestamp) -
Date.parse(start_timestamp)) /
60000),
).toFixed(3)}
{(times /
((Date.parse(end_timestamp) -
Date.parse(start_timestamp)) /
60000)).toFixed(3)}
</Descriptions.Item>
<Descriptions.Item itemKey='平均TPM'>
{renderNumber(
consumeTokens /
((Date.parse(end_timestamp) -
Date.parse(start_timestamp)) /
60000),
).toFixed(3)}
{(consumeTokens /
((Date.parse(end_timestamp) -
Date.parse(start_timestamp)) /
60000)).toFixed(3)}
</Descriptions.Item>
</Descriptions>
</Card>