Add new home screen

This commit is contained in:
Julia Friesel
2018-09-30 15:02:11 +02:00
parent bd37c118f1
commit 7b8b905550
40 changed files with 367 additions and 356 deletions
-58
View File
@@ -3,14 +3,6 @@ import { LocalDate, ChronoUnit } from 'js-joda'
import nodejs from 'nodejs-mobile-react-native'
import fs from 'react-native-fs'
import restart from 'react-native-restart'
import {
cycleWithFhmMucus,
longAndComplicatedCycleWithMucus,
cycleWithTempAndNoMucusShift,
cervixShiftAndFhmOnSameDay,
longAndComplicatedCycleWithCervix,
cycleWithTempAndNoCervixShift
} from './fixtures'
import schemas from './schemas'
let db
@@ -75,56 +67,6 @@ export function getCycleDay(localDate) {
return db.objectForPrimaryKey('CycleDay', localDate)
}
export function fillWithMucusDummyData() {
const dummyCycles = [
cycleWithFhmMucus,
longAndComplicatedCycleWithMucus,
cycleWithTempAndNoMucusShift
]
db.write(() => {
db.deleteAll()
dummyCycles.forEach(cycle => {
cycle.forEach(day => {
const existing = getCycleDay(day.date)
if (existing) {
Object.keys(day).forEach(key => {
if (key === 'date') return
existing[key] = day[key]
})
} else {
db.create('CycleDay', day)
}
})
})
})
}
export function fillWithCervixDummyData() {
const dummyCycles = [
cervixShiftAndFhmOnSameDay,
longAndComplicatedCycleWithCervix,
cycleWithTempAndNoCervixShift
]
db.write(() => {
db.deleteAll()
dummyCycles.forEach(cycle => {
cycle.forEach(day => {
const existing = getCycleDay(day.date)
if (existing) {
Object.keys(day).forEach(key => {
if (key === 'date') return
existing[key] = day[key]
})
} else {
db.create('CycleDay', day)
}
})
})
})
}
export function getPreviousTemperature(cycleDay) {
cycleDay.wrappedDate = LocalDate.parse(cycleDay.date)
const winner = getTemperatureDaysSortedByDate().find(day => {