{# A drawn plan. Re-submitting #plan-form draws again, so "re-roll" is just
a second submit button for that form. #}
{% from "_macros.html" import rank_badge %}
<div id="plan-result" class="space-y-4">
{% if empty_group %}
<div class="alert alert-warning text-sm"><i class="fas fa-users-slash"></i> Pick at least one person who's going.</div>
{% elif restaurant_count == 0 %}
<div class="alert text-sm">
<span>No restaurants in {{ area.name }} yet. <a class="link" href="/areas/{{ area.id }}/restaurants/new">Add some</a> first.</span>
</div>
{% else %}
<div class="flex items-center justify-between gap-3 flex-wrap">
<p class="text-sm opacity-70">For {{ going | map(attribute="username") | join(", ") }}</p>
<button class="btn btn-sm" type="submit" form="plan-form"><i class="fas fa-rotate"></i> Re-roll</button>
</div>
{% for meal in plan %}
<div class="card bg-base-200 border border-base-300 p-4 space-y-3">
{% if meal.pick %}
<div class="flex items-start justify-between gap-3 flex-wrap">
<div>
<p class="font-mono text-xs opacity-70">{{ meal.on }}</p>
<a href="/restaurants/{{ meal.pick.id }}" class="text-xl font-bold link link-hover">{{ meal.pick.name }}</a>
{% if meal.restaurant.cuisine %}<span class="block text-sm opacity-70">{{ meal.restaurant.cuisine }}</span>{% endif %}
<p class="text-xs opacity-70 mt-1">
{{ (meal.pick.probability * 100) | round | int }}% odds
{%- if meal.pick.last_visit_days is not none %} · last went {{ meal.pick.last_visit_days }} day{{ "" if meal.pick.last_visit_days == 1 else "s" }} ago{% else %} · never logged{% endif %}
{%- if meal.pick.fans %} · ♥ {{ meal.pick.fans | join(", ") }}{% endif %}
</p>
</div>
<form method="post" action="/lunches">
<input type="hidden" name="restaurant_id" value="{{ meal.pick.id }}"/>
<input type="hidden" name="went_on" value="{{ meal.on }}"/>
{% for p in going %}<input type="hidden" name="attendee" value="{{ p.id }}"/>{% endfor %}
<button class="btn btn-success btn-sm" type="submit"><i class="fas fa-check"></i> We went here</button>
</form>
</div>
{% else %}
<p class="font-mono text-xs opacity-70">{{ meal.on }}</p>
<p class="text-sm">Nowhere left: everything in {{ area.name }} is vetoed by someone going or closed at {{ meal_time }}.</p>
{% endif %}
{% if plan | length == 1 %}
<details class="text-sm">
<summary class="cursor-pointer opacity-70">The rest of the field</summary>
<table class="table table-xs mt-2">
<thead><tr><th>Restaurant</th><th class="text-right">Odds</th><th class="text-right">Liked</th><th class="text-right">Freshness</th><th></th></tr></thead>
<tbody>
{% for s in meal.field %}
<tr class="{{ 'opacity-50' if s.vetoed_by or s.closed else '' }}">
<td><a class="link link-hover" href="/restaurants/{{ s.id }}">{{ s.name }}</a></td>
<td class="text-right font-mono">{% if s.vetoed_by or s.closed %}—{% else %}{{ (s.probability * 100) | round(1) }}%{% endif %}</td>
<td class="text-right font-mono">{{ s.preference | round(1) }}</td>
<td class="text-right font-mono">{{ (s.recency * 100) | round | int }}%</td>
<td class="text-xs">
{%- if s.vetoed_by %}<span class="text-error">vetoed by {{ s.vetoed_by | join(", ") }}</span>{% endif %}
{%- if s.closed %}<span class="text-error">{% if s.vetoed_by %}; {% endif %}closed at {{ meal_time }}</span>{% endif -%}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<p class="text-xs opacity-60 mt-2">
Liked: the group's average (obsessed 6, always 4, positive 2, neutral or unranked 1).
Freshness: drops with recent visits and recovers with a 10-day half-life.
Anyone going who ranked a place "never" vetoes it, and places whose OSM hours
say they're closed at {{ meal_time }} are left out.
</p>
</details>
{% endif %}
</div>
{% endfor %}
{% endif %}
</div>
neiam
/fieri-forever
the flavortown lunch engine
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
4.2 KiB · text
History
6dd7389