mirror of
https://github.com/svm0n/datadeck.git
synced 2026-07-22 08:31:46 +00:00
fix(templates): scaffolds now match what the views actually read; add Create chart file
- Travel: headers were Country/Notes but analyzeTravel reads literal
lowercase keys — the scaffolded file opened in Travel view with every
row silently dropped. Now exactly travel.py's flat-CSV columns,
including city/visa_status/resolved (tourist detection + residency
exemptions read them).
- Tasks: added Type + Project (the columns the view's sections/grouping
are designed around — without Project, grouping fell back to Priority
headings), and Status is no longer typed Checkbox: the Add-form toggle
wrote 1/0 that the view's DONE_WORDS vocabulary didn't recognise.
DONE_WORDS also gains "1" so files from the old template still read.
- Habits: habitColumns pinned (auto-detect needs a row of values, so a
fresh file had zero toggles) and statusColumn explicitly disabled
("Read" is a status alias that polluted Stats/Library).
- New: Create chart file — a Date/Value/Notes measurement log pinned to
the Chart view with Value on Y and the fit line on.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
39a89c6be0
commit
7846130637
3 changed files with 57 additions and 19 deletions
28
main.js
28
main.js
File diff suppressed because one or more lines are too long
43
main.ts
43
main.ts
|
|
@ -950,12 +950,18 @@ const FILE_TEMPLATES: FileTemplate[] = [
|
|||
id: "tasks",
|
||||
command: "Create tasks file",
|
||||
defaultName: "Tasks",
|
||||
headers: ["Title", "Priority", "Notes", "Due", "Status"],
|
||||
// Type + Project are the two columns the tasks view is actually designed
|
||||
// around (per-type sections, grouped by project) — without Project the
|
||||
// group falls back to whatever pickFallbackGroupCol guesses (Priority),
|
||||
// which read as nonsense headings. Status stays a *word* column
|
||||
// (done/…), NOT a Checkbox: the view's done-toggle writes DONE_WORDS
|
||||
// vocabulary, and typing it Checkbox made the Add-form toggle write
|
||||
// "1"/"0" that the view then couldn't agree with.
|
||||
headers: ["Title", "Type", "Project", "Priority", "Due", "Status", "Notes"],
|
||||
mode: "tasks",
|
||||
configOverrides: {
|
||||
categoricalColumns: ["Priority"],
|
||||
categoricalColumns: ["Type", "Priority"],
|
||||
dateColumns: ["Due"],
|
||||
habitColumns: ["Status"],
|
||||
statusColumn: "Status",
|
||||
notesColumn: "Notes"
|
||||
}
|
||||
|
|
@ -964,7 +970,11 @@ const FILE_TEMPLATES: FileTemplate[] = [
|
|||
id: "travel",
|
||||
command: "Create travel file",
|
||||
defaultName: "Travel",
|
||||
headers: ["Country", "date_entered", "date_left", "source", "Notes"],
|
||||
// Exactly travel.py's flat-CSV columns, lowercase — analyzeTravel reads
|
||||
// literal keys (r.country, r.notes, …), so the old capitalized
|
||||
// Country/Notes headers passed detection (isTravelFile lowercases) but
|
||||
// produced a travel view where every row was silently dropped.
|
||||
headers: ["date_entered", "date_left", "country", "city", "visa_status", "notes", "source", "resolved"],
|
||||
mode: "travel",
|
||||
},
|
||||
{
|
||||
|
|
@ -973,6 +983,31 @@ const FILE_TEMPLATES: FileTemplate[] = [
|
|||
defaultName: "Habits",
|
||||
headers: ["Date", "Exercise", "Meditate", "Read", "Notes"],
|
||||
mode: "dashboard",
|
||||
configOverrides: {
|
||||
// Pinned — auto-detection needs at least one row of values, so a fresh
|
||||
// file otherwise renders a dashboard with zero habit toggles.
|
||||
habitColumns: ["Exercise", "Meditate", "Read"],
|
||||
notesColumn: "Notes",
|
||||
// "Read" is a status-column alias; explicitly no status column here so
|
||||
// Stats/Library don't misread a habit as the file's status.
|
||||
statusColumn: "",
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "chart",
|
||||
command: "Create chart file",
|
||||
defaultName: "Measurements",
|
||||
// A dated measurement log — the most common personal chart shape
|
||||
// (weight, km, hours…). Opens as a table until two rows exist
|
||||
// (hasChartColumns needs data to plot), then lands in Chart with a
|
||||
// date X-axis, Value on Y, and the fit line on.
|
||||
headers: ["Date", "Value", "Notes"],
|
||||
mode: "chart",
|
||||
configOverrides: {
|
||||
chartYCol: "Value",
|
||||
chartFit: "linear",
|
||||
notesColumn: "Notes",
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,10 @@ const TASK_WORDS = ["task", "todo", "to-do", "action", ""];
|
|||
const STRUCTURED_WORDS = ["task", "todo", "to-do", "action", "note", "idea", "reference", "ref"];
|
||||
|
||||
// Status words that mean "this is finished" → struck through, sorted last.
|
||||
const DONE_WORDS = ["done", "complete", "completed", "finished", "closed", "resolved", "yes", "x", "✓", "true"];
|
||||
// "1" included for parity with isTruthyVal (1/true/yes) — a Status column
|
||||
// typed Checkbox writes "1"/"0", and files scaffolded by the old tasks
|
||||
// template did exactly that.
|
||||
const DONE_WORDS = ["done", "complete", "completed", "finished", "closed", "resolved", "yes", "x", "✓", "true", "1"];
|
||||
|
||||
const PRIORITY_ORDER: Record<string, number> = { high: 0, med: 1, medium: 1, normal: 1, low: 2 };
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue