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
8bbf122d
Commit
8bbf122d
authored
6 years ago
by
Julia Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Ignore 0 -> 1 mucus shift
parent
6ac642b9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/sympto/mucus.js
+5
-1
5 additions, 1 deletion
lib/sympto/mucus.js
test/sympto/mucus.spec.js
+29
-2
29 additions, 2 deletions
test/sympto/mucus.spec.js
with
34 additions
and
3 deletions
lib/sympto/mucus.js
+
5
−
1
View file @
8bbf122d
export
default
function
(
cycleDays
,
tempEvalEndIndex
)
{
const
notDetected
=
{
detected
:
false
}
const
mucusDays
=
cycleDays
.
filter
(
day
=>
day
.
mucus
&&
!
day
.
mucus
.
exclude
)
let
currentBestQuality
=
0
...
...
@@ -9,6 +10,9 @@ export default function (cycleDays, tempEvalEndIndex) {
currentBestQuality
=
day
.
mucus
.
value
}
// if mucus only changes from dry to nothing, it doesn't constitute a shift
if
(
currentBestQuality
<
2
)
continue
if
(
day
.
mucus
.
value
!==
currentBestQuality
)
continue
// the three following days must be of lower quality
...
...
@@ -40,6 +44,6 @@ export default function (cycleDays, tempEvalEndIndex) {
}
}
return
{
d
etected
:
false
}
return
notD
etected
}
This diff is collapsed.
Click to expand it.
test/sympto/mucus.spec.js
+
29
−
2
View file @
8bbf122d
...
...
@@ -14,7 +14,7 @@ describe('sympto', () => {
describe
(
'
detect mucus shift
'
,
()
=>
{
describe
(
'
regular rule
'
,
()
=>
{
it
(
'
detects mucus shift correctly
'
,
function
()
{
const
values
=
[
0
,
0
,
0
,
1
,
1
,
2
,
2
,
2
,
3
,
3
,
3
,
2
,
2
,
0
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
]
const
values
=
[
0
,
0
,
0
,
1
,
1
,
2
,
2
,
2
,
3
,
3
,
3
,
2
,
2
,
0
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
]
.
map
(
turnIntoCycleDayObject
)
const
status
=
getMucusStatus
(
values
,
12
)
expect
(
status
).
to
.
eql
({
...
...
@@ -38,7 +38,10 @@ describe('sympto', () => {
})
it
(
'
detects no mucus shift when there are no mucus values
'
,
function
()
{
const
status
=
getMucusStatus
(
Array
(
10
).
fill
({
date
:
1
,
temperature
:
{
value
:
35
}}))
const
status
=
getMucusStatus
(
Array
(
10
).
fill
({
date
:
1
,
temperature
:
{
value
:
35
}
}))
expect
(
status
).
to
.
eql
({
detected
:
false
})
})
...
...
@@ -48,6 +51,30 @@ describe('sympto', () => {
const
status
=
getMucusStatus
(
values
,
30
)
expect
(
status
).
to
.
eql
({
detected
:
false
})
})
it
(
'
detects no mucus shift when mucus only changes from dry to nothing
'
,
function
()
{
const
values
=
[
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]
.
map
(
turnIntoCycleDayObject
)
const
status
=
getMucusStatus
(
values
,
30
)
expect
(
status
).
to
.
eql
({
detected
:
false
})
})
it
(
'
ignores an early seeming shift from 0 to 1
'
,
function
()
{
const
values
=
[
0
,
0
,
0
,
1
,
0
,
0
,
0
,
2
,
3
,
3
,
3
,
2
,
2
,
0
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
]
.
map
(
turnIntoCycleDayObject
)
const
status
=
getMucusStatus
(
values
,
12
)
expect
(
status
).
to
.
eql
({
detected
:
true
,
mucusPeak
:
{
date
:
10
,
mucus
:
{
value
:
3
}
},
evaluationCompleteDay
:
{
date
:
13
,
mucus
:
{
value
:
0
}
}
})
})
})
})
})
\ No newline at end of file
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