ordered models for lessons and units

Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-07-20 05:13:11 +08:00
parent 565a32477a
commit 36124cc4a1
@@ -142,8 +142,11 @@ const TYPE_HANDLERS = {
}); });
if (!progress) return false; if (!progress) return false;
if (progress.completed) return true; if (progress.completed) return true;
const minPercent = requirement.min_percent ?? 100; // CockroachDB returns INTEGER columns as strings over the wire (same class of
return (progress.progress_percent ?? 0) >= minPercent; // issue as the BigInt precision fix) — without Number() coercion this becomes a
// lexicographic string comparison, where e.g. "7" >= "100" is true.
const minPercent = Number(requirement.min_percent ?? 100);
return Number(progress.progress_percent ?? 0) >= minPercent;
}, },
}, },
// watch_video / listen_audio: unlike watch_percent (one aggregate figure across // watch_video / listen_audio: unlike watch_percent (one aggregate figure across