Skip to content

Commit

Permalink
Merge pull request #1402 from tidepool-org/WEB-3005-WEB-3306-WEB-3007…
Browse files Browse the repository at this point in the history
…-WEB-3008-loop-stats

Loop in web visualizations
  • Loading branch information
clintonium-119 authored Aug 5, 2024
2 parents 81b1f4d + 3b411b5 commit e6da7df
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 17 deletions.
1 change: 1 addition & 0 deletions app/components/chart/daily.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ class Daily extends Component {
}}
side={this.state.hoveredPumpSettingsOverride.side}
override={this.state.hoveredPumpSettingsOverride.data}
bgPrefs={bgPrefs}
timePrefs={timePrefs}
/>}
<WindowSizeListener onResize={this.handleWindowResize} />
Expand Down
1 change: 1 addition & 0 deletions app/core/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const ALL_FETCHED_DATA_TYPES = [
...DIABETES_DATA_TYPES,
'cgmSettings',
'deviceEvent',
'dosingDecision',
'insulin',
'physicalActivity',
'pumpSettings',
Expand Down
4 changes: 3 additions & 1 deletion app/pages/patientdata/patientdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ export const PatientDataClass = createReactClass({
chartType,
} = state;

const manufacturer = this.getMetaData('latestPumpUpload.manufacturer');
const manufacturer = this.getMetaData('latestPumpUpload.manufacturer', '');
const bgSource = this.getMetaData('bgSources.current');
const endpoints = this.getCurrentData('endpoints');
const { averageDailyDose, ...statsData } = this.getCurrentData('stats');
Expand Down Expand Up @@ -955,6 +955,8 @@ export const PatientDataClass = createReactClass({
}, {});

props.generateAGPImagesSuccess(processedImages);
} else {
props.generateAGPImagesSuccess(results);
}
},

Expand Down
8 changes: 6 additions & 2 deletions app/redux/actions/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,7 @@ export function fetchPatientData(api, options, id) {
});

let latestUpload;
let latestPumpSettings;

