@@ -8,7 +8,7 @@ import { IntraUser } from '../intra/oauth';
88
99export const setupDiscoPiscineRoutes = function ( app : Express , prisma : PrismaClient ) : void {
1010 app . get ( '/disco' , passport . authenticate ( 'session' ) , checkIfStudentOrStaff , async ( req , res ) => {
11- // Redirect to latest year and month defined in the database
11+ // Redirect to latest year and week defined in the database
1212 const latest = await getLatestDiscoPiscine ( prisma ) ;
1313 if ( latest ) {
1414 return res . redirect ( `/disco/${ latest . year_num } /${ latest . week_num } /${ latest . cursus . id } ` ) ;
@@ -54,22 +54,22 @@ export const setupDiscoPiscineRoutes = function(app: Express, prisma: PrismaClie
5454 return res . render ( 'disco.njk' , { discopiscines, projects, users, logtimes, dropouts, activeStudents, year, week, cursus_id, subtitle : `${ year } Week ${ week } ` } ) ;
5555 } ) ;
5656
57- app . get ( '/disco/:year/:month /:cursus_id/csv' , passport . authenticate ( 'session' ) , checkIfStudentOrStaff , checkIfCatOrStaff , checkIfPiscineHistoryAccess , async ( req , res ) => {
57+ app . get ( '/disco/:year/:week /:cursus_id/csv' , passport . authenticate ( 'session' ) , checkIfStudentOrStaff , checkIfCatOrStaff , checkIfPiscineHistoryAccess , async ( req , res ) => {
5858 // Parse parameters
5959 const year = parseInt ( req . params . year ) ;
60- const month = parseInt ( req . params . month ) ;
60+ const week = parseInt ( req . params . week ) ;
6161 const cursus_id = parseInt ( req . params . cursus_id ) ;
6262
63- const piscineData = await getDiscoPiscineData ( prisma , year , month , cursus_id ) ;
63+ const piscineData = await getDiscoPiscineData ( prisma , year , week , cursus_id ) ;
6464 if ( ! piscineData ) {
65- console . log ( `No discovery piscine found for year ${ year } , month ${ month } and cursus_id ${ cursus_id } ` ) ;
65+ console . log ( `No discovery piscine found for year ${ year } , week ${ week } and cursus_id ${ cursus_id } ` ) ;
6666 res . status ( 404 ) ;
6767 return ;
6868 }
6969
7070 const now = new Date ( ) ;
7171 res . setHeader ( 'Content-Type' , 'text/csv' ) ;
72- res . setHeader ( 'Content-Disposition' , `attachment; filename="piscine-${ year } -${ month } -export-${ formatDate ( now ) . replace ( ' ' , '-' ) } .csv"` ) ;
72+ res . setHeader ( 'Content-Disposition' , `attachment; filename="disco- piscine-${ year } -${ week } - ${ cursus_id } -export-${ formatDate ( now ) . replace ( ' ' , '-' ) } .csv"` ) ;
7373
7474 const headers = [
7575 'login' ,
0 commit comments