File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,6 +32,10 @@ interface ExamCycle {
3232 task_count : number ;
3333}
3434
35+ const getThirtyDaysLaterDate = ( ) => {
36+ return new Date ( Date . now ( ) + 30 * 86400000 ) . toISOString ( ) . split ( 'T' ) [ 0 ] ;
37+ } ;
38+
3539export default function ExamsPage ( ) {
3640 const { user, fetchWithAuth } = useAuth ( ) ;
3741
@@ -90,7 +94,7 @@ export default function ExamsPage() {
9094 body : JSON . stringify ( {
9195 name : "Self Submissions Cycle" ,
9296 start_date : new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] ,
93- end_date : new Date ( Date . now ( ) + 30 * 86400000 ) . toISOString ( ) . split ( 'T' ) [ 0 ] ,
97+ end_date : getThirtyDaysLaterDate ( ) ,
9498 } ) ,
9599 } ) ;
96100 const cycJson = await cycRes . json ( ) ;
Original file line number Diff line number Diff line change @@ -38,7 +38,9 @@ interface StudentSummary {
3838
3939// Client-side cache for high-performance instant loading
4040const classroomExamsCache : Record < string , any > = { } ;
41- let globalWorksheetsCache : any = null ;
41+ const globalWorksheetsCache = {
42+ data : null as any
43+ } ;
4244
4345export default function StudentsPage ( ) {
4446 const { user, fetchWithAuth } = useAuth ( ) ;
@@ -122,8 +124,8 @@ export default function StudentsPage() {
122124
123125 // Fetch all databases
124126 const fetchClassroomData = async ( ) => {
125- if ( globalWorksheetsCache ) {
126- setClassWorksheets ( globalWorksheetsCache ) ;
127+ if ( globalWorksheetsCache . data ) {
128+ setClassWorksheets ( globalWorksheetsCache . data ) ;
127129 }
128130 try {
129131 const resClassrooms = await fetchWithAuth ( `${ API_BASE } /classroom` ) ;
@@ -146,7 +148,7 @@ export default function StudentsPage() {
146148 const resWs = await fetchWithAuth ( `${ API_BASE } /classroom/worksheets` ) ;
147149 const jsonWs = await resWs . json ( ) ;
148150 if ( jsonWs . data ) {
149- globalWorksheetsCache = jsonWs . data ;
151+ globalWorksheetsCache . data = jsonWs . data ;
150152 setClassWorksheets ( jsonWs . data ) ;
151153 }
152154
You can’t perform that action at this time.
0 commit comments