Skip to content

Commit

Permalink
Bug fix to remove chance of infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescrowley committed Sep 20, 2024
1 parent 09592f1 commit 3b83bdb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib/utils/Statistic/interpolate-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { interpolate } from 'd3-interpolate';
// function to interpolate data from 30 to 5 minute interval
export default function (dataArray, original, target) {
const ratio = original / target;
if (ratio === Infinity)
// prevent infinite inner loop caused by 0 target interval
return dataArray;
const interpolatedData = [];
for (let i = 0; i < dataArray.length; i++) {
if (i === dataArray.length - 1) {
Expand Down

0 comments on commit 3b83bdb

Please sign in to comment.