Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Strand/Data/IntelligenceEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,10 @@ final class IntelligenceEngine: ObservableObject {
registry: registry, fallbackDeviceId: ownerFallbackId)

let hr = (try? await store.hrSamples(deviceId: owner, from: from, to: to, limit: 200_000)) ?? []
guard hr.count >= 200 else { continue } // need real raw data, not a stray sample
guard hr.count >= 200 else {
diag("sleep day=\(day) SKIPPED hrSamples=\(hr.count) (need ≥200)")
continue
}
let rr = (try? await store.rrIntervals(deviceId: owner, from: from, to: to, limit: 200_000)) ?? []
let resp = (try? await store.respSamples(deviceId: owner, from: from, to: to, limit: 200_000)) ?? []
let grav = (try? await store.gravitySamples(deviceId: owner, from: from, to: to, limit: 200_000)) ?? []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,10 @@ object IntelligenceEngine {
// scored-days loop, NOT here). Only when the universal sink is on. A day skipped below for too
// few rows is never scored, so it emits no line, byte-identical to the iOS behaviour.
if (universalSink != null) readOwnerByDay[day] = OwnerRead(owner, hr.size)
if (hr.size < MIN_HR_SAMPLES) continue // need real raw data, not a stray sample
if (hr.size < MIN_HR_SAMPLES) {
diag("sleep day=$day SKIPPED hrSamples=${hr.size} (need ≥$MIN_HR_SAMPLES)")
continue
}
val rr = repo.rrIntervals(owner, from, to, STREAM_LIMIT)
val resp = repo.respSamples(owner, from, to, STREAM_LIMIT)
val grav = repo.gravitySamples(owner, from, to, STREAM_LIMIT)
Expand Down
Loading