MCPcopy Index your code
hub / github.com/massCodeIO/massCode / buildActivity

Function buildActivity

src/main/api/routes/notes-dashboard.ts:28–51  ·  view source on GitHub ↗
(updatedAtList: number[])

Source from the content-addressed store, hash-verified

26}
27
28function buildActivity(updatedAtList: number[]) {
29 const days: Record<string, number> = {}
30
31 updatedAtList.forEach((updatedAt) => {
32 const dayKey = getDayKey(updatedAt)
33 days[dayKey] = (days[dayKey] ?? 0) + 1
34 })
35
36 const today = new Date()
37 today.setHours(0, 0, 0, 0)
38 const todayTime = today.getTime()
39 const todayStart = todayTime
40 const sevenDaysAgo = todayTime - 6 * 24 * 60 * 60 * 1000
41
42 return {
43 days,
44 notesUpdatedLast7Days: updatedAtList.filter(
45 updatedAt => updatedAt >= sevenDaysAgo,
46 ).length,
47 notesUpdatedToday: updatedAtList.filter(
48 updatedAt => updatedAt >= todayStart,
49 ).length,
50 }
51}
52
53const app = new Elysia({ prefix: '/notes' })
54

Callers 1

notes-dashboard.tsFile · 0.85

Calls 1

getDayKeyFunction · 0.85

Tested by

no test coverage detected