Count adjustments as Forecast rather than their own banner
pf_bucket mirrored pf_segment for scale/recode/clone rows, so adjustments showed as '(adjustment)' -- a banner of their own, sitting outside the forecast they are adjustments to. Grouping by pf_bucket therefore split the forecast in two. An adjustment is always part of the forecast: exclude_iters keeps operations off the reference segments, so there is no adjustment that is not. It falls back to 'Forecast' now, and still yields to an explicit bucket on its own log entry. pf_segment keeps '(adjustment)', which is right there -- it answers which segment a row came from, and an adjustment came from none. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0049a391c0
commit
2689e95b2c
@ -154,7 +154,7 @@ SELECT
|
||||
,COALESCE(NULLIF(l.bucket, ''),
|
||||
CASE WHEN l.operation IN ('baseline','reference')
|
||||
THEN COALESCE(NULLIF(l.tag, ''), NULLIF(l.note, ''), '(unlabeled load)')
|
||||
ELSE '(adjustment)' END) AS pf_bucket
|
||||
ELSE 'Forecast' END) AS pf_bucket
|
||||
,CASE WHEN l.operation IN ('baseline','reference')
|
||||
THEN NULL
|
||||
ELSE COALESCE(NULLIF(l.tag, ''), NULLIF(l.note, '')) END AS pf_note
|
||||
|
||||
@ -319,12 +319,15 @@ module.exports = function(pool) {
|
||||
,CASE WHEN l.operation IN ('baseline','reference')
|
||||
THEN COALESCE(NULLIF(l.tag, ''), NULLIF(l.note, ''), '(unlabeled load)')
|
||||
ELSE '(adjustment)' END AS pf_segment
|
||||
-- what the segment counts towards, falling back to the segment
|
||||
-- itself so an unlabelled one still reads as something
|
||||
-- What the row counts towards. A load falls back to its own
|
||||
-- name until it is labelled; an adjustment falls back to
|
||||
-- 'Forecast', because that is what an adjustment is -- exclude_iters
|
||||
-- keeps operations off the reference segments, so there is no
|
||||
-- adjustment that is not part of the forecast.
|
||||
,COALESCE(NULLIF(l.bucket, ''),
|
||||
CASE WHEN l.operation IN ('baseline','reference')
|
||||
THEN COALESCE(NULLIF(l.tag, ''), NULLIF(l.note, ''), '(unlabeled load)')
|
||||
ELSE '(adjustment)' END) AS pf_bucket
|
||||
ELSE 'Forecast' END) AS pf_bucket
|
||||
,CASE WHEN l.operation IN ('baseline','reference')
|
||||
THEN NULL
|
||||
ELSE COALESCE(NULLIF(l.tag, ''), NULLIF(l.note, '')) END AS pf_note
|
||||
@ -643,7 +646,7 @@ module.exports = function(pool) {
|
||||
await client.query('COMMIT');
|
||||
committed = true;
|
||||
const opLabel = (req.body.tag || '').trim() || note || null;
|
||||
const rows = allRows.map(r => ({ ...r, pf_segment: '(adjustment)', pf_bucket: '(adjustment)', pf_note: opLabel, pf_op: 'scale' }));
|
||||
const rows = allRows.map(r => ({ ...r, pf_segment: '(adjustment)', pf_bucket: 'Forecast', pf_note: opLabel, pf_op: 'scale' }));
|
||||
res.json({
|
||||
rows,
|
||||
rows_affected: rows.length,
|
||||
@ -703,7 +706,7 @@ module.exports = function(pool) {
|
||||
await client.query('COMMIT');
|
||||
committed = true;
|
||||
const opLabel = (req.body.tag || '').trim() || note || null;
|
||||
const rows = allRows.map(r => ({ ...r, pf_segment: '(adjustment)', pf_bucket: '(adjustment)', pf_note: opLabel, pf_op: 'recode' }));
|
||||
const rows = allRows.map(r => ({ ...r, pf_segment: '(adjustment)', pf_bucket: 'Forecast', pf_note: opLabel, pf_op: 'recode' }));
|
||||
res.json({ rows, rows_affected: rows.length, slices_applied: units.length });
|
||||
} finally {
|
||||
if (!committed) try { await client.query('ROLLBACK'); } catch {}
|
||||
@ -760,7 +763,7 @@ module.exports = function(pool) {
|
||||
await client.query('COMMIT');
|
||||
committed = true;
|
||||
const opLabel = (req.body.tag || '').trim() || note || null;
|
||||
const rows = allRows.map(r => ({ ...r, pf_segment: '(adjustment)', pf_bucket: '(adjustment)', pf_note: opLabel, pf_op: 'clone' }));
|
||||
const rows = allRows.map(r => ({ ...r, pf_segment: '(adjustment)', pf_bucket: 'Forecast', pf_note: opLabel, pf_op: 'clone' }));
|
||||
res.json({ rows, rows_affected: rows.length, slices_applied: units.length });
|
||||
} finally {
|
||||
if (!committed) try { await client.query('ROLLBACK'); } catch {}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user