52North / helgoland-toolbox

Collection of tools for a sensor observation based client
https://52north.github.io/helgoland-toolbox/
Other
13 stars 16 forks source link

Data<TimeValueEntry> has no 'extra' attribute. valueAfterTimespan and valueBeforeTimespan are not set #130

Open ChrisMalewski opened 3 years ago

ChrisMalewski commented 3 years ago

getObservations(dataset: ApiV3Dataset, from: Date, to: Date): Observable<TimeValueEntry[]> {

    const ids: string[] = SwappDatasetUtils.splitServiceIdSeriesId(dataset.internalId);

    return this.helgolandApi.getTsData<TimeValueEntry>(
        ids[1], ids[0], { from: from.getTime(), to: to.getTime() }, { expanded: true }).pipe(
            map((r: any) => {
                const out: IdentifiedTimeValueEntry[] = r.values;
                if (r.extra?.valueAfterTimespan) { out.push(r.valueAfterTimespan); }
                if (r.extra?.valueBeforeTimespan) { out.push(r.valueBeforeTimespan); }
                return out;
            }));
}