[Time Controller] Simplify retrieval of datum objects

...for historical data. Supports WTD-1515
This commit is contained in:
Victor Woeltjen 2015-09-08 17:03:58 -07:00
parent 351181d38e
commit d2dfec3ce7
2 changed files with 17 additions and 4 deletions

View File

@ -102,7 +102,6 @@ define(
telemetryObject.getCapability('limit'),
datum = telemetryObject && handle.getDatum(
telemetryObject,
telemetrySeries,
index
);

View File

@ -106,10 +106,24 @@ define(
.then(issueRequests);
};
self.getDatum = function (telemetryObject, series, index) {
return arguments.length > 1 ?
/**
* Get the latest telemetry datum for this domain object. This
* will be from real-time telemetry, unless an index is specified,
* in which case it will be pulled from the historical telemetry
* series at the specified index.
*
* @param {DomainObject} domainObject the object of interest
* @param {number} [index] the index of the data of interest
* @returns {TelemetryDatum} the most recent datum
*/
self.getDatum = function (telemetryObject, index) {
return typeof index !== 'number' ?
subscription.getDatum(telemetryObject) :
subscription.makeDatum(telemetryObject, series, index);
subscription.makeDatum(
telemetryObject,
this.getSeries(telemetryObject),
index
);
};
return self;