Draw vertical and horizontal line in chart for completed sympto eval
This commit is contained in:
+21
-16
@@ -9,22 +9,8 @@ const {
|
||||
} = cycleModule()
|
||||
|
||||
export function getFertilityStatusStringForDay(dateString) {
|
||||
const cycle = getCycleForDay(dateString)
|
||||
if (!cycle) return fertilityStatus.unknown
|
||||
|
||||
const cycleInfo = {cycle: formatCycleForSympto(cycle)}
|
||||
|
||||
const previousCycle = getPreviousCycle(dateString)
|
||||
|
||||
if (previousCycle) {
|
||||
cycleInfo.previousCycle = formatCycleForSympto(previousCycle)
|
||||
const earlierCycles = getCyclesBefore(previousCycle[0])
|
||||
if (earlierCycles) {
|
||||
cycleInfo.earlierCycles = earlierCycles.map(formatCycleForSympto)
|
||||
}
|
||||
}
|
||||
|
||||
const status = getFertilityStatus(cycleInfo)
|
||||
const status = getCycleStatusForDay(dateString)
|
||||
if (!status) return fertilityStatus.unknown
|
||||
|
||||
const phaseNameForDay = Object.keys(status.phases).find(phaseName => {
|
||||
const phase = status.phases[phaseName]
|
||||
@@ -41,6 +27,25 @@ export function getFertilityStatusStringForDay(dateString) {
|
||||
return mapToString(phaseNameForDay, dateString, status)
|
||||
}
|
||||
|
||||
export function getCycleStatusForDay(dateString) {
|
||||
const cycle = getCycleForDay(dateString)
|
||||
if (!cycle) return null
|
||||
|
||||
const cycleInfo = {cycle: formatCycleForSympto(cycle)}
|
||||
|
||||
const previousCycle = getPreviousCycle(dateString)
|
||||
|
||||
if (previousCycle) {
|
||||
cycleInfo.previousCycle = formatCycleForSympto(previousCycle)
|
||||
const earlierCycles = getCyclesBefore(previousCycle[0])
|
||||
if (earlierCycles) {
|
||||
cycleInfo.earlierCycles = earlierCycles.map(formatCycleForSympto)
|
||||
}
|
||||
}
|
||||
|
||||
return getFertilityStatus(cycleInfo)
|
||||
}
|
||||
|
||||
function mapToString(phaseNameForDay, dateString, status) {
|
||||
const mapping = {
|
||||
preOvulatory: () => fertilityStatus.infertile,
|
||||
|
||||
Reference in New Issue
Block a user