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
b3e2ce0e
Commit
b3e2ce0e
authored
6 years ago
by
Julia Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug: Don't produce closure for every item
parent
863ac6b1
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
components/chart/chart.js
+2
-0
2 additions, 0 deletions
components/chart/chart.js
components/chart/day-column.js
+3
-4
3 additions, 4 deletions
components/chart/day-column.js
components/chart/nfp-lines.js
+18
-18
18 additions, 18 deletions
components/chart/nfp-lines.js
with
23 additions
and
22 deletions
components/chart/chart.js
+
2
−
0
View file @
b3e2ce0e
...
@@ -67,6 +67,8 @@ export default class CycleChart extends Component {
...
@@ -67,6 +67,8 @@ export default class CycleChart extends Component {
data
=
{
this
.
state
.
columns
}
data
=
{
this
.
state
.
columns
}
renderItem
=
{
this
.
renderColumn
}
renderItem
=
{
this
.
renderColumn
}
keyExtractor
=
{
item
=>
item
.
dateString
}
keyExtractor
=
{
item
=>
item
.
dateString
}
initialNumToRender
=
{
15
}
maxToRenderPerBatch
=
{
5
}
>
>
<
/FlatList
>
<
/FlatList
>
<
/View
>
<
/View
>
...
...
This diff is collapsed.
Click to expand it.
components/chart/day-column.js
+
3
−
4
View file @
b3e2ce0e
...
@@ -17,12 +17,12 @@ import slowlog from 'react-native-slowlog'
...
@@ -17,12 +17,12 @@ import slowlog from 'react-native-slowlog'
const
getCycleDayNumber
=
cycleModule
().
getCycleDayNumber
const
getCycleDayNumber
=
cycleModule
().
getCycleDayNumber
const
label
=
styles
.
column
.
label
const
label
=
styles
.
column
.
label
const
getFhmAndLtlInfo
=
setUpFertilityStatusFunc
()
export
default
class
DayColumn
extends
Component
{
export
default
class
DayColumn
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
)
super
(
props
)
this
.
getFhmAndLtlInfo
=
setUpFertilityStatusFunc
()
slowlog
(
this
,
/.*/
)
// slowlog(this, /.*/)
}
}
makeDayColumn
(
data
,
index
)
{
makeDayColumn
(
data
,
index
)
{
const
{
const
{
...
@@ -35,8 +35,7 @@ export default class DayColumn extends Component {
...
@@ -35,8 +35,7 @@ export default class DayColumn extends Component {
}
=
data
}
=
data
const
cycleDayNumber
=
getCycleDayNumber
(
dateString
)
const
cycleDayNumber
=
getCycleDayNumber
(
dateString
)
const
dateLabel
=
dateString
.
split
(
'
-
'
).
slice
(
1
).
join
(
'
-
'
)
const
dateLabel
=
dateString
.
split
(
'
-
'
).
slice
(
1
).
join
(
'
-
'
)
// const nfpLineInfo = this.getFhmAndLtlInfo(dateString, temperature)
const
nfpLineInfo
=
getFhmAndLtlInfo
(
dateString
,
temperature
)
const
nfpLineInfo
=
{}
return
(
return
(
<
G
onPress
=
{()
=>
this
.
passDateToDayView
(
dateString
)}
>
<
G
onPress
=
{()
=>
this
.
passDateToDayView
(
dateString
)}
>
...
...
This diff is collapsed.
Click to expand it.
components/chart/nfp-lines.js
+
18
−
18
View file @
b3e2ce0e
...
@@ -2,26 +2,26 @@ import { getCycleStatusForDay } from '../../lib/sympto-adapter'
...
@@ -2,26 +2,26 @@ import { getCycleStatusForDay } from '../../lib/sympto-adapter'
import
{
normalizeToScale
}
from
'
./y-axis
'
import
{
normalizeToScale
}
from
'
./y-axis
'
export
default
function
()
{
export
default
function
()
{
le
t
cycle
Status
cons
t
cycle
=
{
let
cycleStartDate
status
:
null
let
noMoreCycles
=
false
}
function
updateCurrentCycle
(
dateString
)
{
function
updateCurrentCycle
(
dateString
)
{
cycle
S
tatus
=
getCycleStatusForDay
(
dateString
)
cycle
.
s
tatus
=
getCycleStatusForDay
(
dateString
)
if
(
!
cycle
S
tatus
)
{
if
(
!
cycle
.
s
tatus
)
{
noMoreCycles
=
true
cycle
.
noMoreCycles
=
true
return
return
}
}
if
(
cycle
S
tatus
.
phases
.
preOvulatory
)
{
if
(
cycle
.
s
tatus
.
phases
.
preOvulatory
)
{
cycle
S
tartDate
=
cycle
S
tatus
.
phases
.
preOvulatory
.
start
.
date
cycle
.
s
tartDate
=
cycle
.
s
tatus
.
phases
.
preOvulatory
.
start
.
date
}
else
{
}
else
{
cycle
S
tartDate
=
cycle
S
tatus
.
phases
.
periOvulatory
.
start
.
date
cycle
.
s
tartDate
=
cycle
.
s
tatus
.
phases
.
periOvulatory
.
start
.
date
}
}
}
}
function
dateIsInPeriOrPostPhase
(
dateString
)
{
function
dateIsInPeriOrPostPhase
(
dateString
)
{
return
(
return
(
dateString
>=
cycle
S
tatus
.
phases
.
periOvulatory
.
start
.
date
dateString
>=
cycle
.
s
tatus
.
phases
.
periOvulatory
.
start
.
date
)
)
}
}
...
@@ -29,15 +29,15 @@ export default function () {
...
@@ -29,15 +29,15 @@ export default function () {
return
(
return
(
// we are only interested in days that have a preceding
// we are only interested in days that have a preceding
// temp
// temp
Object
.
keys
(
cycle
S
tatus
.
phases
).
some
(
phaseName
=>
{
Object
.
keys
(
cycle
.
s
tatus
.
phases
).
some
(
phaseName
=>
{
return
cycle
S
tatus
.
phases
[
phaseName
].
cycleDays
.
some
(
day
=>
{
return
cycle
.
s
tatus
.
phases
[
phaseName
].
cycleDays
.
some
(
day
=>
{
return
day
.
temperature
&&
day
.
date
<
dateString
return
day
.
temperature
&&
day
.
date
<
dateString
})
})
})
})
// and also a following temp, so we don't draw the line
// and also a following temp, so we don't draw the line
// longer than necessary
// longer than necessary
&&
&&
cycle
S
tatus
.
phases
.
postOvulatory
.
cycleDays
.
some
(
day
=>
{
cycle
.
s
tatus
.
phases
.
postOvulatory
.
cycleDays
.
some
(
day
=>
{
return
day
.
temperature
&&
day
.
date
>
dateString
return
day
.
temperature
&&
day
.
date
>
dateString
})
})
)
)
...
@@ -51,13 +51,13 @@ export default function () {
...
@@ -51,13 +51,13 @@ export default function () {
return
function
(
dateString
,
temperature
)
{
return
function
(
dateString
,
temperature
)
{
const
ret
=
{}
const
ret
=
{}
if
(
!
cycle
S
tatus
&&
!
noMoreCycles
)
updateCurrentCycle
(
dateString
)
if
(
!
cycle
.
s
tatus
&&
!
cycle
.
noMoreCycles
)
updateCurrentCycle
(
dateString
)
if
(
noMoreCycles
)
return
ret
if
(
cycle
.
noMoreCycles
)
return
ret
if
(
dateString
<
cycle
S
tartDate
)
updateCurrentCycle
(
dateString
)
if
(
dateString
<
cycle
.
s
tartDate
)
updateCurrentCycle
(
dateString
)
if
(
noMoreCycles
)
return
ret
if
(
cycle
.
noMoreCycles
)
return
ret
const
tempShift
=
cycle
S
tatus
.
temperatureShift
const
tempShift
=
cycle
.
s
tatus
.
temperatureShift
if
(
tempShift
)
{
if
(
tempShift
)
{
if
(
tempShift
.
firstHighMeasurementDay
.
date
===
dateString
)
{
if
(
tempShift
.
firstHighMeasurementDay
.
date
===
dateString
)
{
...
...
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