Filter out incomplete cervix value days in sympto adapter
This commit is contained in:
@@ -108,7 +108,11 @@ function formatCycleForSympto(cycle) {
|
|||||||
if (day[symptomName] && day[symptomName].exclude) {
|
if (day[symptomName] && day[symptomName].exclude) {
|
||||||
delete day[symptomName]
|
delete day[symptomName]
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
// remove days with incomplete cervix values
|
||||||
|
if (hasIncompleteCervixValue(day)) {
|
||||||
|
delete day.cervix
|
||||||
|
}
|
||||||
// change format
|
// change format
|
||||||
['bleeding', 'temperature', 'mucus'].forEach(symptomName => {
|
['bleeding', 'temperature', 'mucus'].forEach(symptomName => {
|
||||||
if (day[symptomName]) day[symptomName] = day[symptomName].value
|
if (day[symptomName]) day[symptomName] = day[symptomName].value
|
||||||
@@ -120,3 +124,7 @@ function formatCycleForSympto(cycle) {
|
|||||||
formatted.reverse()
|
formatted.reverse()
|
||||||
return formatted
|
return formatted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hasIncompleteCervixValue(day) {
|
||||||
|
return day.cervix && (typeof day.cervix.opening != 'number' || typeof day.cervix.firmness != 'number')
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user