Merge branch '190-bug-secondary-symptom-only-occurring-after-temp-eval-end-does-not-get-ignored-as-it-should' into 'master'

Ignore secondary symptom peak after end of temperature evaluation

Closes #190

See merge request bloodyhealth/drip!93
This commit is contained in:
Julia Friesel
2018-10-01 09:49:21 +00:00
7 changed files with 288 additions and 62 deletions
+8 -2
View File
@@ -7,6 +7,7 @@ export default function (cycleDays, tempEvalEndIndex) {
// we search for the day of cervix peak, which must:
// * have fertile cervix values
// * be followed by at least 3 days
// * must happen prior to end of temperature evaluation
// these 3 following days must all show infertile cervix values
// if everything applies we must check the days until the end of temperature evaluation
// during these relevantDays no fertile cervix must occur
@@ -19,14 +20,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)
+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 mucus 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)