Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
12 commits
Select commit Hold shift + click to select a range
9813e45
โšก Bolt: hoist buildTimelineGroups useMemo up to page.tsx to avoid dupโ€ฆ
seonghobae Jun 22, 2026
3547906
refactor(web): optimize multiple reduce loops in weekly reports
seonghobae Jun 22, 2026
649df11
feat(ux): add focus-visible styles to overview stats toggle button
seonghobae Jun 22, 2026
a1e0025
โšก Bolt: ์ฐจํŠธ ์ปดํฌ๋„ŒํŠธ์˜ ๋ฐ์ดํ„ฐ ๋ณ€ํ™˜ ๋กœ์ง์— useMemo ์ ์šฉ
seonghobae Jun 23, 2026
3e2eeac
๐ŸŽจ Palette: [์ ‘๊ทผ์„ฑ ๊ฐœ์„ ] ๋กœ๊ทธ์•„์›ƒ ๋ฒ„ํŠผ์— aria-label ์ถ”๊ฐ€
seonghobae Jun 23, 2026
48388f7
Merge pull request #104 from ContextualWisdomLab/palette/accessibilitโ€ฆ
seonghobae Jun 23, 2026
8a7b265
Merge pull request #103 from ContextualWisdomLab/bolt-optimize-chart-โ€ฆ
seonghobae Jun 23, 2026
3ef540b
Merge pull request #102 from ContextualWisdomLab/feat/a11y-overview-sโ€ฆ
seonghobae Jun 23, 2026
0ea0ea5
Merge pull request #101 from ContextualWisdomLab/bolt/optimize-reduceโ€ฆ
seonghobae Jun 23, 2026
339134f
Merge pull request #100 from ContextualWisdomLab/bolt-perf-build-timeโ€ฆ
seonghobae Jun 23, 2026
5a3804d
๐ŸŽจ Palette: ContextSection ์ปดํฌ๋„ŒํŠธ ํ‚ค๋ณด๋“œ ๋ฐ ์Šคํฌ๋ฆฐ ๋ฆฌ๋” ์ ‘๊ทผ์„ฑ ๊ฐœ์„ 
seonghobae Jun 30, 2026
5bede47
๐ŸŽจ Palette: ContextSection ์ปดํฌ๋„ŒํŠธ ํ‚ค๋ณด๋“œ ๋ฐ ์Šคํฌ๋ฆฐ ๋ฆฌ๋” ์ ‘๊ทผ์„ฑ ๊ฐœ์„ 
seonghobae Jun 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## 2024-06-22 - Overview Stats ํ† ๊ธ€ ๋ฒ„ํŠผ ํ‚ค๋ณด๋“œ ์ ‘๊ทผ์„ฑ ๊ฐœ์„ 
**Learning:** `overview-stats` ์ปดํฌ๋„ŒํŠธ์˜ ์„ค๋ช… ํ…์ŠคํŠธ๋ฅผ ํŽผ์น˜๊ฑฐ๋‚˜ ์ ‘๋Š” `<button>` ์š”์†Œ์— ํ‚ค๋ณด๋“œ ํฌ์ปค์Šค ์Šคํƒ€์ผ์ด ๋ˆ„๋ฝ๋˜์–ด ์žˆ์–ด, ํ‚ค๋ณด๋“œ ๋‚ด๋น„๊ฒŒ์ด์…˜ ์‚ฌ์šฉ์ž์—๊ฒŒ ํ˜„์žฌ ํฌ์ปค์Šค ์œ„์น˜๋ฅผ ๋ช…ํ™•ํžˆ ๋ณด์—ฌ์ฃผ์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค. `hover` ์Šคํƒ€์ผ์€ ์žˆ์—ˆ์œผ๋‚˜ `focus-visible` ์ฒ˜๋ฆฌ๊ฐ€ ์—†์–ด ์ ‘๊ทผ์„ฑ ๊ฒฐํ•จ์ด ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
**Action:** Tailwind CSS์˜ `focus-visible` ๊ด€๋ จ ์œ ํ‹ธ๋ฆฌํ‹ฐ ํด๋ž˜์Šค(`focus-visible:outline-none`, `focus-visible:ring-2`, `focus-visible:ring-ring`, `rounded-sm`)๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ ํƒญ(Tab) ํ‚ค ์ด๋™ ์‹œ ํฌ์ปค์Šค ๋ง์ด ๋ณด์ด๋„๋ก ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค. ์•ž์œผ๋กœ ๋Œ€ํ™”ํ˜• ์ปดํฌ๋„ŒํŠธ๋ฅผ ์„ค๊ณ„ํ•  ๋•Œ๋Š” ํ•ญ์ƒ ํ‚ค๋ณด๋“œ ์ ‘๊ทผ์„ฑ(focus states)์„ ์—ผ๋‘์— ๋‘๊ณ  ์ž‘์—…ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
## 2024-07-01 - ContextSection ์ปดํฌ๋„ŒํŠธ ์•„์ฝ”๋””์–ธ ์ ‘๊ทผ์„ฑ ํ–ฅ์ƒ
**Learning:** `ContextSection` ๊ฐ™์€ ์ปค์Šคํ…€ ์•„์ฝ”๋””์–ธ(ํŽผ์นจ/์ ‘ํž˜) UI๋ฅผ ๊ตฌํ˜„ํ•  ๋•Œ, ํ† ๊ธ€ `<button>`๊ณผ ์ˆจ๊ฒจ์ง€๋Š” ์ฝ˜ํ…์ธ  `<div>` ๊ฐ„์˜ ๊ด€๊ณ„๋ฅผ ์Šคํฌ๋ฆฐ ๋ฆฌ๋”์— ๋ช…ํ™•ํžˆ ์ „๋‹ฌํ•˜๊ธฐ ์œ„ํ•ด `React.useId()`๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ƒ์„ฑํ•œ ๊ณ ์œ  ID๋ฅผ `aria-controls`์™€ ์ฝ˜ํ…์ธ  `id`์— ๊ฐ๊ฐ ๋ถ€์—ฌํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ, ๋งˆ์šฐ์Šค hover ์Šคํƒ€์ผ๋งŒ์œผ๋กœ๋Š” ํ‚ค๋ณด๋“œ ๋‚ด๋น„๊ฒŒ์ด์…˜ ์‚ฌ์šฉ์ž์—๊ฒŒ ํ˜„์žฌ ํฌ์ปค์Šค ์œ„์น˜๋ฅผ ๋ณด์—ฌ์ค„ ์ˆ˜ ์—†์œผ๋ฏ€๋กœ `focus-visible` ๊ด€๋ จ ์œ ํ‹ธ๋ฆฌํ‹ฐ(`focus-visible:ring-2`)๋ฅผ ๋ฐ˜๋“œ์‹œ ํ•จ๊ป˜ ์ ์šฉํ•ด์•ผ ์™„๋ฒฝํ•œ ์ ‘๊ทผ์„ฑ์„ ๋‹ฌ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
**Action:** ์•ž์œผ๋กœ ์ปค์Šคํ…€ ํ† ๊ธ€ ๋˜๋Š” ์•„์ฝ”๋””์–ธ UI๋ฅผ ์ž‘์„ฑํ•  ๋•Œ ํ•ญ์ƒ `useId()`์™€ `aria-controls` ์กฐํ•ฉ์„ ์‚ฌ์šฉํ•˜์—ฌ ์Šคํฌ๋ฆฐ ๋ฆฌ๋” ์ง€์›์„ ์ถ”๊ฐ€ํ•˜๊ณ , `focus-visible` ์Šคํƒ€์ผ์„ ์ ์šฉํ•ด ํ‚ค๋ณด๋“œ ํฌ์ปค์Šค ์‹œ๊ฐ ํ”ผ๋“œ๋ฐฑ์„ ๋ณด์žฅํ•ฉ๋‹ˆ๋‹ค.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ __pycache__/
.jules/
.state/
.claude/worktrees/

