Handle pre-ovulatory = current
This commit is contained in:
+10
-8
@@ -7,23 +7,25 @@ export default function ({ cycle, previousCycle }) {
|
||||
// TODO check for basic stuff, throw if nonexistent
|
||||
const status = {
|
||||
assumeFertility: true,
|
||||
phases: {
|
||||
periOvulatory: {
|
||||
start: {
|
||||
date: null
|
||||
},
|
||||
cycleDays: null
|
||||
}
|
||||
}
|
||||
phases: {}
|
||||
}
|
||||
|
||||
// if there was no first higher measurement in the previous cycle,
|
||||
// no infertile pre-ovulatory phase may be assumed
|
||||
if (getTemperatureShift(previousCycle).detected && !cycle[0].mucus) {
|
||||
status.phases.preOvulatory = getPreOvulatoryPhase(cycle)
|
||||
if (status.phases.preOvulatory.cycleDays.length === cycle.length) {
|
||||
status.assumeFertility = false
|
||||
return status
|
||||
}
|
||||
}
|
||||
|
||||
status.phases.periOvulatory = {
|
||||
start: { date: null },
|
||||
cycleDays: []
|
||||
}
|
||||
const periPhase = status.phases.periOvulatory
|
||||
|
||||
if (status.phases.preOvulatory) {
|
||||
const prePhase = status.phases.preOvulatory
|
||||
periPhase.start.date = LocalDate.parse(prePhase.end.date).plusDays(1).toString()
|
||||
|
||||
Reference in New Issue
Block a user