Ignore secondary symptom peak after end of temperature evaluation
This commit is contained in:
@@ -2,7 +2,6 @@ export default function (cycleDays, tempEvalEndIndex) {
|
||||
const notDetected = { detected: false }
|
||||
const cervixDays = cycleDays
|
||||
.filter(day => day.cervix && !day.cervix.exclude)
|
||||
.filter(day => typeof day.cervix.opening === 'number' && typeof day.cervix.firmness === 'number')
|
||||
|
||||
// we search for the day of cervix peak, which must:
|
||||
// * have fertile cervix values
|
||||
@@ -19,14 +18,19 @@ export default function (cycleDays, tempEvalEndIndex) {
|
||||
const threeFollowingDays = cervixDays.slice(i + 1, i + 4)
|
||||
if (threeFollowingDays.length < 3) continue
|
||||
|
||||
// no other fertile cervix value may occur until temperature evaluation has
|
||||
// been completed
|
||||
const fertileCervixOccursIn3FollowingDays = threeFollowingDays.some(day => {
|
||||
return !isClosedAndHard(day.cervix)
|
||||
})
|
||||
if (fertileCervixOccursIn3FollowingDays) 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 other fertile cervix value may occur until temperature evaluation has
|
||||
// been completed
|
||||
const relevantDays = cycleDays
|
||||
.slice(cycleDayIndex + 1, tempEvalEndIndex + 1)
|
||||
.filter(day => day.cervix && !day.cervix.exclude)
|
||||
|
||||
Reference in New Issue
Block a user