From 1b7d9efaac59a5bfeaae947ddcc2148491bebeb5 Mon Sep 17 00:00:00 2001 From: dm5wk Date: Mon, 27 May 2024 21:38:59 +0200 Subject: [PATCH] fix frequency range comparison --- band-plan.html | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/band-plan.html b/band-plan.html index 6e24264..44faa72 100644 --- a/band-plan.html +++ b/band-plan.html @@ -174,7 +174,6 @@ div>label { fill_comments(header); // then fill tdata - let already_added = false; extensions.forEach((ext) => { if ((typeof ext.header === "undefined") || (ext.header == false)) { add_column(row, base, header["base"]); @@ -184,8 +183,7 @@ div>label { // at single frequency if (isInRange(base.frequency, ext_start, ext_end)) { add_column(row, ext, header["extension"]); - } else { - return; + tdata.push(row); } } else { // frequeny range @@ -193,9 +191,10 @@ div>label { if (isInRange(base_start, ext_start, ext_end) && isInRange(base_end, ext_start, ext_end)) { // base range is inside of ext range or the same add_column(row, ext, header["extension"]); + tdata.push(row); } else { // base range is split by ext range - if (isInRange(ext_start, base_start, base_end)) { + if ((base_end > ext_start) && isInRange(ext_start, base_start, base_end)) { // base range starts below ext range let r = structuredClone(row); let start = ext_start; @@ -203,8 +202,7 @@ div>label { r["frequency"] = start + "-" + end; add_column(r, ext, header["extension"]); tdata.push(r); - already_added = true; - } else if (isInRange(ext_end, base_start, base_end)) { + } else if ((ext_end > base_start) && isInRange(ext_end, base_start, base_end)) { // ext range starts below base range let r = structuredClone(row); let start = base_start; @@ -212,16 +210,11 @@ div>label { r["frequency"] = start + "-" + end; add_column(r, ext, header["extension"]); tdata.push(r); - already_added = true; } } } } }); - if (!already_added) { - tdata.push(row); - } - already_added = false; } });