From 0a50122add1a98e4ed30cb2564b7e73abfbd8b9a Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Thu, 17 Sep 2026 02:09:28 -0400 Subject: [PATCH] Let a clone proceed on a date shift with no dimension override The panel required at least one override for both recode and clone. For recode that is right -- rewriting rows as themselves does nothing. For clone it is not: copying prior year forward changes the dates and, through dim_period, the season and month dimensions, which is the entire point of cloning from a reference segment. The server-side requirement was dropped when from_logid went in; this one was missed, so the operation was blocked in the UI with "Enter at least one override value". Clone now only has to be doing something -- an override, a shift, or a factor other than 1 -- and says so when it is doing none of the three. Co-Authored-By: Claude Opus 5 (1M context) --- ui/src/views/Forecast.jsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ui/src/views/Forecast.jsx b/ui/src/views/Forecast.jsx index cd30251..f1a4635 100644 --- a/ui/src/views/Forecast.jsx +++ b/ui/src/views/Forecast.jsx @@ -1058,10 +1058,24 @@ export default function Forecast({ sources = [], sourceId, versions = [], versio .some(k => body[k] !== undefined) if (!has) { flash('Enter a target or increment', 'error'); return } } - if ((op === 'recode' || op === 'clone') && !Object.keys(body.set || {}).length) { - flash(op === 'recode' ? 'Enter at least one new dimension value' : 'Enter at least one override value', 'error') + // Recode with nothing set would rewrite rows as themselves. Clone would not: + // copying a segment forward in time changes the dates and the period + // dimensions, which is the whole point of cloning from prior year, so it needs + // no dimension override at all. It only needs to be doing *something* -- + // an override, a shift, or a factor. + if (op === 'recode' && !Object.keys(body.set || {}).length) { + flash('Enter at least one new dimension value', 'error') return } + if (op === 'clone') { + const shifts = body.date_offset && body.date_offset !== '0 days' + const scales = body.scale != null && body.scale !== 1 + const changes = Object.keys(body.set || {}).length > 0 + if (!shifts && !scales && !changes) { + flash('A clone with no override, no date shift and a factor of 1 would just duplicate the rows', 'error') + return + } + } try { const res = await fetch(`/api/versions/${versionId}/${op}`, {