Check for fhm according to nfp, not just temp shift
This commit is contained in:
+2
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user