From c3e4fd3f0362d482f0566bf555853b8d0afdc375 Mon Sep 17 00:00:00 2001 From: Sofiya Tepikin Date: Mon, 5 Jun 2023 19:56:55 +0200 Subject: [PATCH] Revert json conversion --- lib/cycle.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/cycle.js b/lib/cycle.js index 90c4a30..1aa5780 100644 --- a/lib/cycle.js +++ b/lib/cycle.js @@ -3,8 +3,6 @@ import { getCycleLengthStats } from './cycle-length' const LocalDate = joda.LocalDate const DAYS = joda.ChronoUnit.DAYS -const toJSON = (realmObj) => JSON.parse(JSON.stringify(realmObj)) - export default function config(opts) { let bleedingDaysSortedByDate let cycleStartsSortedByDate @@ -16,13 +14,10 @@ export default function config(opts) { if (!opts) { // we only want to require (and run) the db module // when not running the tests - bleedingDaysSortedByDate = toJSON( - require('../db').getBleedingDaysSortedByDate() - ) - cycleStartsSortedByDate = toJSON( - require('../db').getCycleStartsSortedByDate() - ) - cycleDaysSortedByDate = toJSON(require('../db').getCycleDaysSortedByDate()) + bleedingDaysSortedByDate = require('../db').getBleedingDaysSortedByDate() + cycleStartsSortedByDate = require('../db').getCycleStartsSortedByDate() + cycleDaysSortedByDate = require('../db').getCycleDaysSortedByDate() + maxBreakInBleeding = 1 maxCycleLength = 99 minCyclesForPrediction = 3