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
897e99e6
Commit
897e99e6
authored
6 years ago
by
tina
Browse files
Options
Downloads
Patches
Plain Diff
adds stats button on home screen, and creates stats screen, length still needs to be calculated
parent
f5b37161
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
app.js
+3
-1
3 additions, 1 deletion
app.js
components/home.js
+6
-0
6 additions, 0 deletions
components/home.js
components/stats.js
+41
-0
41 additions, 0 deletions
components/stats.js
lib/cycle.js
+2
-1
2 additions, 1 deletion
lib/cycle.js
with
52 additions
and
2 deletions
app.js
+
3
−
1
View file @
897e99e6
...
...
@@ -5,6 +5,7 @@ import Calendar from './components/calendar'
import
CycleDay
from
'
./components/cycle-day
'
import
Chart
from
'
./components/chart/chart
'
import
Settings
from
'
./components/settings
'
import
Stats
from
'
./components/stats
'
// this is until react native fixes this bugg, see
// https://github.com/facebook/react-native/issues/18868#issuecomment-382671739
...
...
@@ -16,5 +17,6 @@ export default createStackNavigator({
calendar
:
{
screen
:
Calendar
},
cycleDay
:
{
screen
:
CycleDay
},
chart
:
{
screen
:
Chart
},
settings
:
{
screen
:
Settings
}
settings
:
{
screen
:
Settings
},
stats
:
{
screen
:
Stats
}
})
This diff is collapsed.
Click to expand it.
components/home.js
+
6
−
0
View file @
897e99e6
...
...
@@ -87,6 +87,12 @@ export default class Home extends Component {
title
=
"
delete everything
"
>
<
/Button
>
<
/View
>
<
View
style
=
{
styles
.
homeButton
}
>
<
Button
onPress
=
{()
=>
navigate
(
'
stats
'
)}
title
=
"
Go to stats
"
>
<
/Button
>
<
/View
>
<
/View
>
<
/ScrollView
>
)
...
...
This diff is collapsed.
Click to expand it.
components/stats.js
0 → 100644
+
41
−
0
View file @
897e99e6
import
React
,
{
Component
}
from
'
react
'
import
{
View
,
Text
,
ScrollView
}
from
'
react-native
'
import
{
LocalDate
}
from
'
js-joda
'
import
styles
from
'
../styles/index
'
import
cycleModule
from
'
../lib/cycle
'
import
getPeriodInfo
from
'
../lib/period-length
'
export
default
class
Stats
extends
Component
{
constructor
(
props
)
{
super
(
props
)
const
lastMensStart
=
cycleModule
().
getLastMensesStart
(
LocalDate
.
now
().
toString
()
)
const
completedCycles
=
cycleModule
().
getCyclesBefore
(
lastMensStart
)
this
.
numberOfCycles
=
completedCycles
.
length
// TODO get first days, compare with joda
const
periodLengths
=
completedCycles
.
map
(
cycle
=>
{
return
cycle
.
length
})
// until this point
this
.
periodInfo
=
getPeriodInfo
(
periodLengths
)
}
render
()
{
return
(
<
ScrollView
>
<
Text
style
=
{
styles
.
welcome
}
>
based
on
{
this
.
numberOfCycles
}
periods
:
<
/Text
>
<
Text
style
=
{
styles
.
welcome
}
>
min
:
{
this
.
periodInfo
.
minimum
}
<
/Text
>
<
Text
style
=
{
styles
.
welcome
}
>
mean
:
{
this
.
periodInfo
.
mean
}
<
/Text
>
<
Text
style
=
{
styles
.
welcome
}
>
max
:
{
this
.
periodInfo
.
maximum
}
<
/Text
>
<
Text
style
=
{
styles
.
welcome
}
>
median
:
{
this
.
periodInfo
.
median
}
<
/Text
>
<
Text
style
=
{
styles
.
welcome
}
>
standard
deviation
:
{
this
.
periodInfo
.
stdDeviation
}
<
/Text
>
<
/ScrollView
>
)
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
lib/cycle.js
+
2
−
1
View file @
897e99e6
...
...
@@ -134,6 +134,7 @@ export default function config(opts) {
getCycleDayNumber
,
getCycleForDay
,
getPreviousCycle
,
getCyclesBefore
getCyclesBefore
,
getLastMensesStart
}
}
\ 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