Period day toggle, flow strength on calendar, end dates for past periods

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-18 09:32:29 +01:00
parent 94372c6abc
commit ce66b857db
6 changed files with 149 additions and 55 deletions

View file

@ -121,4 +121,17 @@ assert.equal(toDay("2026-03-01") - toDay("2026-02-28"), 1);
for (const window of summary.fertile) assert.ok(window.start > toDay("2026-09-28"));
}
// The usual strength per period day averages rated days only: unrated
// ("period") days and days nobody logged that far into a period stay null.
{
const days = {};
const rate = (start, flows) => flows.forEach((flow, offset) => { days[toIso(toDay(start) + offset)] = { flow, symptoms: [] }; });
rate("2026-08-01", ["heavy", "heavy", "medium", "light"]);
rate("2026-08-29", ["medium", "heavy", "period", "light", "light"]);
const summary = cycle.summarize(days, "2026-09-20");
assert.deepEqual(summary.flowProfile, [3, 3, 2, 1, 1]);
assert.equal(summary.periodSamples, 2);
assert.equal(summary.periodLength, 5);
}
console.log("cycle tests passed");