mirror of
https://github.com/waynesutton/markdown-site.git
synced 2026-01-12 04:09:14 +00:00
docs: add npm run sync:prod notes for production
Clarify when to use development vs production sync commands in setup-guide, about-this-blog, and markdown-with-code-examples
This commit is contained in:
@@ -104,6 +104,7 @@ export const getStats = query({
|
||||
uniqueVisitors: v.number(),
|
||||
publishedPosts: v.number(),
|
||||
publishedPages: v.number(),
|
||||
trackingSince: v.union(v.number(), v.null()),
|
||||
pageStats: v.array(
|
||||
v.object({
|
||||
path: v.string(),
|
||||
@@ -133,8 +134,15 @@ export const getStats = query({
|
||||
.map(([path, count]) => ({ path, count }))
|
||||
.sort((a, b) => b.count - a.count);
|
||||
|
||||
// Get all page views
|
||||
const allViews = await ctx.db.query("pageViews").collect();
|
||||
// Get all page views ordered by timestamp to find earliest
|
||||
const allViews = await ctx.db
|
||||
.query("pageViews")
|
||||
.withIndex("by_timestamp")
|
||||
.order("asc")
|
||||
.collect();
|
||||
|
||||
// Get tracking start date (earliest view timestamp)
|
||||
const trackingSince = allViews.length > 0 ? allViews[0].timestamp : null;
|
||||
|
||||
// Aggregate views by path and count unique sessions
|
||||
const viewsByPath: Record<string, number> = {};
|
||||
@@ -197,6 +205,7 @@ export const getStats = query({
|
||||
uniqueVisitors: uniqueSessions.size,
|
||||
publishedPosts: posts.length,
|
||||
publishedPages: pages.length,
|
||||
trackingSince,
|
||||
pageStats,
|
||||
};
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user