v0.1.30 - Throughput overview today-only mix cards; mix formula save 500 fix

Throughput Overview: Horse Mix and Grain Mix are now the first two cards and
show TODAY's output only. Removed the 7d/4w/6w/12w range selector; the cards
are fixed to Horse mix today, Grain mix today, Today, This week, 4-week average.

Mix Editor formula save: fix HTTP 500 on PUT /editor/mixes/{id}/formula. The
audit-diff path read the resolved formula by attribute, but the resolver returns
dicts -> AttributeError. Read by key and expire stale ORM state so the response
reflects the just-saved rows. Adds regression tests for both save branches.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-18 14:04:49 +12:00
co-authored by Claude Opus 4.8
parent e7a7b11589
commit 1062c038e8
8 changed files with 133 additions and 90 deletions
+3 -7
View File
@@ -12,7 +12,6 @@
import ThroughputSuccessOverlay from '$lib/components/throughput/ThroughputSuccessOverlay.svelte';
import ThroughputSummary from '$lib/components/throughput/ThroughputSummary.svelte';
import {
MIX_RANGES,
addDays,
ausToday,
buildConfetti,
@@ -431,15 +430,13 @@
return norm.includes('phf') && norm.includes('horse');
}
let mixRangeKey = $state<(typeof MIX_RANGES)[number]['key']>('4w');
const mixRange = $derived(MIX_RANGES.find((r) => r.key === mixRangeKey) ?? MIX_RANGES[1]);
// Today's split only: Horse Mix (PHF Horsemix) vs Grain Mix (everyone else).
const mixTotals = $derived.by(() => {
const cutoff = toISODate(addDays(ausToday(), -(mixRange.days - 1)));
const todayStr = toISODate(ausToday());
let horse = 0;
let grain = 0;
for (const entry of statsEntries) {
if (entry.production_date < cutoff) continue;
if (entry.production_date !== todayStr) continue;
const kg = entry.calculated_kg || 0;
const client = entry.product_id != null ? productClientById.get(entry.product_id) ?? null : null;
if (isHorseMixClient(client)) horse += kg;
@@ -531,7 +528,6 @@
{weekRangeLabel}
{heroStats}
{mixTotals}
bind:mixRangeKey
{formatDate}
{formatNumber}
/>