Skip to content

Commit dde2c99

Browse files
committed
Fix
1 parent 4dc2f3b commit dde2c99

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

web/components/widgets/charts.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ export default function ChartComponent() {
99
async function loadData() {
1010
// Load some data from the backend API or Supabase
1111
const data = await getUserCreations()
12-
let counts: { [date: string]: number } = {}
12+
const counts: { [date: string]: number } = {}
1313
data.forEach((d) => {
1414
const date = new Date(d.created_time).toISOString().split('T')[0]
1515
counts[date] = (counts[date] || 0) + 1
1616
})
1717
const json: any = Object.entries(counts).map(([date, value]) => ({date, value}))
1818
let prev = 0
19-
for (let i = 0; i < json.length; i++) {
20-
json[i].value += prev
21-
prev = json[i].value
19+
for (const e of json) {
20+
e.value += prev
21+
prev = e.value
2222
}
2323
json.sort((a: any, b: any) => a.date.localeCompare(b.date))
2424

0 commit comments

Comments
 (0)