chore: update app initialization and example data

Update application initialization and example data.

- `App::new` now recomputes formulas on startup to ensure formula-derived
  values are available immediately.
- Updated `examples/demo.improv` to reflect changes in formula and category
  structure.

Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/gemma-4-26B-A4B-it-GGUF:UD-Q5_K_XL)
This commit is contained in:
Edward Langley
2026-04-09 14:24:39 -07:00
parent c701534053
commit 1817494db2
2 changed files with 16 additions and 11 deletions

View File

@ -14,26 +14,22 @@ Date_Month: column
format: ,.0
## Formulas
- Profit = Revenue - Cost [_Measure]
## Category: _Index
## Category: _Dim
- Profit = Revenue - Cost
## Category: _Measure
- Cost, Revenue, Profit
- Cost, Revenue
## Category: Customer
- Initech, |Oceanic Airlines|, |Acme Corp|, |Globex Inc|, |Umbrella Co|, |Wonka Industries|, |Stark Enterprises|, |Cyberdyne Systems|, |Soylent Ltd|
- |Stark Enterprises|, |Soylent Ltd|, |Wonka Industries|, |Cyberdyne Systems|, |Acme Corp|, |Oceanic Airlines|, |Umbrella Co|, |Globex Inc|, Initech
## Category: Date
- |2025-01-15|, |2025-02-28|, |2025-03-03|, |2025-03-21|, |2025-01-06|, |2025-02-18|, |2025-02-10|, |2025-01-27|, |2025-01-09|, |2025-01-31|, |2025-03-25|, |2025-01-30|, |2025-01-12|, |2025-01-19|, |2025-02-14|, |2025-03-10|, |2025-01-23|, |2025-03-18|, |2025-03-30|, |2025-02-06|, |2025-01-28|, |2025-01-17|, |2025-01-08|, |2025-03-12|, |2025-01-14|, |2025-02-15|, |2025-03-14|, |2025-02-24|, |2025-03-07|, |2025-03-05|, |2025-03-28|, |2025-01-20|, |2025-02-03|, |2025-02-20|, |2025-01-11|, |2025-01-22|, |2025-02-22|, |2025-02-25|, |2025-03-19|, |2025-02-05|
- |2025-01-23|, |2025-03-25|, |2025-01-11|, |2025-03-12|, |2025-01-06|, |2025-01-15|, |2025-03-30|, |2025-03-10|, |2025-03-05|, |2025-01-19|, |2025-03-28|, |2025-01-22|, |2025-01-30|, |2025-01-12|, |2025-02-15|, |2025-03-07|, |2025-01-31|, |2025-01-27|, |2025-01-28|, |2025-03-03|, |2025-03-19|, |2025-02-05|, |2025-02-22|, |2025-02-25|, |2025-03-18|, |2025-02-20|, |2025-02-24|, |2025-01-14|, |2025-03-21|, |2025-01-08|, |2025-02-03|, |2025-02-10|, |2025-03-14|, |2025-02-14|, |2025-02-06|, |2025-01-09|, |2025-01-17|, |2025-01-20|, |2025-02-18|, |2025-02-28|
## Category: Product
- Sprockets, Widgets, Gadgets
- Gadgets, Widgets, Sprockets
## Category: Region
- West, East, North, South
- North, East, South, West
## Category: Date_Month
- |2025-01|, |2025-02|, |2025-03|

View File

@ -199,7 +199,16 @@ pub struct App {
}
impl App {
pub fn new(model: Model, file_path: Option<PathBuf>) -> Self {
pub fn new(mut model: Model, file_path: Option<PathBuf>) -> Self {
// Recompute formula cache before building the initial layout so
// formula-derived values are available on the first frame.
let none_cats: Vec<String> = model
.active_view()
.categories_on(crate::view::Axis::None)
.into_iter()
.map(String::from)
.collect();
model.recompute_formulas(&none_cats);
let layout = {
let view = model.active_view();
GridLayout::with_frozen_records(&model, view, None)