Move After-the-Roast onto actual roasts; add Artisan-importable updated .alog download
Test and deploy / test-and-deploy (push) Successful in 56s
Test and deploy / test-and-deploy (push) Successful in 56s
One system: post-roast observations (weights, colour, DTR, cup notes, 'one change next batch', disproof) now live on the uploaded roast (actual_roasts.after, migration 011), edited on the roast detail view with weights/DTR prefilled from the .alog itself. The planner's screen section is removed (the print worksheet keeps its hand-fill copy), and the lot 'last refine' suggestion reads the note from both the new home and legacy plans, newest wins. Every roast now downloads two ways: the untouched original .alog, and an updated supplemental copy with the app's data written back as valid Artisan fields (weight, beans, roastingnotes incl. the LLM review, cuppingnotes incl. linked cupping score/flavors) — serialized as a Python literal so Artisan's ast.literal_eval re-imports it. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5
parent
9b6ea9880e
commit
4a3d192c2c
@@ -359,6 +359,9 @@ async function openDetail(id, { keepScroll = false } = {}) {
|
||||
}
|
||||
document.getElementById("detail-download").href =
|
||||
`/api/roasts/${encodeURIComponent(id)}/download`;
|
||||
document.getElementById("detail-download-updated").href =
|
||||
`/api/roasts/${encodeURIComponent(id)}/download?variant=updated`;
|
||||
renderAfterForm(detail);
|
||||
renderGraph(detail);
|
||||
renderStats(detail);
|
||||
renderEvaluation(detail);
|
||||
@@ -366,6 +369,49 @@ async function openDetail(id, { keepScroll = false } = {}) {
|
||||
if (!keepScroll) card.scrollIntoView({ behavior: "smooth", block: "start" });
|
||||
}
|
||||
|
||||
// ---- after the roast (moved here from the plan worksheet) -------------------
|
||||
|
||||
const AFTER_FIELDS = [
|
||||
"greenIn", "out", "weightLossPct", "vsTarget", "actualDtrPct", "colour",
|
||||
"restedDays", "brewRatio", "method", "cupNotes", "oneChange", "disproof",
|
||||
];
|
||||
|
||||
function renderAfterForm(detail) {
|
||||
const form = document.getElementById("after-form");
|
||||
const after = detail.after ?? {};
|
||||
// Prefill measurable values straight from the .alog so the user only types what the
|
||||
// machine couldn't know (colour, cup notes, the one change).
|
||||
const auto = {
|
||||
greenIn: detail.parsed?.roast?.weightInG || "",
|
||||
out: detail.parsed?.roast?.weightOutG || "",
|
||||
weightLossPct: detail.parsed?.roast?.weightLossPct ?? "",
|
||||
actualDtrPct: detail.parsed?.derived?.dtrPct ?? "",
|
||||
};
|
||||
for (const field of AFTER_FIELDS)
|
||||
form[field].value = after[field] ?? (auto[field] === 0 ? "" : (auto[field] ?? ""));
|
||||
}
|
||||
|
||||
document.getElementById("after-form").addEventListener("submit", async (event) => {
|
||||
event.preventDefault();
|
||||
if (!openId) return;
|
||||
const form = event.target;
|
||||
const after = {};
|
||||
for (const field of AFTER_FIELDS) after[field] = form[field].value;
|
||||
const button = document.getElementById("after-save");
|
||||
button.disabled = true;
|
||||
try {
|
||||
await api(`/api/roasts/${openId}`, {
|
||||
method: "PUT",
|
||||
body: JSON.stringify({ after }),
|
||||
});
|
||||
showToast("After-roast saved — included in the updated .alog.");
|
||||
} catch (error) {
|
||||
showToast(error.message, "fail");
|
||||
} finally {
|
||||
button.disabled = false;
|
||||
}
|
||||
});
|
||||
|
||||
function closeDetail() {
|
||||
openId = null;
|
||||
history.replaceState(null, "", "/roasts");
|
||||
|
||||
Reference in New Issue
Block a user