From f5c2c8c3d457e9fb475f7a2288f73a3997a9b0d9 Mon Sep 17 00:00:00 2001 From: 7400 <7400> Date: Sat, 2 Mar 2024 11:04:24 -0800 Subject: [PATCH] Clarify caveat comment --- src/charts/jBars.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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?