Fix sex, mood & pain symptoms not showing data on the overview

This commit is contained in:
Sofiya Tepikin
2022-04-24 22:04:10 +02:00
parent bce21ff9a9
commit 7d109878fc
2 changed files with 9 additions and 2 deletions
+8 -1
View File
@@ -1,6 +1,10 @@
import { ChronoUnit, LocalDate, LocalTime } from 'js-joda' import { ChronoUnit, LocalDate, LocalTime } from 'js-joda'
import { getPreviousTemperatureForDate, saveSymptom } from '../../db' import {
getPreviousTemperatureForDate,
saveSymptom,
mapRealmObjToJsObj,
} from '../../db'
import { scaleObservable } from '../../local-storage' import { scaleObservable } from '../../local-storage'
import * as labels from '../../i18n/en/cycle-day' import * as labels from '../../i18n/en/cycle-day'
@@ -383,6 +387,7 @@ const label = {
} }
}, },
sex: (sex) => { sex: (sex) => {
sex = mapRealmObjToJsObj(sex)
const sexLabel = [] const sexLabel = []
if (sex && Object.values({ ...sex }).some((val) => val)) { if (sex && Object.values({ ...sex }).some((val) => val)) {
Object.keys(sex).forEach((key) => { Object.keys(sex).forEach((key) => {
@@ -401,6 +406,7 @@ const label = {
} }
}, },
pain: (pain) => { pain: (pain) => {
pain = mapRealmObjToJsObj(pain)
const painLabel = [] const painLabel = []
if (pain && Object.values({ ...pain }).some((val) => val)) { if (pain && Object.values({ ...pain }).some((val) => val)) {
Object.keys(pain).forEach((key) => { Object.keys(pain).forEach((key) => {
@@ -419,6 +425,7 @@ const label = {
} }
}, },
mood: (mood) => { mood: (mood) => {
mood = mapRealmObjToJsObj(mood)
const moodLabel = [] const moodLabel = []
if (mood && Object.values({ ...mood }).some((val) => val)) { if (mood && Object.values({ ...mood }).some((val) => val)) {
Object.keys(mood).forEach((key) => { Object.keys(mood).forEach((key) => {
+1 -1
View File
@@ -58,7 +58,7 @@ export function closeDb() {
db.close() db.close()
} }
function mapRealmObjToJsObj(realmObj) { export function mapRealmObjToJsObj(realmObj) {
return realmObj ? JSON.parse(JSON.stringify(realmObj)) : realmObj return realmObj ? JSON.parse(JSON.stringify(realmObj)) : realmObj
} }