fix: dont use reduce
All checks were successful
create archive with lfs / tag (push) Successful in 4s

This commit is contained in:
dusk 2025-01-16 15:55:07 +03:00
parent f597722892
commit e553ee166b
Signed by: dusk
SSH Key Fingerprint: SHA256:Abmvag+juovVufZTxyWY8KcVgrznxvBjQpJesv071Aw
2 changed files with 9 additions and 6 deletions

View File

@ -15,9 +15,16 @@ export async function load({ request, cookies, url }) {
throw error(403, "get a better user agent silly")
}
const lastVisitors = addLastVisitor(request, cookies)
let recentVisitCount = 0
for (const [_, visitor] of lastVisitors) {
recentVisitCount += visitor.visits.length
}
return {
route: url.pathname,
visitCount: incrementVisitCount(request, cookies),
lastVisitors: addLastVisitor(request, cookies),
lastVisitors,
recentVisitCount,
}
}

View File

@ -42,10 +42,6 @@
$: title = getTitle(data.route);
$: recentVisitCount = data.lastVisitors.values().reduce(
(total, visitor) => { return total + visitor.visits.length; }, 0
)
const svgSquiggles = [[2], [3], [2], [3], [1]];
</script>
@ -175,7 +171,7 @@
<nobr>uniq recent visits = <span class="text-ralsei-green-light text-shadow-green">{data.lastVisitors.size.toString().padStart(3, ".")}</span></nobr>
</p>
</svelte:fragment>
<div class="navbox"><p><span class="text-ralsei-green-light text-shadow-green">{recentVisitCount}</span> recent clicks</p></div>
<div class="navbox"><p><span class="text-ralsei-green-light text-shadow-green">{data.recentVisitCount}</span> recent clicks</p></div>
</Tooltip>
{#if isRoute("entries") || isRoute("log")}
<div class="navbox !gap-1">