return (dispatch, getState) => {
// If we have a valid cache of the data in our redux store, return without dispatching the fetch
Expand Down Expand Up @@ -1120,7 +1121,7 @@ export function fetchPatientData(api, options, id) {
// We want to make sure the latest upload, which may be beyond the data range we'll be
// fetching, is stored so we can include it with the fetched results
latestUpload = _.find(latestDatums, { type: 'upload' });
const latestPumpSettings = _.find(latestDatums, { type: 'pumpSettings' });
latestPumpSettings = _.find(latestDatums, { type: 'pumpSettings' });
const latestPumpSettingsUploadId = _.get(latestPumpSettings || {}, 'uploadId');
const latestPumpSettingsUpload = _.find(latestDatums, { type: 'upload', uploadId: latestPumpSettingsUploadId });

Expand Down Expand Up @@ -1206,11 +1207,14 @@ export function fetchPatientData(api, options, id) {
...resultsVal.teamNotes,
];

// If the latest upload is later than the latest diabetes datum, it would have been
// If the latest upload or pumpSettings is later than the latest diabetes datum, it would have been
// outside of the fetched data range, and needs to be added.
if (latestUpload && !_.find(combinedData, { id: latestUpload.id })) {
combinedData.push(latestUpload);
}
if (latestPumpSettings && !_.find(combinedData, { id: latestPumpSettings.id })) {
combinedData.push(latestPumpSettings);
}

handleFetchSuccess(combinedData, id, options);
}
Expand Down
2 changes: 1 addition & 1 deletion app/redux/reducers/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const data = (state = initialState.data, action) => {

if (destination !== 'redux') {
if (destination === 'window') window.patientData = result;
if (destination === 'download') console.save(result, 'patientData.json');
if (destination === 'download') console.save(result, result?.query?.raw ? 'rawData.json' : 'patientData.json');
return state;
}

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"node": "20.8.0"
},
"packageManager": "[email protected]",
"version": "1.80.0",
"version": "1.81.0-web-3005-web-3306-web-3007-web-3008-loop-stats.1",
"private": true,
"scripts": {
"test": "TZ=UTC NODE_ENV=test NODE_OPTIONS='--max-old-space-size=4096' yarn karma start",
Expand Down Expand Up @@ -66,7 +66,7 @@
"@storybook/react": "7.5.0",
"@storybook/react-webpack5": "7.5.0",
"@testing-library/react-hooks": "8.0.1",
"@tidepool/viz": "1.41.0",
"@tidepool/viz": "1.42.0-web-3005-web-3306-web-3007-web-3008-loop-stats.2",
"async": "2.6.4",
"autoprefixer": "10.4.16",
"babel-core": "7.0.0-bridge.0",
Expand Down Expand Up @@ -184,7 +184,7 @@
"terser": "5.22.0",
"terser-webpack-plugin": "5.3.9",
"theme-ui": "0.16.1",
"tideline": "1.28.1",
"tideline": "1.30.0-web-3005-web-3306-web-3007-web-3008-loop-stats.1",
"tidepool-platform-client": "0.59.0",
"tidepool-standard-action": "0.1.1",
"ua-parser-js": "1.0.36",
Expand Down
1 change: 1 addition & 0 deletions test/unit/app/core/constants.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ describe('constants', function() {
'food',
'cgmSettings',
'deviceEvent',
'dosingDecision',
'insulin',
'physicalActivity',
'pumpSettings',
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5268,9 +5268,9 @@ __metadata:
languageName: node
linkType: hard

"@tidepool/viz@npm:1.41.0":
version: 1.41.0
resolution: "@tidepool/viz@npm:1.41.0"
"@tidepool/viz@npm:1.42.0-web-3005-web-3306-web-3007-web-3008-loop-stats.2":
version: 1.42.0-web-3005-web-3306-web-3007-web-3008-loop-stats.2
resolution: "@tidepool/viz@npm:1.42.0-web-3005-web-3306-web-3007-web-3008-loop-stats.2"
dependencies:
bluebird: 3.7.2
bows: 1.7.2
Expand Down Expand Up @@ -5330,7 +5330,7 @@ __metadata:
react-dom: 16.x
react-redux: 8.x
redux: 4.x
checksum: 0941b1ad9a835a68b4183e2ab7bf82fa6337dcaab33acbfe2b95a4f428d4671d36248603c292f7c17428ce4a52fd333ef6dee76b08b82e1cfe733791e07af72d
checksum: d64737a66f6f59d7df463e34035e8b7584ec0d37c4a71ae1224598a072999ec13c5ef43699fa9e7b077e33b41783ffa398a71b7a68cd448cde188b7e4809e88a
languageName: node
linkType: hard

Expand Down Expand Up @@ -7427,7 +7427,7 @@ __metadata:
"@storybook/react": 7.5.0
"@storybook/react-webpack5": 7.5.0
"@testing-library/react-hooks": 8.0.1
"@tidepool/viz": 1.41.0
"@tidepool/viz": 1.42.0-web-3005-web-3306-web-3007-web-3008-loop-stats.2
async: 2.6.4
autoprefixer: 10.4.16
babel-core: 7.0.0-bridge.0
Expand Down Expand Up @@ -7552,7 +7552,7 @@ __metadata:
terser: 5.22.0
terser-webpack-plugin: 5.3.9
theme-ui: 0.16.1
tideline: 1.28.1
tideline: 1.30.0-web-3005-web-3306-web-3007-web-3008-loop-stats.1
tidepool-platform-client: 0.59.0
tidepool-standard-action: 0.1.1
ua-parser-js: 1.0.36
Expand Down Expand Up @@ -22992,9 +22992,9 @@ __metadata:
languageName: node
linkType: hard

"tideline@npm:1.28.1":
version: 1.28.1
resolution: "tideline@npm:1.28.1"
"tideline@npm:1.30.0-web-3005-web-3306-web-3007-web-3008-loop-stats.1":
version: 1.30.0-web-3005-web-3306-web-3007-web-3008-loop-stats.1
resolution: "tideline@npm:1.30.0-web-3005-web-3306-web-3007-web-3008-loop-stats.1"
dependencies:
bows: 1.7.2
classnames: 2.3.2
Expand All @@ -23014,7 +23014,7 @@ __metadata:
peerDependencies:
babel-core: 6.x || 7.0.0-bridge.0
lodash: ^4.17.21
checksum: e65581c9cdd8f067190339831700e9eb73834b20c54b8d70f621c13db3437b898af1508e8ba8e40e7bded27153d4065b3ea66c0337c7eec926e8fc9cc72eb789
checksum: cc11a683c8b29931493de204aa151bfed638d2c485f278207caa7889528fc6a921d74515de255b3331162de8677f2861e7f86699e455d1f3ec8110476e982fec
languageName: node
linkType: hard

Expand Down

0 comments on commit e6da7df

Please sign in to comment.