From 3f52cae04b52274de21f7d4b4d4556135d880ff8 Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Mon, 20 May 2019 06:32:58 +0200 Subject: [PATCH] Fix mucus value display on overview --- components/cycle-day/cycle-day-overview.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/components/cycle-day/cycle-day-overview.js b/components/cycle-day/cycle-day-overview.js index a04458e..2f928fe 100644 --- a/components/cycle-day/cycle-day-overview.js +++ b/components/cycle-day/cycle-day-overview.js @@ -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 = []