|
@@ -587,6 +587,8 @@
|
|
measurements = careMonth['measurements_' + _type + '_json'];
|
|
measurements = careMonth['measurements_' + _type + '_json'];
|
|
|
|
|
|
addMCHook('refresh-' + _careMonthUid + '_' + _type, function () {
|
|
addMCHook('refresh-' + _careMonthUid + '_' + _type, function () {
|
|
|
|
+ console.log(arguments);
|
|
|
|
+ debugger
|
|
prepareMeasurementsPopup(_careMonthUid, _type);
|
|
prepareMeasurementsPopup(_careMonthUid, _type);
|
|
return false;
|
|
return false;
|
|
});
|
|
});
|
|
@@ -691,10 +693,22 @@
|
|
tr.appendTo(tbody);
|
|
tr.appendTo(tbody);
|
|
}
|
|
}
|
|
initMoes();
|
|
initMoes();
|
|
|
|
+ debugger
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function filterLatestMeasurementEachDay(_measurements) {
|
|
|
|
+ let filtered = [], addedDates = {};
|
|
|
|
+ for (let i = _measurements.length - 1; i >=0 ; i--) {
|
|
|
|
+ if(!addedDates[_measurements[i].date_standard]) {
|
|
|
|
+ addedDates[_measurements[i].date_standard] = 1;
|
|
|
|
+ filtered.push(_measurements[i]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return filtered;
|
|
}
|
|
}
|
|
|
|
|
|
function initBpGraph(_measurements) {
|
|
function initBpGraph(_measurements) {
|
|
- console.log(_measurements.map(_x => _x.date_standard));
|
|
|
|
|
|
+ let filtered = filterLatestMeasurementEachDay(_measurements);
|
|
$('#rpm-manager-bp-graph-container')
|
|
$('#rpm-manager-bp-graph-container')
|
|
.empty()
|
|
.empty()
|
|
.append('<div id="rpm-manager-bp-graph"></div>');
|
|
.append('<div id="rpm-manager-bp-graph"></div>');
|
|
@@ -703,9 +717,9 @@
|
|
data: {
|
|
data: {
|
|
x: 'x',
|
|
x: 'x',
|
|
columns: [
|
|
columns: [
|
|
- ['x', ..._measurements.map(_x => _x.date_standard)],
|
|
|
|
- ['Systolic BP', ..._measurements.map(_x => _x.sbpMmHg)],
|
|
|
|
- ['Diastolic BP', ..._measurements.map(_x => _x.dbpMmHg)]
|
|
|
|
|
|
+ ['x', ...filtered.map(_x => _x.date_standard)],
|
|
|
|
+ ['Systolic BP', ...filtered.map(_x => _x.sbpMmHg)],
|
|
|
|
+ ['Diastolic BP', ...filtered.map(_x => _x.dbpMmHg)]
|
|
]
|
|
]
|
|
},
|
|
},
|
|
axis: {
|
|
axis: {
|
|
@@ -736,6 +750,7 @@
|
|
}
|
|
}
|
|
|
|
|
|
function initWeightGraph(_measurements) {
|
|
function initWeightGraph(_measurements) {
|
|
|
|
+ let filtered = filterLatestMeasurementEachDay(_measurements);
|
|
$('#rpm-manager-weight-graph-container')
|
|
$('#rpm-manager-weight-graph-container')
|
|
.empty()
|
|
.empty()
|
|
.append('<div id="rpm-manager-weight-graph"></div>');
|
|
.append('<div id="rpm-manager-weight-graph"></div>');
|
|
@@ -744,8 +759,8 @@
|
|
data: {
|
|
data: {
|
|
x: 'x',
|
|
x: 'x',
|
|
columns: [
|
|
columns: [
|
|
- ['x', ..._measurements.map(_x => _x.date_standard)],
|
|
|
|
- ['Weight', ..._measurements.map(_x => _x.numericValue)]
|
|
|
|
|
|
+ ['x', ...filtered.map(_x => _x.date_standard)],
|
|
|
|
+ ['Weight', ...filtered.map(_x => _x.numericValue)]
|
|
]
|
|
]
|
|
},
|
|
},
|
|
axis: {
|
|
axis: {
|