Skip to content

Commit

Permalink
Merge pull request #151 from sasaki77/array-index-extrapolation
Browse files Browse the repository at this point in the history
BUG: disable extrapolation in index array on frontend
  • Loading branch information
sasaki77 authored Aug 9, 2023
2 parents de638d8 + b7069f7 commit a14cca4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/responseParse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export function responseParse(responses: AADataQueryResponse[], target: TargetQu
// Extrapolation for raw operator
const to_msec = target.to.getTime();
const extrapolationDataFrames = _.map(dataFrames, (dataframe) => {
if (dataframe.fields[0].name != "time") {
return dataframe;
}

const latestval = dataframe.get(dataframe.length - 1);
const addval = { ...latestval, time: to_msec };

Expand Down
8 changes: 4 additions & 4 deletions src/specs/datasource.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ describe('Archiverappliance Datasource', () => {
expect(seriesName).toBe('header:PV1');

const indexArray = dataFrame.fields[0].values.toArray();
expect(indexArray).toHaveLength(3);
expect(indexArray[0]).toBe(0);
expect(indexArray[1]).toBe(1);
expect(indexArray[2]).toBe(2);
Expand All @@ -663,14 +664,13 @@ describe('Archiverappliance Datasource', () => {
const valArray2 = dataFrame.fields[2].values.toArray();
const valArray3 = dataFrame.fields[3].values.toArray();

expect(valArray1).toHaveLength(4);
expect(valArray2).toHaveLength(4);
expect(valArray3).toHaveLength(4);
expect(valArray1).toHaveLength(3);
expect(valArray2).toHaveLength(3);
expect(valArray3).toHaveLength(3);

expect(valArray1[0]).toBe(1);
expect(valArray1[1]).toBe(2);
expect(valArray1[2]).toBe(3);
expect(valArray1[3]).toBe(3);

done();
});
Expand Down

0 comments on commit a14cca4

Please sign in to comment.