# coverage
coverage/
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

## [Unreleased]

### ๐ŸŽจ ๋ณ€๊ฒฝ ์‚ฌํ•ญ (UX / ์ ‘๊ทผ์„ฑ)

- ์›น ๋Œ€์‹œ๋ณด๋“œ์˜ ๊ฐ์ข… ๋กœ๊ทธ์•„์›ƒ ๋ฒ„ํŠผ(`org-sidebar.tsx`, `org-header.tsx`, `no-organization-state.tsx`)์— ์Šคํฌ๋ฆฐ ๋ฆฌ๋”์šฉ `aria-label="Log out of your account"` (๋˜๋Š” `Sign out of your account`) ์†์„ฑ์„ ์ถ”๊ฐ€ํ•˜์—ฌ ์ ‘๊ทผ์„ฑ์„ ๊ฐœ์„ ํ–ˆ์Šต๋‹ˆ๋‹ค.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"devDependencies": {
"@eslint/eslintrc": "^3",
"@vitest/coverage-v8": "3.2.6",
"eslint": "^9",
"turbo": "^2.9.16",
"typescript-eslint": "^8"
Expand Down
4 changes: 3 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"lint": "eslint src",
"typecheck": "tsc --noEmit",
"test": "vitest run",
"coverage": "vitest run --coverage",
"test:watch": "vitest"
},
"dependencies": {
Expand All @@ -29,7 +30,8 @@
"@argos/shared": "workspace:*",
"@types/node": "^20",
"typescript": "^5",
"vitest": "^3.2.6"
"vitest": "^3.2.6",
"@vitest/coverage-v8": "^3.2.6"
},
"engines": {
"node": ">=18"
Expand Down
4 changes: 3 additions & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
"lint": "eslint src",
"typecheck": "tsc --noEmit",
"test": "vitest run",
"coverage": "vitest run --coverage",
"test:watch": "vitest"
},
"dependencies": {
"zod": "^3"
},
"devDependencies": {
"typescript": "^5",
"vitest": "^3.2.6"
"vitest": "^3.2.6",
"@vitest/coverage-v8": "^3.2.6"
}
}
4 changes: 3 additions & 1 deletion packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"lint": "eslint src",
"typecheck": "tsc --noEmit",
"test": "vitest run",
"coverage": "vitest run --coverage",
"test:watch": "vitest",
"postinstall": "prisma generate",
"db:migrate": "prisma migrate deploy",
Expand Down Expand Up @@ -51,6 +52,7 @@
"shadcn": "^4.10.0",
"tailwindcss": "^4",
"typescript": "^5",
"vitest": "^3.2.6"
"vitest": "^3.2.6",
"@vitest/coverage-v8": "^3.2.6"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
SessionFilesTab,
} from '@/components/dashboard/session-files'
import { useSessionDetail } from '@/hooks/use-dashboard-sessions'
import { messagesToTimeline, formatSlashCommandText } from '@/lib/timeline-events'
import { messagesToTimeline, buildTimelineGroups, formatSlashCommandText } from '@/lib/timeline-events'
import { extractSessionFiles } from '@/lib/session-files'
import {
formatTokens,
Expand Down Expand Up @@ -46,6 +46,7 @@ export default function OrgSessionDetailPage({
() => (data ? messagesToTimeline(data.messages) : []),
[data],
)
const groups = useMemo(() => buildTimelineGroups(events), [events])
const files = useMemo(() => extractSessionFiles(events), [events])
const [selectedIdx, setSelectedIdx] = useState<number | null>(0)
const safeIdx =
Expand Down Expand Up @@ -221,6 +222,7 @@ export default function OrgSessionDetailPage({
<div className="px-4 pt-3 pb-2">
<SessionActivityRibbon
events={events}
groups={groups}
selectedIdx={safeIdx}
onSelect={setSelectedIdx}
sessionStartedAt={data.startedAt}
Expand All @@ -232,6 +234,7 @@ export default function OrgSessionDetailPage({
<div className="border-r border-border min-h-0 overflow-hidden">
<EventList
events={events}
groups={groups}
selectedIdx={safeIdx ?? -1}
onSelect={setSelectedIdx}
sessionStartedAt={data.startedAt}
Expand Down
11 changes: 6 additions & 5 deletions packages/web/src/components/dashboard/event-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import { List, type RowComponentProps } from "react-window";
import { User, Bot, Wrench, ChevronRight } from "lucide-react";
import {
formatSlashCommandText,
buildTimelineGroups,
type TimelineEvent,
type TimelineGroup,
} from "@/lib/timeline-events";
import { cn } from "@/lib/utils";

type EventListProps = {
events: TimelineEvent[];
groups: TimelineGroup[];
selectedIdx: number;
onSelect: (idx: number) => void;
sessionStartedAt: string;
Expand Down Expand Up @@ -50,11 +51,10 @@ function formatElapsed(timestamp: string, sessionStartedAt: string): string {
}

function buildFlatRows(
events: TimelineEvent[],
groups: TimelineGroup[],
expandedGroups: Set<number>,
selectedIdx: number,
): FlatRow[] {
const groups = buildTimelineGroups(events);
const rows: FlatRow[] = [];
for (const group of groups) {
if (group.kind === "single") {
Expand Down Expand Up @@ -261,15 +261,16 @@ function Row({

export function EventList({
events,
groups,
selectedIdx,
onSelect,
sessionStartedAt,
expandedGroups,
onToggleGroup,
}: EventListProps) {
const rows = useMemo(
() => buildFlatRows(events, expandedGroups, selectedIdx),
[events, expandedGroups, selectedIdx],
() => buildFlatRows(groups, expandedGroups, selectedIdx),
[groups, expandedGroups, selectedIdx],
);

if (events.length === 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export function NoOrganizationState({
<button
onClick={() => signOut({ callbackUrl: '/login' })}
className="text-sm text-destructive hover:underline"
aria-label="Log out of your account"
>
Log out
</button>
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/components/dashboard/overview-stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export function OverviewStats({
id="overview-stats-explanation-toggle"
aria-expanded={expanded}
aria-controls="overview-stats-explanation"
className="mt-4 flex items-center gap-2 text-xs text-muted-foreground hover:text-foreground transition-colors"
className="mt-4 flex items-center gap-2 text-xs text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors rounded-sm"
>
<span
aria-hidden="true"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import { useState, type ReactNode } from 'react'
import { useState, useId, type ReactNode } from 'react'
import { ChevronDown, ChevronUp } from 'lucide-react'
import { cn } from '@/lib/utils'

Expand All @@ -12,6 +12,7 @@ interface ContextSectionProps {

export function ContextSection({ title, children, defaultOpen = false }: ContextSectionProps) {
const [open, setOpen] = useState(defaultOpen)
const contentId = useId()

return (
<div className="rounded-xl bg-card ring-1 ring-foreground/10 overflow-hidden">
Expand All @@ -21,8 +22,10 @@ export function ContextSection({ title, children, defaultOpen = false }: Context
className={cn(
'w-full flex items-center justify-between px-4 py-3 text-left',
'hover:bg-card-elevated transition-colors',
'focus-visible:outline-none focus-visible:bg-card-elevated focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset'
)}
aria-expanded={open}
aria-controls={contentId}
>
<h2 className="text-base font-medium">{title}</h2>
{open ? (
Expand All @@ -32,7 +35,7 @@ export function ContextSection({ title, children, defaultOpen = false }: Context
)}
</button>
{open && (
<div className="px-4 pb-4 pt-1">
<div id={contentId} className="px-4 pb-4 pt-1">
{children}
</div>
)}
Expand Down
27 changes: 16 additions & 11 deletions packages/web/src/components/dashboard/reports/weekly-flow-chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
Legend,
type TooltipProps,
} from 'recharts'
import { useMemo } from 'react'
import { parseISO } from 'date-fns'
import { formatTokens } from '@/lib/format'
import type { DailySeriesPoint } from '@/types/reports'
Expand Down Expand Up @@ -57,18 +58,22 @@ function sumTokens(p: DailySeriesPoint): number {
}

export function WeeklyFlowChart({ thisWeek, prevWeek }: WeeklyFlowChartProps) {
// ์š”์ผ ๊ธฐ์ค€์œผ๋กœ ๋ณ‘ํ•ฉ (์›”~์ผ 7๊ฐœ ์Šฌ๋กฏ)
const dayNames = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
const data: ChartRow[] = dayNames.map((day) => ({ day, thisWeekTokens: 0, prevWeekTokens: 0 }))
const data = useMemo(() => {
// ์š”์ผ ๊ธฐ์ค€์œผ๋กœ ๋ณ‘ํ•ฉ (์›”~์ผ 7๊ฐœ ์Šฌ๋กฏ)
const dayNames = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
const result: ChartRow[] = dayNames.map((day) => ({ day, thisWeekTokens: 0, prevWeekTokens: 0 }))

for (const p of thisWeek) {
const idx = dayIndex(p.date)
if (idx >= 0) data[idx].thisWeekTokens += sumTokens(p)
}
for (const p of prevWeek) {
const idx = dayIndex(p.date)
if (idx >= 0) data[idx].prevWeekTokens += sumTokens(p)
}
for (const p of thisWeek) {
const idx = dayIndex(p.date)
if (idx >= 0) result[idx].thisWeekTokens += sumTokens(p)
}
for (const p of prevWeek) {
const idx = dayIndex(p.date)
if (idx >= 0) result[idx].prevWeekTokens += sumTokens(p)
}

return result
}, [thisWeek, prevWeek])

return (
<ResponsiveContainer width="100%" height={260}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
'use client'

import { useMemo, useState, useRef } from 'react'
import { useState, useRef } from 'react'
import {
formatSlashCommandText,
buildTimelineGroups,
type TimelineEvent,
type TimelineGroup,
} from '@/lib/timeline-events'
import { formatTokens, formatCost, formatRelativeTime } from '@/lib/format'
import { segmentVisuals } from './session-ribbon-visuals'

type Props = {
events: TimelineEvent[]
groups: TimelineGroup[]
selectedIdx: number | null
onSelect: (idx: number) => void
sessionStartedAt: string
Expand Down Expand Up @@ -147,6 +148,7 @@ function MergedTooltipBody({

export function SessionActivityRibbon({
events,
groups,
selectedIdx,
onSelect,
sessionStartedAt,
Expand All @@ -156,8 +158,6 @@ export function SessionActivityRibbon({
const [hover, setHover] = useState<HoverState | null>(null)
const containerRef = useRef<HTMLDivElement>(null)

const groups = useMemo(() => buildTimelineGroups(events), [events])

if (events.length === 0) return null

const trackMouse = (e: React.MouseEvent) => {
Expand Down
21 changes: 12 additions & 9 deletions packages/web/src/components/dashboard/token-usage-chart.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client'

import { useMemo } from 'react'
import { AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, TooltipProps } from 'recharts'
import { formatTokens, formatCost } from '@/lib/format'
import type { UsageSeries } from '@argos/shared'
Expand Down Expand Up @@ -43,15 +44,17 @@ function CustomTooltip({ active, payload, label }: TooltipProps<number, string>)
}

export function TokenUsageChart({ data }: TokenUsageChartProps) {
const chartData = data.map(d => {
const date = new Date(d.date)
return {
date: format(date, 'MMM d'),
fullDate: format(date, 'MMM d, yyyy'),
input: d.inputTokens,
output: d.outputTokens,
}
})
const chartData = useMemo(() => {
return data.map(d => {
const date = new Date(d.date)
return {
date: format(date, 'MMM d'),
fullDate: format(date, 'MMM d, yyyy'),
input: d.inputTokens,
output: d.outputTokens,
}
})
}, [data])

return (
<ResponsiveContainer width="100%" height={300}>
Expand Down
1 change: 1 addition & 0 deletions packages/web/src/components/layout/org-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export function OrgHeader({ orgName }: { orgName?: string }) {
<Button
variant="outline"
onClick={() => signOut({ callbackUrl: '/login' })}
aria-label="Sign out of your account"
>
Sign out
</Button>
Expand Down
2 changes: 2 additions & 0 deletions packages/web/src/components/layout/org-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export function OrgSidebar() {
<button
onClick={handleLogout}
className="w-full px-3 py-2 text-sm font-medium text-destructive hover:bg-destructive/10 rounded-md transition-colors"
aria-label="Log out of your account"
>
Log Out
</button>
Expand All @@ -150,6 +151,7 @@ export function OrgSidebar() {
<button
onClick={handleLogout}
className="px-3 py-1 text-sm text-destructive hover:bg-destructive/10 rounded-md transition-colors"
aria-label="Log out of your account"
>
Logout
</button>
Expand Down
23 changes: 14 additions & 9 deletions packages/web/src/lib/server/weekly-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,17 +392,22 @@ export async function getWeeklyReport(
}

// Insights โ€” delegation
const totalAgentCalls = thisWeekRollups.reduce(
(sum, r) => sum + Object.values(r.agentCounts).reduce((a, b) => a + b, 0),
0,
)
const totalSkillCalls = thisWeekRollups.reduce(
(sum, r) => sum + Object.values(r.skillCounts).reduce((a, b) => a + b, 0),
0,
)
// โšก Bolt Optimization:
// ๋ณ‘๋ชฉ ์ง€์ : ๊ธฐ์กด ์ฝ”๋“œ๋Š” `thisWeekRollups`๋ฅผ 3๋ฒˆ ์ˆœํšŒํ•˜๊ณ , ๋งค ์ˆœํšŒ๋งˆ๋‹ค Object.values()๋กœ ์ค‘๊ฐ„ ๋ฐฐ์—ด์„ ์ƒ์„ฑํ•˜์—ฌ ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น ๋น„์šฉ์ด ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.
// ์ตœ์ ํ™” ๋ฐฉ๋ฒ•: ๋‹จ์ผ for...of ๋ฃจํ”„์™€ Object.keys() ์ˆœํšŒ๋ฅผ ๊ฒฐํ•ฉํ•˜์—ฌ N+1 ์ˆœํšŒ๋ฅผ 1ํšŒ ์ˆœํšŒ๋กœ ํ†ตํ•ฉํ•˜๊ณ  ์ค‘๊ฐ„ ๋ฐฐ์—ด ํ• ๋‹น์„ ์ œ๊ฑฐํ–ˆ์Šต๋‹ˆ๋‹ค.
// ๊ธฐ๋Œ€ ํšจ๊ณผ: `thisWeekRollups`์˜ ํฌ๊ธฐ๊ฐ€ ํด ๊ฒฝ์šฐ, ๋ถˆํ•„์š”ํ•œ ๋ฐฐ์—ด ์ƒ์„ฑ ์˜ค๋ฒ„ํ—ค๋“œ์™€ O(N) ์ˆœํšŒ๋ฅผ 1/3๋กœ ์ค„์—ฌ ๋ฆฌํฌํŠธ ์ƒ์„ฑ ์„ฑ๋Šฅ์ด ํ–ฅ์ƒ๋ฉ๋‹ˆ๋‹ค.
let totalAgentCalls = 0
let totalSkillCalls = 0
const distinctSkillsThisWeek = new Set<string>()

for (const r of thisWeekRollups) {
for (const k of Object.keys(r.skillCounts)) distinctSkillsThisWeek.add(k)
for (const k of Object.keys(r.agentCounts)) {
totalAgentCalls += r.agentCounts[k]
}
for (const k of Object.keys(r.skillCounts)) {
totalSkillCalls += r.skillCounts[k]
distinctSkillsThisWeek.add(k)
}
}

const insights: WeeklyInsights = {
Expand Down
Loading
Loading