fix: dont use reduce
All checks were successful
create archive with lfs / tag (push) Successful in 4s
All checks were successful
create archive with lfs / tag (push) Successful in 4s
This commit is contained in:
parent
f597722892
commit
e553ee166b
@ -15,9 +15,16 @@ export async function load({ request, cookies, url }) {
|
|||||||
throw error(403, "get a better user agent silly")
|
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 {
|
return {
|
||||||
route: url.pathname,
|
route: url.pathname,
|
||||||
visitCount: incrementVisitCount(request, cookies),
|
visitCount: incrementVisitCount(request, cookies),
|
||||||
lastVisitors: addLastVisitor(request, cookies),
|
lastVisitors,
|
||||||
|
recentVisitCount,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,10 +42,6 @@
|
|||||||
|
|
||||||
$: title = getTitle(data.route);
|
$: title = getTitle(data.route);
|
||||||
|
|
||||||
$: recentVisitCount = data.lastVisitors.values().reduce(
|
|
||||||
(total, visitor) => { return total + visitor.visits.length; }, 0
|
|
||||||
)
|
|
||||||
|
|
||||||
const svgSquiggles = [[2], [3], [2], [3], [1]];
|
const svgSquiggles = [[2], [3], [2], [3], [1]];
|
||||||
</script>
|
</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>
|
<nobr>uniq recent visits = <span class="text-ralsei-green-light text-shadow-green">{data.lastVisitors.size.toString().padStart(3, ".")}</span></nobr>
|
||||||
</p>
|
</p>
|
||||||
</svelte:fragment>
|
</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>
|
</Tooltip>
|
||||||
{#if isRoute("entries") || isRoute("log")}
|
{#if isRoute("entries") || isRoute("log")}
|
||||||
<div class="navbox !gap-1">
|
<div class="navbox !gap-1">
|
||||||
|
Loading…
Reference in New Issue
Block a user