Fix mucus value display on overview

This commit is contained in:
Julia Friesel
2019-05-20 06:32:58 +02:00
parent 43b98ed9a5
commit 3f52cae04b
+8 -9
View File
@@ -15,8 +15,6 @@ import AppText from '../app-text'
import DripIcon from '../../assets/drip-icons'
const bleedingLabels = labels.bleeding.labels
const feelingLabels = labels.mucus.feeling.categories
const textureLabels = labels.mucus.texture.categories
const openingLabels = labels.cervix.opening.categories
const firmnessLabels = labels.cervix.firmness.categories
const positionLabels = labels.cervix.position.categories
@@ -72,13 +70,14 @@ export default class CycleDayOverView extends Component {
}
},
mucus: mucus => {
const categories = ['feeling', 'texture', 'value']
if (categories.every(c => isNumber(mucus[c]))) {
let mucusLabel = [feelingLabels[mucus.feeling], textureLabels[mucus.texture]].join(', ')
mucusLabel += `\n${labels.mucusNFP[mucus.value]}`
if (mucus.exclude) mucusLabel = `(${mucusLabel})`
return mucusLabel
}
const filledCategories = ['feeling', 'texture'].filter(c => isNumber(mucus[c]))
let label = filledCategories.map(category => {
return labels.mucus[category].categories[mucus[category]]
}).join(', ')
if (isNumber(mucus.value)) label += `\n${labels.mucusNFP[mucus.value]}`
if (mucus.exclude) label = `(${label})`
return label
},
cervix: cervix => {
let cervixLabel = []