Merge branch '208-bug-ltl-line-has-gaps' into 'master'

Resolve "bug: LTL line has gaps"

Closes #208

See merge request bloodyhealth/drip!91
This commit is contained in:
Julia Friesel
2018-10-01 17:01:06 +00:00
5 changed files with 72 additions and 16 deletions
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="850.39px" height="850.39px" viewBox="0 0 850.39 850.39" enable-background="new 0 0 850.39 850.39" xml:space="preserve">
<g>
<defs>
<rect id="SVGID_1_" x="350" y="336.467" width="144.262" height="181.533"/>
</defs>
<clipPath id="SVGID_2_">
<use xlink:href="#SVGID_1_" overflow="visible"/>
</clipPath>
<path clip-path="url(#SVGID_2_)" fill="none" stroke="#89113E" stroke-width="2" stroke-miterlimit="10" d="M492.723,455.44
c-5.531,39.136-41.74,66.377-80.876,60.847C372.712,510.757,351,483.64,351,444.115c0-37.555,79.739-114.673,80.391-105.969
C434.248,376.247,499.843,405.058,492.723,455.44z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1004 B

+16
View File
@@ -0,0 +1,16 @@
import React from 'react'
import Svg, { G, Path } from 'react-native-svg'
export default function HomeCycleIcon() {
return (
<Svg width={140} height={100} viewBox='200 200 350 350'>
<G>
<Path fill="none" stroke="#1E0B7A" strokeWidth="2" d="M379.708,350.568
C356.431,365.455,341,391.529,341,421.21c0,46.275,37.515,83.79,83.791,83.79s83.79-37.515,83.79-83.79
c0-31.784-17.696-59.436-43.773-73.637"/>
<Path fill="none" stroke="#1E0B7A" strokeWidth="2" d="M383.809,369.885v-18.398
c0,0,0-4.843-4.842-4.843h-18.399"/>
</G>
</Svg>
)
}
+18 -15
View File
@@ -106,31 +106,34 @@ export default class CycleChart extends Component {
const columns = xAxisDates.map(dateString => {
const column = { dateString }
const cycleDay = getCycleDay(dateString)
if (!cycleDay) return column
let symptoms = {}
const symptoms = chartSymptoms.reduce((acc, symptom) => {
if (symptom === 'bleeding' ||
if (cycleDay) {
symptoms = chartSymptoms.reduce((acc, symptom) => {
if (symptom === 'bleeding' ||
symptom === 'temperature' ||
symptom === 'mucus' ||
symptom === 'desire' ||
symptom === 'note'
) {
acc[symptom] = cycleDay[symptom] && cycleDay[symptom].value
} else if (symptom === 'cervix') {
acc.cervix = cycleDay.cervix &&
) {
acc[symptom] = cycleDay[symptom] && cycleDay[symptom].value
} else if (symptom === 'cervix') {
acc.cervix = cycleDay.cervix &&
(cycleDay.cervix.opening + cycleDay.cervix.firmness)
} else if (symptom === 'sex') {
} 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 &&
acc.pain = cycleDay.pain &&
Object.values(cycleDay.pain).some(x => x === true)
}
acc[`${symptom}Exclude`] = cycleDay[symptom] && cycleDay[symptom].exclude
return acc
}, {})
}
acc[`${symptom}Exclude`] = cycleDay[symptom] && cycleDay[symptom].exclude
return acc
}, {})
}
const temp = symptoms.temperature
if (temp) {
+1 -1
View File
@@ -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 }
+20
View File
@@ -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)