Skip to content
Snippets Groups Projects
Commit c28e32a9 authored by Julia Friesel's avatar Julia Friesel
Browse files

Simplify stats constructor a bit

parent 7f93ba15
No related branches found
No related tags found
No related merge requests found
...@@ -9,17 +9,14 @@ import cycleModule from '../lib/cycle' ...@@ -9,17 +9,14 @@ import cycleModule from '../lib/cycle'
import {getCycleLengthStats as getCycleInfo} from '../lib/cycle-length' import {getCycleLengthStats as getCycleInfo} from '../lib/cycle-length'
import {stats as labels} from '../i18n/en/labels' import {stats as labels} from '../i18n/en/labels'
import AppText from './app-text' import AppText from './app-text'
import { getCycleStartsSortedByDate } from '../db'
export default class Stats extends Component { export default class Stats extends Component {
render() { render() {
const allMensesStarts = getCycleStartsSortedByDate() const cycleLengths = cycleModule().getAllCycleLengths()
const atLeastOneCycle = allMensesStarts.length > 1 const atLeastOneCycle = cycleLengths.length > 1
let cycleLengths
let numberOfCycles let numberOfCycles
let cycleInfo let cycleInfo
if (atLeastOneCycle) { if (atLeastOneCycle) {
cycleLengths = cycleModule().getAllCycleLengths()
numberOfCycles = cycleLengths.length numberOfCycles = cycleLengths.length
if (numberOfCycles > 1) { if (numberOfCycles > 1) {
cycleInfo = getCycleInfo(cycleLengths) cycleInfo = getCycleInfo(cycleLengths)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment