ComputedNfp => value
This commit is contained in:
+10
-4
@@ -8,12 +8,12 @@ export default function (dateString) {
|
||||
const cycle = getCycleDaysBeforeDay(dateString)
|
||||
if (!cycle) return fertilityStatus.unknown
|
||||
|
||||
// we get earliest last, but sympto wants earliest first
|
||||
cycle.reverse()
|
||||
const previousCycles = getPreviousCycles(cycle[0])
|
||||
previousCycles.forEach(cycle => cycle.reverse())
|
||||
|
||||
const status = getFertilityStatus({cycle, previousCycles})
|
||||
const status = getFertilityStatus({
|
||||
cycle: formatCycleForSympto(cycle),
|
||||
previousCycles: previousCycles.map(formatCycleForSympto)
|
||||
})
|
||||
|
||||
return formatStatusForApp(status)
|
||||
}
|
||||
@@ -24,4 +24,10 @@ function formatStatusForApp(status) {
|
||||
} else {
|
||||
return fertilityStatus.infertile
|
||||
}
|
||||
}
|
||||
|
||||
function formatCycleForSympto(cycle) {
|
||||
// we get earliest last, but sympto wants earliest first
|
||||
cycle.reverse()
|
||||
return cycle
|
||||
}
|
||||
Reference in New Issue
Block a user