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
0de00933
Commit
0de00933
authored
7 years ago
by
Julia Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Handle pre-ovulatory = current
parent
51bd75fb
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/sympto/index.js
+10
-8
10 additions, 8 deletions
lib/sympto/index.js
test/sympto/fixtures.js
+10
-1
10 additions, 1 deletion
test/sympto/fixtures.js
test/sympto/index.spec.js
+18
-1
18 additions, 1 deletion
test/sympto/index.spec.js
with
38 additions
and
10 deletions
lib/sympto/index.js
+
10
−
8
View file @
0de00933
...
@@ -7,23 +7,25 @@ export default function ({ cycle, previousCycle }) {
...
@@ -7,23 +7,25 @@ export default function ({ cycle, previousCycle }) {
// TODO check for basic stuff, throw if nonexistent
// TODO check for basic stuff, throw if nonexistent
const
status
=
{
const
status
=
{
assumeFertility
:
true
,
assumeFertility
:
true
,
phases
:
{
phases
:
{}
periOvulatory
:
{
start
:
{
date
:
null
},
cycleDays
:
null
}
}
}
}
// if there was no first higher measurement in the previous cycle,
// if there was no first higher measurement in the previous cycle,
// no infertile pre-ovulatory phase may be assumed
// no infertile pre-ovulatory phase may be assumed
if
(
getTemperatureShift
(
previousCycle
).
detected
&&
!
cycle
[
0
].
mucus
)
{
if
(
getTemperatureShift
(
previousCycle
).
detected
&&
!
cycle
[
0
].
mucus
)
{
status
.
phases
.
preOvulatory
=
getPreOvulatoryPhase
(
cycle
)
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
const
periPhase
=
status
.
phases
.
periOvulatory
if
(
status
.
phases
.
preOvulatory
)
{
if
(
status
.
phases
.
preOvulatory
)
{
const
prePhase
=
status
.
phases
.
preOvulatory
const
prePhase
=
status
.
phases
.
preOvulatory
periPhase
.
start
.
date
=
LocalDate
.
parse
(
prePhase
.
end
.
date
).
plusDays
(
1
).
toString
()
periPhase
.
start
.
date
=
LocalDate
.
parse
(
prePhase
.
end
.
date
).
plusDays
(
1
).
toString
()
...
...
This diff is collapsed.
Click to expand it.
test/sympto/fixtures.js
+
10
−
1
View file @
0de00933
...
@@ -83,10 +83,19 @@ const cycleWithoutAnyShifts = [
...
@@ -83,10 +83,19 @@ const cycleWithoutAnyShifts = [
{
temperature
:
36.45
,
mucus
:
1
}
{
temperature
:
36.45
,
mucus
:
1
}
].
map
(
convertToSymptoFormat
)
].
map
(
convertToSymptoFormat
)
const
fiveDayCycle
=
[
{
temperature
:
36.6
,
bleeding
:
2
},
{
temperature
:
36.65
},
{
temperature
:
36.5
},
{
temperature
:
36.6
},
{
temperature
:
36.55
}
].
map
(
convertToSymptoFormat
)
export
{
export
{
cycleWithoutTempShift
,
cycleWithoutTempShift
,
cycleWithTempAndMucusShift
,
cycleWithTempAndMucusShift
,
cycleWithTempAndNoMucusShift
,
cycleWithTempAndNoMucusShift
,
cycleWithTempShift
,
cycleWithTempShift
,
cycleWithoutAnyShifts
cycleWithoutAnyShifts
,
fiveDayCycle
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/sympto/index.spec.js
+
18
−
1
View file @
0de00933
import
chai
from
'
chai
'
import
chai
from
'
chai
'
import
getSensiplanStatus
from
'
../../lib/sympto
'
import
getSensiplanStatus
from
'
../../lib/sympto
'
import
{
import
{
cycleWithoutTempShift
,
cycleWithTempAndMucusShift
,
cycleWithTempAndNoMucusShift
,
cycleWithTempShift
,
cycleWithoutAnyShifts
cycleWithoutTempShift
,
cycleWithTempAndMucusShift
,
cycleWithTempAndNoMucusShift
,
cycleWithTempShift
,
cycleWithoutAnyShifts
,
fiveDayCycle
}
from
'
./fixtures
'
}
from
'
./fixtures
'
const
expect
=
chai
.
expect
const
expect
=
chai
.
expect
...
@@ -52,6 +52,23 @@ describe('sympto', () => {
...
@@ -52,6 +52,23 @@ describe('sympto', () => {
})
})
})
})
describe
(
'
with previous higher measurement
'
,
()
=>
{
describe
(
'
with previous higher measurement
'
,
()
=>
{
describe
(
'
with no shifts detects pre-ovulatory phase
'
,
function
()
{
it
(
'
according to 5-day-rule
'
,
function
()
{
const
status
=
getSensiplanStatus
({
cycle
:
fiveDayCycle
,
previousCycle
:
cycleWithTempShift
})
expect
(
Object
.
keys
(
status
.
phases
).
length
).
to
.
eql
(
1
)
expect
(
status
.
assumeFertility
).
to
.
be
.
false
()
expect
(
status
.
phases
.
preOvulatory
).
to
.
eql
({
cycleDays
:
fiveDayCycle
,
start
:
{
date
:
'
2018-06-01
'
},
end
:
{
date
:
'
2018-06-05
'
}
})
})
})
describe
(
'
with no shifts detects pre- and peri-ovulatory phase
'
,
function
()
{
describe
(
'
with no shifts detects pre- and peri-ovulatory phase
'
,
function
()
{
it
(
'
according to 5-day-rule
'
,
function
()
{
it
(
'
according to 5-day-rule
'
,
function
()
{
const
status
=
getSensiplanStatus
({
const
status
=
getSensiplanStatus
({
...
...
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