Fix cervix value display on overview
This commit is contained in:
@@ -15,9 +15,6 @@ import AppText from '../app-text'
|
|||||||
import DripIcon from '../../assets/drip-icons'
|
import DripIcon from '../../assets/drip-icons'
|
||||||
|
|
||||||
const bleedingLabels = labels.bleeding.labels
|
const bleedingLabels = labels.bleeding.labels
|
||||||
const openingLabels = labels.cervix.opening.categories
|
|
||||||
const firmnessLabels = labels.cervix.firmness.categories
|
|
||||||
const positionLabels = labels.cervix.position.categories
|
|
||||||
const intensityLabels = labels.intensity
|
const intensityLabels = labels.intensity
|
||||||
const sexLabels = labels.sex.categories
|
const sexLabels = labels.sex.categories
|
||||||
const contraceptiveLabels = labels.contraceptives.categories
|
const contraceptiveLabels = labels.contraceptives.categories
|
||||||
@@ -77,22 +74,18 @@ export default class CycleDayOverView extends Component {
|
|||||||
|
|
||||||
if (isNumber(mucus.value)) label += `\n${labels.mucusNFP[mucus.value]}`
|
if (isNumber(mucus.value)) label += `\n${labels.mucusNFP[mucus.value]}`
|
||||||
if (mucus.exclude) label = `(${label})`
|
if (mucus.exclude) label = `(${label})`
|
||||||
|
|
||||||
return label
|
return label
|
||||||
},
|
},
|
||||||
cervix: cervix => {
|
cervix: cervix => {
|
||||||
let cervixLabel = []
|
const filledCategories = ['opening', 'firmness', 'position'].filter(c => isNumber(cervix[c]))
|
||||||
if (isNumber(cervix.opening) && isNumber(cervix.firmness)) {
|
let label = filledCategories.map(category => {
|
||||||
cervixLabel.push(
|
return labels.cervix[category].categories[cervix[category]]
|
||||||
openingLabels[cervix.opening],
|
}).join(', ')
|
||||||
firmnessLabels[cervix.firmness]
|
|
||||||
)
|
if (cervix.exclude) label = `(${label})`
|
||||||
if (isNumber(cervix.position)) {
|
|
||||||
cervixLabel.push(positionLabels[cervix.position])
|
return label
|
||||||
}
|
|
||||||
cervixLabel = cervixLabel.join(', ')
|
|
||||||
if (cervix.exclude) cervixLabel = `(${cervixLabel})`
|
|
||||||
return cervixLabel
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
note: note => {
|
note: note => {
|
||||||
return note.value
|
return note.value
|
||||||
@@ -318,4 +311,4 @@ class FillerBoxes extends Component {
|
|||||||
|
|
||||||
function isNumber(val) {
|
function isNumber(val) {
|
||||||
return typeof val === 'number'
|
return typeof val === 'number'
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user