Ignore temp drop after 3 regular high temps
This commit is contained in:
@@ -122,9 +122,9 @@ export default class CycleChart extends Component {
|
||||
(cycleDay.cervix.opening + cycleDay.cervix.firmness)
|
||||
} else if (symptom === 'sex') {
|
||||
// solo = 1 + partner = 2
|
||||
acc.sex = cycleDay.sex &&
|
||||
acc.sex = cycleDay.sex &&
|
||||
(cycleDay.sex.solo + 2 * cycleDay.sex.partner)
|
||||
} else if (symptom === 'pain') {
|
||||
} else if (symptom === 'pain') {
|
||||
// is any pain documented?
|
||||
acc.pain = cycleDay.pain &&
|
||||
Object.values(cycleDay.pain).some(x => x === true)
|
||||
|
||||
@@ -42,7 +42,7 @@ function checkIfFirstHighMeasurement(temp, i, temperatureDays, ltl) {
|
||||
const nextDaysAfterPotentialFhm = temperatureDays.slice(i + 1, i + 4)
|
||||
|
||||
return (
|
||||
getResultForRegularRule(nextDaysAfterPotentialFhm, ltl)) ||
|
||||
getResultForRegularRule(nextDaysAfterPotentialFhm.slice(0, 2), ltl)) ||
|
||||
getResultForFirstExceptionRule(nextDaysAfterPotentialFhm, ltl) ||
|
||||
getResultForSecondExceptionRule(nextDaysAfterPotentialFhm, ltl) ||
|
||||
{ detected: false }
|
||||
|
||||
@@ -40,6 +40,26 @@ describe('sympto', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('detects temperature shift correctly with drop after third high temp', () => {
|
||||
const tempShift =
|
||||
[36.7, 36.57, 36.47, 36.49, 36.57, 36.62, 36.55, 36.8, 36.86, 36.8, 36.4]
|
||||
.map(turnIntoCycleDayObject)
|
||||
const status = getTemperatureStatus(tempShift)
|
||||
expect(status).to.eql({
|
||||
detected: true,
|
||||
ltl: 36.6,
|
||||
firstHighMeasurementDay: {
|
||||
date: 7,
|
||||
temperature: { value: 36.8 }
|
||||
},
|
||||
evaluationCompleteDay: {
|
||||
date: 9,
|
||||
temperature: { value: 36.8 }
|
||||
},
|
||||
rule: 0
|
||||
})
|
||||
})
|
||||
|
||||
it('detects no temperature shift when there are no 6 low temps', () => {
|
||||
const tempShift = [36.47, 36.49, 36.57, 36.62, 36.55, 36.8, 36.86, 36.8]
|
||||
.map(turnIntoCycleDayObject)
|
||||
|
||||
Reference in New Issue
Block a user