Merge branch '73-implement-nfp-logic-for-mucus-mode' into 'master'

Resolve "implement NFP logic for mucus mode"

Closes #73

See merge request bloodyhealth/drip!20
This commit is contained in:
Julia Friesel
2018-07-25 08:56:34 +00:00
28 changed files with 2384 additions and 239 deletions
+3 -3
View File
@@ -14,10 +14,10 @@ import {
cervixFirmness as firmnessLabels,
cervixPosition as positionLabels
} from './labels/labels'
import cycleDayModule from '../../lib/get-cycle-day-number'
import cycleDayModule from '../../lib/cycle'
import { bleedingDaysSortedByDate } from '../../db'
const getCycleDayNumber = cycleDayModule()
const getCycleDayNumber = cycleDayModule().getCycleDayNumber
export default class DayView extends Component {
constructor(props) {
@@ -72,7 +72,7 @@ export default class DayView extends Component {
if (this.cycleDay.mucus) {
const mucus = this.cycleDay.mucus
if (typeof mucus.feeling === 'number' && typeof mucus.texture === 'number') {
mucusLabel = `${feelingLabels[mucus.feeling]} + ${textureLabels[mucus.texture]} ( ${computeSensiplanMucusLabels[mucus.computedNfp]} )`
mucusLabel = `${feelingLabels[mucus.feeling]} + ${textureLabels[mucus.texture]} ( ${computeSensiplanMucusLabels[mucus.value]} )`
if (mucus.exclude) mucusLabel = "( " + mucusLabel + " )"
}
} else {
+12 -3
View File
@@ -4,7 +4,8 @@ import {
Text,
ScrollView
} from 'react-native'
import cycleDayModule from '../../lib/get-cycle-day-number'
import cycleModule from '../../lib/cycle'
import { getFertilityStatusStringForDay } from '../../lib/sympto-adapter'
import DayView from './cycle-day-overview'
import BleedingEditView from './symptoms/bleeding'
import TemperatureEditView from './symptoms/temperature'
@@ -14,7 +15,7 @@ import CervixEditView from './symptoms/cervix'
import styles from '../../styles'
import actionButtonModule from './action-buttons'
const getCycleDayNumber = cycleDayModule()
const getCycleDayNumber = cycleModule().getCycleDayNumber
export default class Day extends Component {
constructor(props) {
@@ -34,6 +35,7 @@ export default class Day extends Component {
render() {
const cycleDayNumber = getCycleDayNumber(this.cycleDay.date)
const fertilityStatus = getFertilityStatusStringForDay(this.cycleDay.date)
return (
<ScrollView>
<View style={ styles.cycleDayDateView }>
@@ -42,7 +44,14 @@ export default class Day extends Component {
</Text>
</View >
<View style={ styles.cycleDayNumberView }>
{ cycleDayNumber && <Text style={styles.cycleDayNumber} >Cycle day {cycleDayNumber}</Text> }
{ cycleDayNumber &&
<Text style={styles.cycleDayNumber} >
Cycle day {cycleDayNumber}
</Text> }
<Text style={styles.cycleDayNumber} >
{fertilityStatus}
</Text>
</View >
<View>
{
+13 -16
View File
@@ -1,17 +1,14 @@
const bleeding = ['spotting', 'light', 'medium', 'heavy']
const mucusFeeling = ['dry', 'nothing', 'wet', 'slippery']
const mucusTexture = ['nothing', 'creamy', 'egg white']
const mucusNFP = ['t', 'Ø', 'f', 'S', '+S']
const cervixOpening = ['closed', 'medium', 'open']
const cervixFirmness = ['hard', 'soft']
const cervixPosition = ['low', 'medium', 'high']
export const bleeding = ['spotting', 'light', 'medium', 'heavy']
export const mucusFeeling = ['dry', 'nothing', 'wet', 'slippery']
export const mucusTexture = ['nothing', 'creamy', 'egg white']
export const mucusNFP = ['t', 'Ø', 'f', 'S', '+S']
export const cervixOpening = ['closed', 'medium', 'open']
export const cervixFirmness = ['hard', 'soft']
export const cervixPosition = ['low', 'medium', 'high']
export {
bleeding,
mucusFeeling,
mucusTexture,
mucusNFP,
cervixOpening,
cervixFirmness,
cervixPosition
}
export const fertilityStatus = {
fertile: 'fertile',
infertile: 'infertile',
fertileUntilEvening: 'Fertile phase ends in the evening',
unknown: 'We cannot show any cycle information because no menses has been entered'
}
+1 -1
View File
@@ -94,7 +94,7 @@ export default class Mucus extends Component {
saveSymptom('mucus', this.cycleDay, {
feeling: this.state.feeling,
texture: this.state.texture,
computedNfp: computeSensiplanValue(this.state.feeling, this.state.texture),
value: computeSensiplanValue(this.state.feeling, this.state.texture),
exclude: this.state.exclude
})
},