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:
@@ -490,20 +490,16 @@ const Detail = (props) => {
|
|||||||
<Card>
|
<Card>
|
||||||
<Descriptions row size='small'>
|
<Descriptions row size='small'>
|
||||||
<Descriptions.Item itemKey='平均RPM'>
|
<Descriptions.Item itemKey='平均RPM'>
|
||||||
{renderNumber(
|
{(times /
|
||||||
times /
|
((Date.parse(end_timestamp) -
|
||||||
((Date.parse(end_timestamp) -
|
Date.parse(start_timestamp)) /
|
||||||
Date.parse(start_timestamp)) /
|
60000)).toFixed(3)}
|
||||||
60000),
|
|
||||||
).toFixed(3)}
|
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item itemKey='平均TPM'>
|
<Descriptions.Item itemKey='平均TPM'>
|
||||||
{renderNumber(
|
{(consumeTokens /
|
||||||
consumeTokens /
|
((Date.parse(end_timestamp) -
|
||||||
((Date.parse(end_timestamp) -
|
Date.parse(start_timestamp)) /
|
||||||
Date.parse(start_timestamp)) /
|
60000)).toFixed(3)}
|
||||||
60000),
|
|
||||||
).toFixed(3)}
|
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
</Descriptions>
|
</Descriptions>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
Reference in New Issue
Block a user