File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,16 +5,13 @@ import { DenoVersion } from "components/DenoVersion.tsx";
55import { LinkToJsonAndErrors } from "components/LinkToJsonAndErrors.tsx" ;
66import { Chart } from "islands/Chart.tsx" ;
77import { SummaryTable } from "islands/SummaryTable.tsx" ;
8- import {
9- getLatestDaySummary ,
10- getSummariesForLatestMonths ,
11- } from "util/report.ts" ;
8+ import { getLatestDaySummary , getSummariesSinceMonth } from "util/report.ts" ;
129import { DaySummary } from "util/types.ts" ;
1310
1411export const handler = define . handlers ( {
1512 async GET ( ) {
16- const monthSummaries = await getSummariesForLatestMonths ( 3 ) ;
17- const monthSummary = monthSummaries [ 0 ] ;
13+ const monthSummaries = await getSummariesSinceMonth ( "2026-01" ) ;
14+ const monthSummary = monthSummaries [ monthSummaries . length - 1 ] ;
1815 const daySummaries = monthSummaries . reduce (
1916 ( acc , month ) => Object . assign ( acc , month . reports ) ,
2017 { } as Record < string , DaySummary > ,
Original file line number Diff line number Diff line change @@ -235,6 +235,23 @@ export async function getSummariesForLatestMonths(
235235 return summaries ;
236236}
237237
238+ export async function getSummariesSinceMonth (
239+ startMonth : string ,
240+ ) : Promise < MonthSummary [ ] > {
241+ const current = new Date ( startMonth + "-15" ) ;
242+ const now = new Date ( ) ;
243+ const summaries : MonthSummary [ ] = [ ] ;
244+ while ( current <= now ) {
245+ const monthName = current . toISOString ( ) . slice ( 0 , 7 ) ;
246+ const summary = await getMonthSummary ( monthName ) ;
247+ if ( Object . keys ( summary . reports ) . length > 0 ) {
248+ summaries . push ( summary ) ;
249+ }
250+ current . setMonth ( current . getMonth ( ) + 1 ) ;
251+ }
252+ return summaries ;
253+ }
254+
238255export async function addDaySummaryByDate (
239256 monthSummary : MonthSummary ,
240257 date : string ,
You can’t perform that action at this time.
0 commit comments