web: draw isolated points as a connected series and mark unrecorded time in the adaptive audit [CI]
This commit is contained in:
1 parent
93abf59afb
commit
4e7a8c2ba3
3 files changed
+23
-5
No files matched your search
@@ -40,10 +40,19 @@ export function fmtOffset(ms: number): string {
|
||||
return h > 0 ? `${h}:${two(m)}${sec ? ':' + two(sec) : ''}` : `${m}:${two(sec)}`
|
||||
}
|
||||
|
||||
/** 有值的格子不到三分之一(而且至少有一个)算稀疏。 */
|
||||
/**
|
||||
* 稀疏:有值的点里,前后都是空的(孤立的)占三成以上。每 10 秒才一次的建连放在 5 秒的格子里就是隔一格有一格没有,
|
||||
* 每个点都是孤立的,连不成线,图上什么都看不见;这种序列画出点,并把点连起来。
|
||||
*/
|
||||
function isSparse(values: (number | null)[]): boolean {
|
||||
const filled = values.filter((v) => v !== null).length
|
||||
return filled > 0 && filled < values.length / 3
|
||||
let filled = 0
|
||||
let isolated = 0
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
if (values[i] === null) continue
|
||||
filled++
|
||||
if ((i === 0 || values[i - 1] === null) && (i === values.length - 1 || values[i + 1] === null)) isolated++
|
||||
}
|
||||
return filled > 0 && isolated / filled >= 0.3
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user