From 3f52cae04b52274de21f7d4b4d4556135d880ff8 Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Mon, 20 May 2019 06:32:58 +0200 Subject: [PATCH 1/2] 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 = [] From d7b599d03b141556c660792d346d764e02862d6f Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Mon, 20 May 2019 06:44:34 +0200 Subject: [PATCH 2/2] Fix cervix value display on overview --- components/cycle-day/cycle-day-overview.js | 27 ++++++++-------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/components/cycle-day/cycle-day-overview.js b/components/cycle-day/cycle-day-overview.js index 2f928fe..27778cf 100644 --- a/components/cycle-day/cycle-day-overview.js +++ b/components/cycle-day/cycle-day-overview.js @@ -15,9 +15,6 @@ import AppText from '../app-text' import DripIcon from '../../assets/drip-icons' 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 sexLabels = labels.sex.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 (mucus.exclude) label = `(${label})` + return label }, cervix: cervix => { - let cervixLabel = [] - if (isNumber(cervix.opening) && isNumber(cervix.firmness)) { - cervixLabel.push( - openingLabels[cervix.opening], - firmnessLabels[cervix.firmness] - ) - if (isNumber(cervix.position)) { - cervixLabel.push(positionLabels[cervix.position]) - } - cervixLabel = cervixLabel.join(', ') - if (cervix.exclude) cervixLabel = `(${cervixLabel})` - return cervixLabel - } + const filledCategories = ['opening', 'firmness', 'position'].filter(c => isNumber(cervix[c])) + let label = filledCategories.map(category => { + return labels.cervix[category].categories[cervix[category]] + }).join(', ') + + if (cervix.exclude) label = `(${label})` + + return label }, note: note => { return note.value @@ -318,4 +311,4 @@ class FillerBoxes extends Component { function isNumber(val) { return typeof val === 'number' -} \ No newline at end of file +}