-
Notifications
You must be signed in to change notification settings - Fork 3.8k
feat(app): cumulative statistics #5090
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. |
App 2 🤌⚡️ Visit your deployment at https://e381933c.app2-9yo.pages.dev |
Signed-off-by: Eric Hegnes <eric@hegnes.com>
dailyTransfers.data = pipe( | ||
data, | ||
Option.map(flow( | ||
Struct.get("v2_stats_transfers_daily_count"), | ||
A.sortBy(orderDailyTransfer), | ||
)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These arrays are now sorted ascending by date.
cumData = $derived( | ||
pipe( | ||
Option.all([this.data, statistics.totalTransfers]), | ||
Option.map(([xs, total]) => { | ||
const rev = A.reverse(xs) | ||
return pipe( | ||
rev, | ||
I.scan(total, (acc, { count }) => acc - count), | ||
I.zip(rev), | ||
I.map(([count, { day_date }]) => ({ | ||
count, | ||
day_date, | ||
})), | ||
A.fromIterable, | ||
A.reverse, | ||
x => { | ||
console.log({ x }) | ||
return x | ||
}, | ||
) | ||
}), | ||
), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We count backwards from the total, accumulating intermediate totals.
@@ -75,9 +75,10 @@ const displayPacketDay = $derived.by(() => { | |||
}) | |||
|
|||
onMount(() => { | |||
const DAYS = 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the limit allowed by the queries.
No description provided.