neiam
/fieri-forever
the flavortown lunch engine
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
Area rows: added_by_name, not a second added_by
73e11cd · Gabriel Morell · 2026-10-28 22:30
Message
{commit_body(@commit)}
Files changed
modified
src/handlers/areas.rs
+4
−2
@@ -141,7 +141,9 @@ pub(crate) struct RestaurantRow {
| 141 | 141 | /// Your "to try" here has been tried; time to rank it properly. |
| 142 | 142 | tried: bool, |
| 143 | 143 | cuisines: Vec<String>, |
| 144 | − added_by: Option<String>, | |
| 144 | + /// Who added it, by name. (The restaurant's own `added_by` is their id; | |
| 145 | + /// both flatten into one JSON object, so the names must differ.) | |
| 146 | + added_by_name: Option<String>, | |
| 145 | 147 | visits: usize, |
| 146 | 148 | last_visit: Option<NaiveDate>, |
| 147 | 149 | /// Open at noon today, by its OSM hours, if it has any. |
@@ -212,7 +214,7 @@ pub(crate) async fn area_view(db: &DatabaseConnection, id: Uuid, user_id: Uuid)
| 212 | 214 | my_since: my_ranks.get(&r.id).and_then(|k| k.since()), |
| 213 | 215 | tried: tried.contains(&(user_id, r.id)), |
| 214 | 216 | cuisines: r.cuisine_tags(), |
| 215 | − added_by: r.added_by.and_then(|u| names.get(&u)).map(|n| (*n).to_owned()), | |
| 217 | + added_by_name: r.added_by.and_then(|u| names.get(&u)).map(|n| (*n).to_owned()), | |
| 216 | 218 | visits: visits.map_or(0, Vec::len), |
| 217 | 219 | last_visit: visits.and_then(|v| v.iter().max().copied()), |
| 218 | 220 | lunch_today: r.opening_hours.as_deref().map(|h| crate::hours::state_at(h, noon)), |
modified
templates/areas/show.html
+2
−2
@@ -66,9 +66,9 @@
| 66 | 66 | <td> |
| 67 | 67 | <a href="/restaurants/{{ r.id }}" class="font-semibold link link-hover">{{ r.name }}</a> |
| 68 | 68 | {% if r.archived %}<span class="badge badge-ghost badge-sm">archived</span>{% endif %} |
| 69 | − {% if r.cuisines or r.added_by %} | |
| 69 | + {% if r.cuisines or r.added_by_name %} | |
| 70 | 70 | <span class="block text-xs opacity-70"> |
| 71 | − {{ cuisine_links(r.cuisines, area.id) }}{% if r.cuisines and r.added_by %} · {% endif %}{% if r.added_by %}added by {{ r.added_by }}{% endif %} | |
| 71 | + {{ cuisine_links(r.cuisines, area.id) }}{% if r.cuisines and r.added_by_name %} · {% endif %}{% if r.added_by_name %}added by {{ r.added_by_name }}{% endif %} | |
| 72 | 72 | </span> |
| 73 | 73 | {% endif %} |
| 74 | 74 | </td> |
Parents: c41e92d