payday tests
This commit is contained in:
@@ -17,13 +17,13 @@
|
||||
clockIcon,
|
||||
giftIcon,
|
||||
handCoinsIcon,
|
||||
moneyIcon,
|
||||
coinsIcon,
|
||||
walletIcon,
|
||||
chevronLeftIcon,
|
||||
chevronRightIcon
|
||||
} from '$lib/components/icons';
|
||||
import type { AssignedChore, Completion, ChoreTemplate, BonusConfig, Reward } from '$lib/types';
|
||||
import PiggyBank from '@lucide/svelte/icons/piggy-bank';
|
||||
import { handleOf } from '@shared/slugify';
|
||||
import {
|
||||
weekStart as tzWeekStart,
|
||||
@@ -501,6 +501,15 @@
|
||||
return sum + (chore?.type === 'money' ? Number(chore.value) : 0);
|
||||
}, 0)
|
||||
);
|
||||
// Week's cash-reward earnings (pocket money, bonuses) count while still
|
||||
// pending AND once claimed — auto-created money-todo rewards are skipped
|
||||
// (already counted via the chore completion above).
|
||||
let weekRewardCash = $derived.by(() =>
|
||||
weekRewards
|
||||
.filter((r) => r.rewardType === 'cash' && !autoRewardIds.has(r.id))
|
||||
.reduce((sum, r) => sum + Number(r.value), 0)
|
||||
);
|
||||
let weekCashTotal = $derived(weekChoreCash + weekRewardCash);
|
||||
let weekChorePoints = $derived.by(() =>
|
||||
weekCompletions.reduce((sum, c) => {
|
||||
const chore = assigned.find((a) => a.id === c.assignedChoreId);
|
||||
@@ -1250,7 +1259,7 @@
|
||||
{/if}
|
||||
{#if showCountdown}
|
||||
<div class="payday-countdown">
|
||||
<div class="pd-icon">{@html moneyIcon}</div>
|
||||
<div class="pd-icon"><PiggyBank size={44} strokeWidth={2} /></div>
|
||||
<div class="pd-body">
|
||||
<p class="pd-title">Payday is today!</p>
|
||||
<p class="pd-num">
|
||||
@@ -1439,7 +1448,7 @@
|
||||
<!-- WEEK-TO-DATE TILES -->
|
||||
<div class="tiles">
|
||||
<div class="tile tile-cash">
|
||||
<span class="tile-val">£{weekChoreCash.toFixed(2)}</span>
|
||||
<span class="tile-val">£{weekCashTotal.toFixed(2)}</span>
|
||||
<span class="tile-lbl">cash this week</span>
|
||||
</div>
|
||||
<div class="tile tile-pts">
|
||||
@@ -3066,12 +3075,14 @@
|
||||
margin-bottom: 1rem;
|
||||
padding: 1rem 1.2rem;
|
||||
border-radius: 12px;
|
||||
background: linear-gradient(135deg, #4f46e5, #7c3aed);
|
||||
color: #fff;
|
||||
box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
|
||||
background: linear-gradient(135deg, #f59e0b, #fbbf24);
|
||||
color: #451a03;
|
||||
box-shadow: 0 6px 16px rgba(245, 158, 11, 0.35);
|
||||
}
|
||||
.pd-icon {
|
||||
font-size: 1.8rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.pd-body {
|
||||
display: flex;
|
||||
|
||||
@@ -80,6 +80,12 @@
|
||||
detectedTz = '';
|
||||
}
|
||||
}
|
||||
// 'auto' resolves to the SERVER's timezone (UTC in prod), not the
|
||||
// family's — so during BST everything lands an hour late. Pre-select
|
||||
// the admin's own zone so saving stores a real IANA zone (DST-aware).
|
||||
if ((timezone === 'auto' || !timezone) && detectedTz && timezoneOptions.includes(detectedTz)) {
|
||||
timezone = detectedTz;
|
||||
}
|
||||
});
|
||||
let qrDataUrl = $state('');
|
||||
let copied = $state(false);
|
||||
@@ -262,8 +268,9 @@
|
||||
<Button type="submit" size="sm">Set payday</Button>
|
||||
</form>
|
||||
<p class="hint">
|
||||
Payday: the week starts on this day and weekly earnings are settled at this time. Auto
|
||||
timezone follows each device.
|
||||
Payday: the week starts on this day and weekly earnings are settled at this time. Pick
|
||||
your city so payday lands at the right local time — Auto uses the server's timezone
|
||||
(UTC), which is an hour out during daylight saving.
|
||||
</p>
|
||||
</Card>
|
||||
<Card title="Seasons" cols={1}>
|
||||
|
||||
Reference in New Issue
Block a user