diff --git a/awx/ui/client/src/system-tracking/data-services/dedupe-versions.js b/awx/ui/client/src/system-tracking/data-services/dedupe-versions.js index 789d1cd61e..e6f2704008 100644 --- a/awx/ui/client/src/system-tracking/data-services/dedupe-versions.js +++ b/awx/ui/client/src/system-tracking/data-services/dedupe-versions.js @@ -5,6 +5,12 @@ export default return _.pluck(nonEmptyResults, 'versions[0]'); } + // if the version that will be displayed on the left is before the + // version that will be displayed on the right, flip them + if (nonEmptyResults[0].versions[0].timestamp > nonEmptyResults[1].versions[0].timestamp) { + nonEmptyResults = nonEmptyResults.reverse(); + } + var firstTimestamp = nonEmptyResults[0].versions[0].timestamp; var hostIdsWithDupes = diff --git a/awx/ui/client/src/system-tracking/data-services/resolve-empty-versions.factory.js b/awx/ui/client/src/system-tracking/data-services/resolve-empty-versions.factory.js index d96ddf4ac1..7c7552af87 100644 --- a/awx/ui/client/src/system-tracking/data-services/resolve-empty-versions.factory.js +++ b/awx/ui/client/src/system-tracking/data-services/resolve-empty-versions.factory.js @@ -4,8 +4,10 @@ function resolveEmptyVersions(service, _, candidate, previousResult) { candidate = _.merge({}, candidate); - if (_.isEmpty(candidate.versions)) { - var originalStartDate = candidate.dateRange.from.clone(); + // theoretically, returning no versions, but also returning only a single version for _a particular date_ acts as an empty version problem. If there is only one version returned, you'll need to check previous dates as well. + if (_.isEmpty(candidate.versions) || candidate.versions.length === 1) { + // this marks the end of the date put in the datepicker. this needs to be the end, rather than the beginning of the date, because you may have returned one valid version on the date the datepicker had in it. + var originalStartDate = candidate.dateRange.to.clone(); if (!_.isUndefined(previousResult)) { candidate.dateRange.from = moment(previousResult.versions[0].timestamp);