Skip to content
Snippets Groups Projects
Commit d89e1038 authored by emelko's avatar emelko
Browse files

Adding computed NFP mucus value to database and do cycle day overview

parent 7e0456c1
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ import { ...@@ -9,6 +9,7 @@ import {
bleeding as labels, bleeding as labels,
mucusFeeling as feelingLabels, mucusFeeling as feelingLabels,
mucusTexture as textureLabels, mucusTexture as textureLabels,
mucusNFP as computeSensiplanMucusLabels,
} from '../labels/labels' } from '../labels/labels'
import cycleDayModule from '../lib/get-cycle-day-number' import cycleDayModule from '../lib/get-cycle-day-number'
import { bleedingDaysSortedByDate } from '../db' import { bleedingDaysSortedByDate } from '../db'
...@@ -61,9 +62,10 @@ export default class DayView extends Component { ...@@ -61,9 +62,10 @@ export default class DayView extends Component {
const mucusFeelingValue = this.cycleDay.mucus && this.cycleDay.mucus.feeling const mucusFeelingValue = this.cycleDay.mucus && this.cycleDay.mucus.feeling
const mucusTextureValue = this.cycleDay.mucus && this.cycleDay.mucus.texture const mucusTextureValue = this.cycleDay.mucus && this.cycleDay.mucus.texture
const mucusComputedValue = this.cycleDay.mucus && this.cycleDay.mucus.computedNfp
let mucusLabel let mucusLabel
if (typeof mucusFeelingValue === 'number' && typeof mucusTextureValue === 'number') { if (typeof mucusFeelingValue === 'number' && typeof mucusTextureValue === 'number') {
mucusLabel = `${feelingLabels[mucusFeelingValue]} + ${textureLabels[mucusTextureValue]}` mucusLabel = `${feelingLabels[mucusFeelingValue]} + ${textureLabels[mucusTextureValue]} ( ${computeSensiplanMucusLabels[mucusComputedValue]} )`
if (this.cycleDay.mucus.exclude) mucusLabel = "( " + mucusLabel + " )" if (this.cycleDay.mucus.exclude) mucusLabel = "( " + mucusLabel + " )"
} else { } else {
mucusLabel = 'edit' mucusLabel = 'edit'
......
const bleeding = ['spotting', 'light', 'medium', 'heavy'] const bleeding = ['spotting', 'light', 'medium', 'heavy']
const mucusFeeling = ['dry', 'nothing', 'wet', 'slippery'] const mucusFeeling = ['dry', 'nothing', 'wet', 'slippery']
const mucusTexture = ['nothing', 'creamy', 'egg white'] const mucusTexture = ['nothing', 'creamy', 'egg white']
const mucusNFP = ['t', 'Ø', 'f', 'S', '+S']
export { export {
bleeding, bleeding,
mucusFeeling, mucusFeeling,
mucusTexture mucusTexture,
mucusNFP
} }
...@@ -32,6 +32,7 @@ export default class Mucus extends Component { ...@@ -32,6 +32,7 @@ export default class Mucus extends Component {
this.state = { this.state = {
currentFeelingValue, currentFeelingValue,
currentTextureValue, currentTextureValue,
computeSensiplanValue,
exclude: this.cycleDay.mucus ? this.cycleDay.mucus.exclude : false exclude: this.cycleDay.mucus ? this.cycleDay.mucus.exclude : false
} }
...@@ -138,7 +139,7 @@ export default class Mucus extends Component { ...@@ -138,7 +139,7 @@ export default class Mucus extends Component {
saveMucus(this.cycleDay, { saveMucus(this.cycleDay, {
feeling: this.state.currentFeelingValue, feeling: this.state.currentFeelingValue,
texture: this.state.currentTextureValue, texture: this.state.currentTextureValue,
computedValue: computeSensiplanValue(this.state.currentFeelingValue, this.state.currentTextureValue), computedNfp: computeSensiplanValue(this.state.currentFeelingValue, this.state.currentTextureValue),
exclude: this.state.exclude exclude: this.state.exclude
}) })
this.showView('dayView') this.showView('dayView')
......
...@@ -23,6 +23,7 @@ const MucusSchema = { ...@@ -23,6 +23,7 @@ const MucusSchema = {
properties: { properties: {
feeling: 'int', feeling: 'int',
texture: 'int', texture: 'int',
computedNfp: 'int',
exclude: 'bool' exclude: 'bool'
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment