Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drip
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
backup
Drip
Commits
de2233f9
Commit
de2233f9
authored
6 years ago
by
Julia Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Fix assert for bleeding value === null
parent
125fd84d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/sympto/index.js
+12
-10
12 additions, 10 deletions
lib/sympto/index.js
with
12 additions
and
10 deletions
lib/sympto/index.js
+
12
−
10
View file @
de2233f9
...
...
@@ -5,7 +5,7 @@ import { LocalDate } from 'js-joda'
import
assert
from
'
assert
'
export
default
function
getSymptoThermalStatus
({
cycle
,
previousCycles
=
[]
})
{
throwIfArgsAreNotInRequiredFormat
(
cycle
,
previousCycles
)
throwIfArgsAreNotInRequiredFormat
(
[
cycle
,
...
previousCycles
]
)
const
status
=
{
assumeFertility
:
true
,
...
...
@@ -14,12 +14,14 @@ export default function getSymptoThermalStatus({ cycle, previousCycles = [] }) {
// if there was no first higher measurement in the previous cycle,
// no infertile pre-ovulatory phase may be assumed
const
lastCycle
=
previousCycles
[
previousCycles
.
length
-
1
]
if
(
lastCycle
&&
getSymptoThermalStatus
({
cycle
:
lastCycle
}).
temperatureShift
)
{
status
.
phases
.
preOvulatory
=
getPreOvulatoryPhase
(
cycle
,
previousCycles
)
if
(
status
.
phases
.
preOvulatory
.
cycleDays
.
length
===
cycle
.
length
)
{
status
.
assumeFertility
=
false
return
status
if
(
previousCycles
)
{
const
lastCycle
=
previousCycles
[
previousCycles
.
length
-
1
]
if
(
lastCycle
&&
getSymptoThermalStatus
({
cycle
:
lastCycle
}).
temperatureShift
)
{
status
.
phases
.
preOvulatory
=
getPreOvulatoryPhase
(
cycle
,
previousCycles
)
if
(
status
.
phases
.
preOvulatory
.
cycleDays
.
length
===
cycle
.
length
)
{
status
.
assumeFertility
=
false
return
status
}
}
}
...
...
@@ -71,11 +73,11 @@ export default function getSymptoThermalStatus({ cycle, previousCycles = [] }) {
return
status
}
function
throwIfArgsAreNotInRequiredFormat
(
cycle
,
previousCycle
s
)
{
[
cycle
,
...
previousCycles
]
.
forEach
(
cycle
=>
{
function
throwIfArgsAreNotInRequiredFormat
(
cycles
)
{
cycle
s
.
forEach
(
cycle
=>
{
assert
.
ok
(
Array
.
isArray
(
cycle
))
// TODO handle case of no previous cycles
assert
.
ok
(
cycle
.
length
>
0
)
assert
.
ok
(
cycle
[
0
].
bleeding
!==
null
)
assert
.
equal
(
typeof
cycle
[
0
].
bleeding
,
'
object
'
)
assert
.
equal
(
typeof
cycle
[
0
].
bleeding
.
value
,
'
number
'
)
cycle
.
forEach
(
day
=>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment