Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore glucose null #1324

Merged
merged 2 commits into from
Dec 31, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/glucose-get-last.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ var getLastGlucose = function (data) {
data = data.map(function prepGlucose (obj) {
//Support the NS sgv field to avoid having to convert in a custom way
obj.glucose = obj.glucose || obj.sgv;
return obj;
if ( obj.glucose !== null ) {
return obj;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will cause the map to return undefined instead of null values. If we first filter out those null values (via #1328) we can end up with a more concise array with only relevant values (no null or undefined).

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, merged that. Null checks are still good, though, so any reason not to merge this too?

});

var now = data[0];
Expand Down