fix empty watchDetail building

This commit is contained in:
Simon 2023-11-09 11:55:28 +07:00
parent 1657c55cbe
commit 0bedc3ee93
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
1 changed files with 6 additions and 7 deletions

View File

@ -186,11 +186,11 @@ function capitalizeFirstLetter(string) {
}
function buildWatchTile(title, watchDetail) {
const items = watchDetail.items || 0;
const duration = watchDetail.duration || 0;
const duration_str = watchDetail.duration_str || 0;
const hasProgess = !!watchDetail.progress;
const progress = Number(watchDetail.progress * 100).toFixed(2);
const items = watchDetail?.items ?? 0;
const duration = watchDetail?.duration ?? 0;
const duration_str = watchDetail?.duration_str ?? '0s';
const hasProgess = !!watchDetail?.progress;
const progress = (Number(watchDetail?.progress) * 100).toFixed(2) ?? '0';
let titleCapizalized = capitalizeFirstLetter(title);
@ -241,8 +241,7 @@ function buildDailyStat(dailyStat) {
text = 'Video';
}
message.innerText =
`+${dailyStat.count} ${text}
message.innerText = `+${dailyStat.count} ${text}
${humanFileSize(dailyStat.media_size)}`;
tile.appendChild(message);