Naming update: isFertile>isClosedAndHard, getSymptomColorIndex>symptomColorMethods; update of symptom index retrieval for the sake of readibility
This commit is contained in:
@@ -40,8 +40,14 @@ class DayColumn extends Component {
|
|||||||
this.getTemperatureProps(symptomData, columnHeight, dateString)
|
this.getTemperatureProps(symptomData, columnHeight, dateString)
|
||||||
} else {
|
} else {
|
||||||
if (symptomData && ! symptomData.exclude) {
|
if (symptomData && ! symptomData.exclude) {
|
||||||
symptomDataToDisplay[symptom] =
|
// if symptomColorMethods entry doesn't exist for given symptom,
|
||||||
(this.getSymptomColorIndex[symptom] || this.getSymptomColorIndex['default'])(symptomData)
|
// use 'default'
|
||||||
|
const getSymptomColorIndex =
|
||||||
|
this.symptomColorMethods[symptom] ||
|
||||||
|
this.symptomColorMethods['default']
|
||||||
|
|
||||||
|
getSymptomColorIndex(symptomData)
|
||||||
|
symptomDataToDisplay[symptom] = getSymptomColorIndex(symptomData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +78,7 @@ class DayColumn extends Component {
|
|||||||
}, extractedData)
|
}, extractedData)
|
||||||
}
|
}
|
||||||
|
|
||||||
getSymptomColorIndex = {
|
symptomColorMethods = {
|
||||||
'mucus': (symptomData) => {
|
'mucus': (symptomData) => {
|
||||||
const { feeling, texture } = symptomData
|
const { feeling, texture } = symptomData
|
||||||
const colorIndex = feeling + texture
|
const colorIndex = feeling + texture
|
||||||
@@ -81,9 +87,10 @@ class DayColumn extends Component {
|
|||||||
'cervix': (symptomData) => {
|
'cervix': (symptomData) => {
|
||||||
const { opening, firmness } = symptomData
|
const { opening, firmness } = symptomData
|
||||||
const isDataComplete = opening !== null && firmness !== null
|
const isDataComplete = opening !== null && firmness !== null
|
||||||
// is fertile? fertile only when opening=closed and firmness=hard (=0)
|
const isClosedAndHard =
|
||||||
const isFertile = isDataComplete && (opening === 0 && firmness === 0)
|
isDataComplete &&
|
||||||
const colorIndex = isFertile ? 0 : 2
|
(opening === 0 && firmness === 0)
|
||||||
|
const colorIndex = isClosedAndHard ? 0 : 2
|
||||||
return colorIndex
|
return colorIndex
|
||||||
},
|
},
|
||||||
'sex': (symptomData) => {
|
'sex': (symptomData) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user