fix: use gear model column for brew card grinder display

The grinder_model field was computed by splitting the concatenated
"make model" string on the first space, which broke for multi-word
brand names like "Weber Workshops". Fetch g_grinder.model directly
from the database instead.
This commit is contained in:
Jon Seager 2026-02-09 19:57:09 +00:00
parent da206c1938
commit 08c1ef05cf
No known key found for this signature in database
3 changed files with 10 additions and 4 deletions

View file

@ -97,6 +97,7 @@ pub struct BrewWithDetails {
pub roast_slug: String,
pub roaster_slug: String,
pub grinder_name: String,
pub grinder_model: String,
pub brewer_name: String,
pub filter_paper_name: Option<String>,
}

View file

@ -18,6 +18,7 @@ const BASE_SELECT: &str = r"
r.name as roast_name, r.slug as roast_slug,
rr.name as roaster_name, rr.slug as roaster_slug,
(g_grinder.make || ' ' || g_grinder.model) as grinder_name,
g_grinder.model as grinder_model,
(g_brewer.make || ' ' || g_brewer.model) as brewer_name,
(g_fp.make || ' ' || g_fp.model) as filter_paper_name
FROM brews br
@ -118,6 +119,7 @@ impl SqlBrewRepository {
roast_slug: record.roast_slug,
roaster_slug: record.roaster_slug,
grinder_name: record.grinder_name,
grinder_model: record.grinder_model,
brewer_name: record.brewer_name,
filter_paper_name: record.filter_paper_name,
}
@ -325,6 +327,7 @@ struct BrewWithDetailsRecord {
roaster_name: String,
roaster_slug: String,
grinder_name: String,
grinder_model: String,
brewer_name: String,
filter_paper_name: Option<String>,
}

View file

@ -102,10 +102,7 @@ impl BrewView {
roaster_slug: brew.roaster_slug,
coffee_weight: format_weight(brew.brew.coffee_weight),
grinder_id: brew.brew.grinder_id.into_inner(),
grinder_model: brew
.grinder_name
.split_once(' ')
.map_or_else(|| brew.grinder_name.clone(), |(_, model)| model.to_string()),
grinder_model: brew.grinder_model,
grinder_name: brew.grinder_name,
grind_setting: format!("{:.1}", brew.brew.grind_setting),
brewer_id: brew.brew.brewer_id.into_inner(),
@ -225,6 +222,9 @@ pub struct BrewDetailView {
// Map
pub map_countries: String,
pub map_max: u32,
// Slugs (for breadcrumbs)
pub roaster_slug: String,
pub roast_slug: String,
// Dates
pub created_date: String,
pub created_time: String,
@ -256,6 +256,8 @@ impl BrewDetailView {
id: brew.brew.id.to_string(),
roast_name: brew.roast_name,
roaster_name: brew.roaster_name,
roaster_slug: roaster.slug.clone(),
roast_slug: roast.slug.clone(),
origin: coffee.origin,
origin_flag: coffee.origin_flag,
region: coffee.region,