feat: 增加容错处理
This commit is contained in:
parent
f66efef4ba
commit
bc36b6f386
@ -32,20 +32,20 @@ const getStatisticsInfo = async () => {
|
|||||||
getPrevWeekWithYear()
|
getPrevWeekWithYear()
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
total_count: String(curWeekInfo.total_count),
|
total_count: String(curWeekInfo?.total_count ?? 0),
|
||||||
weekly_count_rate: calculateWeeklyRate(
|
weekly_count_rate: calculateWeeklyRate(
|
||||||
curWeekInfo.total_count,
|
curWeekInfo?.total_count ?? 0,
|
||||||
prevWeekInfo.total_count
|
prevWeekInfo?.total_count ?? 0
|
||||||
).text,
|
).text,
|
||||||
duration: String(curWeekInfo.duration),
|
duration: String(curWeekInfo?.duration ?? 0),
|
||||||
weekly_duration_rate: calculateWeeklyRate(
|
weekly_duration_rate: calculateWeeklyRate(
|
||||||
curWeekInfo.duration,
|
curWeekInfo?.duration ?? 0,
|
||||||
prevWeekInfo.duration
|
prevWeekInfo?.duration ?? 0
|
||||||
).text,
|
).text,
|
||||||
success_rate: String(curWeekInfo.success_rate),
|
success_rate: String(curWeekInfo?.success_rate),
|
||||||
weekly_success_rate: calculateWeeklyRate(
|
weekly_success_rate: calculateWeeklyRate(
|
||||||
curWeekInfo.success_rate,
|
curWeekInfo?.success_rate,
|
||||||
prevWeekInfo.success_rate
|
prevWeekInfo?.success_rate
|
||||||
).text,
|
).text,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -53,10 +53,10 @@ const getStatisticsInfo = async () => {
|
|||||||
const getProjDiffInfo = async () => {
|
const getProjDiffInfo = async () => {
|
||||||
const curWeekInfo = await db.view.getProjStatisticsByWeek(
|
const curWeekInfo = await db.view.getProjStatisticsByWeek(
|
||||||
getWeekTimeWithYear()
|
getWeekTimeWithYear()
|
||||||
);
|
) || [];
|
||||||
const prevWeekInfo = await db.view.getProjStatisticsByWeek(
|
const prevWeekInfo = await db.view.getProjStatisticsByWeek(
|
||||||
getPrevWeekWithYear()
|
getPrevWeekWithYear()
|
||||||
);
|
) || [];
|
||||||
|
|
||||||
const group: {
|
const group: {
|
||||||
project_name: string;
|
project_name: string;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user