Compare commits
15 Commits
worktree-c
...
2eff97200a
| Author | SHA1 | Date | |
|---|---|---|---|
| 2eff97200a | |||
|
|
6c0f109499 | ||
|
|
02a048c455 | ||
| 5ec27cb3bf | |||
| d464fe9edc | |||
| dfac0f67ad | |||
| ec403f4324 | |||
| 12a4e197f3 | |||
| 6de7b02aba | |||
| 90ed399cd9 | |||
| 92fa8df574 | |||
| ed2121e4f8 | |||
| b7141d787b | |||
| 21c870189f | |||
| b0eef226ce |
1
.claude/worktrees/citti-arkiver-tur
Submodule
1
.claude/worktrees/citti-arkiver-tur
Submodule
Submodule .claude/worktrees/citti-arkiver-tur added at b2390c4495
12
app.py
12
app.py
@@ -423,12 +423,9 @@ def match_offers_ai():
|
||||
|
||||
# Skip the (daily) match call when the offer set hasn't changed since the
|
||||
# last successful match — the avis only turns over weekly, so this avoids a
|
||||
# pointless Claude call most days. The leading version forces a re-match
|
||||
# whenever the matching logic/prompt changes (bump it when editing them).
|
||||
MATCH_VERSION = "v2-standard-not-premium"
|
||||
# pointless Claude call most days.
|
||||
sig = hashlib.md5(
|
||||
(MATCH_VERSION + "\n" + "\n".join(
|
||||
sorted(o['id'] + '|' + (o.get('heading') or '') for o in offers)))
|
||||
"\n".join(sorted(o['id'] + '|' + (o.get('heading') or '') for o in offers))
|
||||
.encode('utf-8')).hexdigest()
|
||||
with get_db() as c:
|
||||
if _meta_get(c, 'last_match_sig') == sig and \
|
||||
@@ -455,10 +452,7 @@ def match_offers_ai():
|
||||
"findes. Vær striks: match kun når det tydeligt er samme varetype "
|
||||
"(fx entrecôte↔entrecôte-tilbud). Match IKKE blot på mærke eller løst "
|
||||
"beslægtede varer (fx 'Nutella 1kg glas' må IKKE matche 'Nutella "
|
||||
"julekalender'). Når varen er generisk (fx 'Entrecote ½ kg'), vælg den "
|
||||
"ALMINDELIGE/standard variant til den LAVESTE pris — undgå premium-/"
|
||||
"luksus-varianter (Wagyu, Dry-Aged, US-Beef, øko-premium) medmindre varen "
|
||||
"selv nævner det, da de giver et urealistisk højt estimat. Returnér KUN et "
|
||||
"julekalender'). Vælg det billigste ved flere ens. Returnér KUN et "
|
||||
'JSON-array [{"item_key":"...","offer_id":"..."}] med de sikre match, '
|
||||
"intet andet.")
|
||||
client = anthropic.Anthropic(max_retries=CLAUDE_MAX_RETRIES)
|
||||
|
||||
@@ -71,7 +71,6 @@
|
||||
.item-name { padding: 0.7rem 0.5rem; font-size: 14px; }
|
||||
.item-name .note { font-size: 11px; color: var(--muted); display: block; margin-top: 1px; }
|
||||
.item-name .de { font-size: 10px; color: #b0aba3; display: block; margin-top: 0; font-style: italic; }
|
||||
.item-name .row-est-m { display: none; font-size: 10px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
|
||||
.badge { display: inline-block; font-size: 9px; padding: 1px 5px; border-radius: 3px; margin-left: 5px; vertical-align: middle; font-weight: 500; }
|
||||
.badge-card { background: var(--blue-light); color: var(--blue); }
|
||||
.badge-kasse { background: var(--amber-light); color: var(--amber); }
|
||||
@@ -170,7 +169,6 @@
|
||||
.header-actions { flex-direction: row; align-items: center; }
|
||||
.item-row { grid-template-columns: 28px 1fr 64px 78px; }
|
||||
.item-est { display: none; }
|
||||
.item-name .row-est-m { display: block; }
|
||||
.col-headers { grid-template-columns: 28px 1fr 64px 78px; }
|
||||
.col-h:nth-child(4) { display: none; }
|
||||
.extra-item-row { grid-template-columns: 28px 1fr auto auto; }
|
||||
@@ -268,7 +266,6 @@
|
||||
{% if item.get('note') %}<span class="note">{{ item.note }}</span>{% endif %}
|
||||
{% set d = deals.get(item.key) %}
|
||||
{% if d %}<a class="deal" href="/tilbud" title="{{ d.heading }} ({{ d.catalog }})">🏷 på tilbud: {{ "{:.2f}".format(d.price_eur).replace(".",",") }} € ≈ {{ "{:.0f}".format(d.price_eur * eur_dkk) }} kr. · {{ d.heading_da or d.heading }}</a>{% endif %}
|
||||
<span class="row-est-m"></span>
|
||||
</div>
|
||||
<div class="item-qty">
|
||||
<input type="text" value="{{ s.get('qty') or item.qty }}" placeholder="{{ item.qty }}"
|
||||
@@ -712,34 +709,16 @@ function recalcAll() {
|
||||
// picked offers), live from each row's data-est. Reflects add/remove/pick.
|
||||
let est = 0;
|
||||
document.querySelectorAll('[data-est]').forEach(r => {
|
||||
const qi = r.querySelector('.item-qty input');
|
||||
const offer = offerLineDkk(r); // real offer price if matched
|
||||
let line;
|
||||
if (offer != null) {
|
||||
line = offer;
|
||||
} else {
|
||||
line = parseFloat(r.dataset.est) || 0;
|
||||
if (qi) { // scale estimate with quantity
|
||||
if (offer != null) { est += offer; return; }
|
||||
let base = parseFloat(r.dataset.est) || 0;
|
||||
const qi = r.querySelector('.item-qty input'); // scale estimate with quantity
|
||||
if (qi) {
|
||||
const cur = qtyNum(qi.value.trim() || qi.placeholder);
|
||||
const def = qtyNum(qi.placeholder);
|
||||
if (cur != null && def != null && def > 0) line = line * (cur / def);
|
||||
}
|
||||
}
|
||||
est += line;
|
||||
|
||||
// Per-row display: computed estimate + ½kg price (for weight items). The
|
||||
// est column is hidden on phones, so also fill the mobile sub-line.
|
||||
if (qi) {
|
||||
const col = r.querySelector('.item-est');
|
||||
if (col) col.textContent = line > 0 ? Math.round(line).toLocaleString('da-DK') : '—';
|
||||
const sub = r.querySelector('.row-est-m');
|
||||
if (sub) {
|
||||
const kg = qtyToKg(qi.value.trim() || qi.placeholder);
|
||||
const per500 = (kg > 0 && line > 0) ? Math.round(line / kg * 0.5) : null;
|
||||
sub.textContent = (line > 0 ? 'est ' + Math.round(line).toLocaleString('da-DK') + ' kr' : '')
|
||||
+ (per500 ? ' · ½kg ' + per500 + ' kr' : '');
|
||||
}
|
||||
if (cur != null && def != null && def > 0) base = base * (cur / def);
|
||||
}
|
||||
est += base;
|
||||
});
|
||||
document.getElementById('stat-est').textContent = est > 0 ? Math.round(est).toLocaleString('da-DK') : '—';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user