@@ -94,12 +94,14 @@ export default function UploadCSVButton({
9494 reader . readAsText ( file ) ;
9595 } ;
9696
97- // Get unique student IDs for dropdown
98- const studentIds =
99- csvData ?. rows
97+ // Get unique student IDs for dropdown (with "All Students" option)
98+ const studentIds = [
99+ { value : "__all__" , label : "All Students" } ,
100+ ...( csvData ?. rows
100101 . map ( ( row ) => row . student_id )
101- . filter ( ( id , index , self ) => id && self . indexOf ( id ) === index ) ||
102- [ ] ;
102+ . filter ( ( id , index , self ) => id && self . indexOf ( id ) === index )
103+ . map ( ( id ) => ( { value : id , label : id } ) ) || [ ] )
104+ ] ;
103105
104106 // Calculate averages for numeric columns (excluding student_id)
105107 const calculateAverages = ( ) : Record < string , number > => {
@@ -314,6 +316,13 @@ export default function UploadCSVButton({
314316 }
315317 }
316318
319+ // Filter by selected student ID if one is chosen (skip if "All Students")
320+ if ( selectedStudentId && selectedStudentId !== "__all__" && dataToExport . length > 0 ) {
321+ dataToExport = dataToExport . filter (
322+ row => String ( row . student_id ) === String ( selectedStudentId )
323+ ) ;
324+ }
325+
317326 if ( dataToExport . length === 0 ) return ;
318327
319328 // Collect all keys
@@ -332,7 +341,9 @@ export default function UploadCSVButton({
332341 const url = URL . createObjectURL ( blob ) ;
333342 const a = document . createElement ( "a" ) ;
334343 a . href = url ;
335- a . download = "student_outcomes_report.csv" ;
344+ a . download = selectedStudentId && selectedStudentId !== "__all__"
345+ ? `student_${ selectedStudentId } _outcomes_report.csv`
346+ : "student_outcomes_report.csv" ;
336347 document . body . appendChild ( a ) ;
337348 a . click ( ) ;
338349 document . body . removeChild ( a ) ;
@@ -394,7 +405,7 @@ export default function UploadCSVButton({
394405 label = "Choose Student ID"
395406 placeholder = "Select ID"
396407 data = { studentIds }
397- value = { selectedStudentId }
408+ value = { selectedStudentId || "__all__" }
398409 onChange = { ( value ) => {
399410 setSelectedStudentId ( value ) ;
400411 } }
@@ -512,14 +523,28 @@ export default function UploadCSVButton({
512523 < Text size = "sm" c = "dimmed" >
513524 Filtering { filteredReportData . length } of { reportData . length } students
514525 </ Text >
515- < Button
516- variant = "outline"
517- color = "teal"
518- onClick = { ( ) => setReportModalOpen ( false ) }
519- disabled = { filteredReportData . length === 0 }
520- >
521- Apply Filter
522- </ Button >
526+ < Group >
527+ < Button
528+ variant = "subtle"
529+ color = "gray"
530+ onClick = { ( ) => {
531+ setFilterColumn ( null ) ;
532+ setFilterOperator ( "gt" ) ;
533+ setFilterValue ( "" ) ;
534+ } }
535+ disabled = { ! filterColumn && filterValue === "" }
536+ >
537+ Reset Filter
538+ </ Button >
539+ < Button
540+ variant = "outline"
541+ color = "teal"
542+ onClick = { ( ) => setReportModalOpen ( false ) }
543+ disabled = { filteredReportData . length === 0 }
544+ >
545+ Apply Filter
546+ </ Button >
547+ </ Group >
523548 </ Group >
524549 </ div >
525550 </ Modal >
0 commit comments