feat: 增加容错处理
All checks were successful
CI Monitor CI/CD / build-image (push) Successful in 17s
CI Monitor CI/CD / deploy (push) Successful in 23s

This commit is contained in:
zhaoyingbo 2024-03-11 01:50:17 +00:00
parent f66efef4ba
commit bc36b6f386

View File

@ -32,20 +32,20 @@ const getStatisticsInfo = async () => {
getPrevWeekWithYear()
);
return {
total_count: String(curWeekInfo.total_count),
total_count: String(curWeekInfo?.total_count ?? 0),
weekly_count_rate: calculateWeeklyRate(
curWeekInfo.total_count,
prevWeekInfo.total_count
curWeekInfo?.total_count ?? 0,
prevWeekInfo?.total_count ?? 0
).text,
duration: String(curWeekInfo.duration),
duration: String(curWeekInfo?.duration ?? 0),
weekly_duration_rate: calculateWeeklyRate(
curWeekInfo.duration,
prevWeekInfo.duration
curWeekInfo?.duration ?? 0,
prevWeekInfo?.duration ?? 0
).text,
success_rate: String(curWeekInfo.success_rate),
success_rate: String(curWeekInfo?.success_rate),
weekly_success_rate: calculateWeeklyRate(
curWeekInfo.success_rate,
prevWeekInfo.success_rate
curWeekInfo?.success_rate,
prevWeekInfo?.success_rate
).text,
};
};
@ -53,10 +53,10 @@ const getStatisticsInfo = async () => {
const getProjDiffInfo = async () => {
const curWeekInfo = await db.view.getProjStatisticsByWeek(
getWeekTimeWithYear()
);
) || [];
const prevWeekInfo = await db.view.getProjStatisticsByWeek(
getPrevWeekWithYear()
);
) || [];
const group: {
project_name: string;