From d5aa903da402798d7285e4ab47b3df01c9c903c6 Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Fri, 13 Jul 2018 06:44:23 +0200 Subject: [PATCH] Check for fhm according to nfp, not just temp shift --- lib/sympto/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/sympto/index.js b/lib/sympto/index.js index 36f8e5e..2005f32 100644 --- a/lib/sympto/index.js +++ b/lib/sympto/index.js @@ -4,19 +4,18 @@ import getPreOvulatoryPhase from './pre-ovulatory' import { LocalDate } from 'js-joda' import assert from 'assert' -export default function ({ cycle, previousCycles = [] }) { +export default function getSymptoThermalStatus({ cycle, previousCycles = [] }) { throwIfArgsAreNotInRequiredFormat(cycle, previousCycles) const status = { assumeFertility: true, phases: {} } - // TODO handle no previous cycles // if there was no first higher measurement in the previous cycle, // no infertile pre-ovulatory phase may be assumed const lastCycle = previousCycles[previousCycles.length - 1] - if (getTemperatureShift(lastCycle).detected && !cycle[0].mucus) { + if (lastCycle && getSymptoThermalStatus({cycle: lastCycle}).temperatureShift) { status.phases.preOvulatory = getPreOvulatoryPhase(cycle, previousCycles) if (status.phases.preOvulatory.cycleDays.length === cycle.length) { status.assumeFertility = false