Skip to content

Commit

Permalink
Merge pull request #60 from LCOGT/feature/gcn-email
Browse files Browse the repository at this point in the history
Fixes to not display units if there are no values.
  • Loading branch information
phycodurus authored Jun 1, 2023
2 parents 200de22 + 5efc031 commit b8f96b9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/mixins/messageFormatMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ export var messageFormatMixin = {
if (!_.isEmpty(message[i].orbital_elements)){
message[i].orbital_elements = _.omitBy(message[i].orbital_elements, field => field === null || (_.isEmpty(field) && !_.isBoolean(field)));
}
message[i] = _.omitBy(message[i], (value, key) => key.includes('unit') && key.replace('_unit', '') in message[i] && message[i][key.replace('_unit', '')] === null);
message[i] = _.omitBy(message[i], field => field === null || (_.isEmpty(field) && !_.isBoolean(field)));
if (!_.isEmpty(message[i].aliases)){
message[i].aliases = message[i].aliases.split(',');
}
}
return message;
// Remove empty objects
return message.filter(obj => Object.keys(obj).length !== 0);
},
flattenExtraData: function(extra_data) {
const keywordSections = ['targets', 'references', 'event_id', 'astrometry', 'spectroscopy'];
Expand Down

0 comments on commit b8f96b9

Please sign in to comment.