Fix: Geburtstag aller Hunde + Kotbeutel-Stationen in Stats (SW by-v962)
- worlds.js: bdayDog = _dogs.find(...) — Geburtstag gilt für alle Hunde, nicht nur den aktiven - Banner, KI-Call, "Was hat sich X gewünscht?" nutzen bdayDog.name - stats.py: kotbeutel-Count aus user_map_pois WHERE type='kotbeutel' - landing: Stats-Band 5. Kachel "Kotbeutel-Stationen"
This commit is contained in:
parent
ebff9d820d
commit
07db68aea2
6 changed files with 28 additions and 18 deletions
|
|
@ -1342,8 +1342,9 @@ window.Worlds = (() => {
|
|||
if (mmdd === `${mt}-${dt}`) return 'tomorrow';
|
||||
return null;
|
||||
}
|
||||
const bday = _birthdayState(dog.geburtstag);
|
||||
const bdayYear = dog.geburtstag ? new Date().getFullYear() - parseInt(dog.geburtstag.slice(0, 4)) : null;
|
||||
const bdayDog = _dogs.find(d => _birthdayState(d.geburtstag)) || null;
|
||||
const bday = bdayDog ? _birthdayState(bdayDog.geburtstag) : null;
|
||||
const bdayYear = bdayDog?.geburtstag ? new Date().getFullYear() - parseInt(bdayDog.geburtstag.slice(0, 4)) : null;
|
||||
|
||||
const [streakRes, diaryRes] = await Promise.allSettled([
|
||||
_cachedGet(`streak_${dog.id}`, `/streak/${dog.id}`),
|
||||
|
|
@ -1428,8 +1429,8 @@ window.Worlds = (() => {
|
|||
</div>
|
||||
<div style="font-weight:800;font-size:var(--text-sm);color:#fff;letter-spacing:0.01em">
|
||||
${bday === 'today'
|
||||
? `Alles Gute zum ${bdayYear}. Geburtstag, ${_esc(dog.name)}!`
|
||||
: `Morgen hat ${_esc(dog.name)} Geburtstag!`}
|
||||
? `Alles Gute zum ${bdayYear}. Geburtstag, ${_esc(bdayDog.name)}!`
|
||||
: `Morgen hat ${_esc(bdayDog.name)} Geburtstag!`}
|
||||
</div>
|
||||
<div style="display:flex;gap:8px;align-items:center">
|
||||
<svg class="ph-icon bday-fw3" style="width:1rem;height:1rem;color:#e8c96e"><use href="/icons/phosphor.svg#sparkle"></use></svg>
|
||||
|
|
@ -1443,7 +1444,7 @@ window.Worlds = (() => {
|
|||
</div>` : ''}
|
||||
<div style="display:flex;align-items:center;gap:4px;font-size:10px;color:rgba(196,132,58,0.9);font-weight:700;margin-top:2px">
|
||||
<svg class="ph-icon" style="width:11px;height:11px"><use href="/icons/phosphor.svg#magic-wand"></use></svg>
|
||||
${bday === 'today' ? 'Was hat sich Ban Yaro gewünscht?' : 'KI-Überraschungsideen'}
|
||||
${bday === 'today' ? `Was hat sich ${_esc(bdayDog.name)} gewünscht?` : 'KI-Überraschungsideen'}
|
||||
</div>
|
||||
</div>
|
||||
${bday === 'today' && new Date().getHours() >= 18 ? `
|
||||
|
|
@ -1563,10 +1564,10 @@ window.Worlds = (() => {
|
|||
|
||||
try {
|
||||
const res = await API.post('/ki/geburtstag', {
|
||||
dog_id: dog.id,
|
||||
name: dog.name,
|
||||
rasse: dog.rasse || null,
|
||||
alter: dog.alter_jahre ? Math.round(dog.alter_jahre) : null,
|
||||
dog_id: bdayDog.id,
|
||||
name: bdayDog.name,
|
||||
rasse: bdayDog.rasse || null,
|
||||
alter: bdayDog.alter_jahre ? Math.round(bdayDog.alter_jahre) : null,
|
||||
mode: bdayMode,
|
||||
});
|
||||
const body = ov.querySelector('#bday-ki-body');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue