Просмотр исходного кода

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.
CalciumIon 1 год назад
Родитель
Сommit
263547ebb7
1 измененных файлов с 8 добавлено и 12 удалено
  1. 8 12
      web/src/pages/Detail/index.js

+ 8 - 12
web/src/pages/Detail/index.js

@@ -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>