diff --git a/WebSite/src/App.tsx b/WebSite/src/App.tsx
index 422ca3d..b7d3ca2 100644
--- a/WebSite/src/App.tsx
+++ b/WebSite/src/App.tsx
@@ -99,11 +99,16 @@ const API_BASE = typeof window === 'undefined'
function progressFromJob(job: BackendJob, fallback = 0) {
if (job.status === 'completed') return 100;
if (typeof job.progress === 'number') {
- return Math.max(0, Math.min(100, Math.round(job.progress)));
+ return Math.max(0, Math.min(100, job.progress));
}
return Math.max(0, Math.min(95, fallback));
}
+function formatProgress(value: number) {
+ const bounded = Math.max(0, Math.min(100, value));
+ return Number.isInteger(bounded) ? `${bounded}` : bounded.toFixed(1);
+}
+
function readStoredDeformationJob(): StoredDeformationJob | null {
if (typeof window === 'undefined') return null;
try {
@@ -948,7 +953,7 @@ export default function App() {
>
{zipJobs.all?.status === 'running'
- ? `四状态 ZIP 打包中 ${progressFromJob(zipJobs.all, 0)}%`
+ ? `四状态 ZIP 打包中 ${formatProgress(progressFromJob(zipJobs.all, 0))}%`
: '下载四状态 ZIP'}
)}
@@ -1057,7 +1062,7 @@ export default function App() {
>
{zipJob?.status === 'running'
- ? `打包中 ${progressFromJob(zipJob, 0)}%`
+ ? `打包中 ${formatProgress(progressFromJob(zipJob, 0))}%`
: '下载本状态 DICOM ZIP'}
)}