Ignore secondary symptom peak after end of temperature evaluation

This commit is contained in:
Julia Friesel
2018-09-28 08:45:52 +02:00
parent 9029be081f
commit fa3a6fb2e7
7 changed files with 145 additions and 49 deletions
+7 -2
View File
@@ -16,8 +16,6 @@ export default function (cycleDays, tempEvalEndIndex) {
if (day.mucus.value !== currentBestQuality) continue
// the three following days must be of lower quality
// AND no best quality day may occur until temperature evaluation has
// been completed
const threeFollowingDays = mucusDays.slice(i + 1, i + 4)
if (threeFollowingDays.length < 3) continue
@@ -27,6 +25,13 @@ export default function (cycleDays, tempEvalEndIndex) {
if (bestQualityOccursIn3FollowingDays) continue
const cycleDayIndex = cycleDays.indexOf(day)
// if temperature evaluation has been completed an we still haven't found
// a candidate, there is no cervix shift
if (cycleDayIndex > tempEvalEndIndex) return notDetected
// no best quality day may occur until temperature evaluation has
// been completed
const relevantDays = cycleDays
.slice(cycleDayIndex + 1, tempEvalEndIndex + 1)
.filter(day => day.mucus && !day.mucus.exclude)