diff --git a/src/charts/jBars.js b/src/charts/jBars.js index 1fd1509..055c867 100644 --- a/src/charts/jBars.js +++ b/src/charts/jBars.js @@ -159,12 +159,12 @@ export async function jBars (from, to, res) { } } - // noData should be set only if no samples in interval and earlier. + // noData should be set only if no bars are in the requested period and earlier. // In our case, we are guaranteed to have contiguous samples. - // So we only return zero bars if: - // 1. interval is before first data available. - // 2. interval is after last data available. - // Returning no samples based on length works assuming that TV never asks for case 2. + // So we only return no bars (bars.length==0) if: + // 1. period is entirely before first data available. + // 2. period is entirely after last data available. + // Returning noData based on bars.length works perfectly assuming that TV never asks for case 2. // This is probably not a safe assumption. The alternative would be to search // backward to find beginning of history. How far to search?