fix(小宝预警): 剩余工作量展示天数换算
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { VersionWithContext } from './derive';
|
||||
import { WORK_HOURS } from './work-hours';
|
||||
|
||||
const UNFINISHED_VERSION_STATUSES = new Set(['planned', 'developing', 'paused']);
|
||||
|
||||
@@ -18,3 +19,14 @@ export function filterXiaobaoWarningVersions(
|
||||
return (version.members ?? []).some((member) => member.name === filter.userName);
|
||||
});
|
||||
}
|
||||
|
||||
export function formatRemainingWork(hours: number): string {
|
||||
const safeHours = Number.isFinite(hours) && hours > 0 ? hours : 0;
|
||||
const days = safeHours / WORK_HOURS.hoursPerDay;
|
||||
return `${formatNumber(safeHours)}h / ${formatNumber(days)}天`;
|
||||
}
|
||||
|
||||
function formatNumber(value: number): string {
|
||||
if (Number.isInteger(value)) return String(value);
|
||||
return value.toFixed(1).replace(/\.0$/, '');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user