From e2c8292d7f8badf281d6b13d85fa7fb7229b9d4a Mon Sep 17 00:00:00 2001 From: emelko <ml.kochsiek@mailbox.org> Date: Fri, 7 Sep 2018 19:45:55 +0200 Subject: [PATCH] secondarySymptom as default; be more explicit for periOvuEnd calculation --- lib/sympto/index.js | 2 +- lib/sympto/pre-ovulatory.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/sympto/index.js b/lib/sympto/index.js index 48e19806..979efc6c 100644 --- a/lib/sympto/index.js +++ b/lib/sympto/index.js @@ -72,7 +72,7 @@ export default function getSymptoThermalStatus(cycleInfo) { if (tempOver > secondarySymptomOver) { periOvulatoryEnd = temperatureShift.evaluationCompleteDay - } else { + } else if (secondarySymptom > tempOver) { periOvulatoryEnd = secondaryShift.evaluationCompleteDay } diff --git a/lib/sympto/pre-ovulatory.js b/lib/sympto/pre-ovulatory.js index c2501428..874e2bc9 100644 --- a/lib/sympto/pre-ovulatory.js +++ b/lib/sympto/pre-ovulatory.js @@ -13,7 +13,7 @@ export default function(cycle, previousCycles) { return d.date <= preOvuEndDate }) const preOvulatoryDays = getDaysUntilFertileSecondarySymptom(maybePreOvuDays) - // if mucus occurs on the 1st cycle day, there is no pre-ovu phase + // if fertile mucus or cervix occurs on the 1st cycle day, there is no pre-ovu phase if (!preOvulatoryDays.length) return null let endDate @@ -34,7 +34,7 @@ export default function(cycle, previousCycles) { } } -function getDaysUntilFertileSecondarySymptom(days, secondarySymptom) { +function getDaysUntilFertileSecondarySymptom(days, secondarySymptom = 'mucus') { const firstFertileSecondarySymptomDayIndex = days.findIndex(day => { if (secondarySymptom === 'mucus') { return day.mucus && day.mucus.value > 1 @@ -47,4 +47,4 @@ function getDaysUntilFertileSecondarySymptom(days, secondarySymptom) { return days.slice(0, firstFertileSecondarySymptomDayIndex) } return days -} \ No newline at end of file +} -- GitLab