Spaces:
Running
Running
adds lotties
Browse files- core/seed.py +3 -3
- static/app.js +3 -2
core/seed.py
CHANGED
|
@@ -167,14 +167,14 @@ def seed_if_empty(db):
|
|
| 167 |
)
|
| 168 |
}
|
| 169 |
|
|
|
|
|
|
|
|
|
|
| 170 |
to_insert = [a for a in _SEED_ANIMALS if a["name"] not in existing_names]
|
| 171 |
if not to_insert:
|
| 172 |
log.info("Animais fixos ja presentes — seed ignorado.")
|
| 173 |
return
|
| 174 |
|
| 175 |
-
# Copia fotos de static/seed-photos/ para DATA_DIR/photos/seed/
|
| 176 |
-
_copy_seed_photos()
|
| 177 |
-
|
| 178 |
log.info("Inserindo %d animais fixos de demonstracao...", len(to_insert))
|
| 179 |
now = datetime.utcnow()
|
| 180 |
|
|
|
|
| 167 |
)
|
| 168 |
}
|
| 169 |
|
| 170 |
+
# Sempre copia fotos (idempotente) — garante que estao disponiveis apos restart
|
| 171 |
+
_copy_seed_photos()
|
| 172 |
+
|
| 173 |
to_insert = [a for a in _SEED_ANIMALS if a["name"] not in existing_names]
|
| 174 |
if not to_insert:
|
| 175 |
log.info("Animais fixos ja presentes — seed ignorado.")
|
| 176 |
return
|
| 177 |
|
|
|
|
|
|
|
|
|
|
| 178 |
log.info("Inserindo %d animais fixos de demonstracao...", len(to_insert))
|
| 179 |
now = datetime.utcnow()
|
| 180 |
|
static/app.js
CHANGED
|
@@ -117,9 +117,10 @@
|
|
| 117 |
const color = urgent ? '#E53935' : isDog ? '#388C59' : '#FB8C00';
|
| 118 |
const badge = a.count > 1
|
| 119 |
? `<span style="position:absolute;top:-5px;right:-5px;background:#fff;color:${color};border:1.5px solid ${color};border-radius:10px;min-width:16px;height:16px;font-size:9px;font-weight:700;display:flex;align-items:center;justify-content:center;padding:0 3px;">${a.count}</span>` : '';
|
|
|
|
| 120 |
const inner = a.photo_url
|
| 121 |
-
? `<img src="${a.photo_url}" style="width:38px;height:38px;border-radius:50%;object-fit:cover;" onerror="this.
|
| 122 |
-
:
|
| 123 |
return L.divIcon({
|
| 124 |
html: `<div style="position:relative;background:${color};width:42px;height:42px;border-radius:50%;display:flex;align-items:center;justify-content:center;box-shadow:0 3px 10px rgba(0,0,0,.25);border:2.5px solid ${color};">${inner}${badge}</div>`,
|
| 125 |
className:'', iconSize:[42,42], iconAnchor:[21,21], popupAnchor:[0,-26]
|
|
|
|
| 117 |
const color = urgent ? '#E53935' : isDog ? '#388C59' : '#FB8C00';
|
| 118 |
const badge = a.count > 1
|
| 119 |
? `<span style="position:absolute;top:-5px;right:-5px;background:#fff;color:${color};border:1.5px solid ${color};border-radius:10px;min-width:16px;height:16px;font-size:9px;font-weight:700;display:flex;align-items:center;justify-content:center;padding:0 3px;">${a.count}</span>` : '';
|
| 120 |
+
const fallbackSvg = svgIcon(isDog ? 'dog' : 'cat', 22, '#fff');
|
| 121 |
const inner = a.photo_url
|
| 122 |
+
? `<img src="${a.photo_url}" style="width:38px;height:38px;border-radius:50%;object-fit:cover;" onerror="this.replaceWith(document.createRange().createContextualFragment(${JSON.stringify(fallbackSvg)}))"/>`
|
| 123 |
+
: fallbackSvg;
|
| 124 |
return L.divIcon({
|
| 125 |
html: `<div style="position:relative;background:${color};width:42px;height:42px;border-radius:50%;display:flex;align-items:center;justify-content:center;box-shadow:0 3px 10px rgba(0,0,0,.25);border:2.5px solid ${color};">${inner}${badge}</div>`,
|
| 126 |
className:'', iconSize:[42,42], iconAnchor:[21,21], popupAnchor:[0,-26]
|