@@ -4,8 +4,9 @@ import { TeamFormationOverview } from '../../features/teamFormation/TeamFormatio
44import { Role } from '../application/ApplicationTypes' ;
55import { mockFetchRole , mockFetchStudents } from './UserMocks' ;
66
7- // eslint-disable-next-line @typescript-eslint/no-require-imports
8- const XLSX = require ( 'xlsx' ) ;
7+ // NOTE: xlsx dependency removed
8+ // // eslint-disable-next-line @typescript-eslint/no-require-imports
9+ // const XLSX = require('xlsx');
910
1011export const mockTeamFormationOverviews : TeamFormationOverview [ ] = [
1112 {
@@ -133,58 +134,9 @@ export const mockBulkUploadTeam = async (
133134 if ( role === null || ! permittedRoles . includes ( role ) ) {
134135 return null ;
135136 } else {
136- const teamsArrayBuffer = await readFileAsArrayBuffer ( teamsFile ) ;
137- const workbook = XLSX . read ( teamsArrayBuffer , { type : 'array' } ) ;
138- const sheetName = workbook . SheetNames [ 0 ] ;
139- const worksheet = workbook . Sheets [ sheetName ] ;
140- const csvData : CsvData = XLSX . utils . sheet_to_json ( worksheet , { header : 1 } ) ;
141-
142- const newTeams : TeamFormationOverview [ ] = [ ] ;
143- let teamId =
144- mockTeamFormationOverviews . length > 0
145- ? mockTeamFormationOverviews [ mockTeamFormationOverviews . length - 1 ] . teamId + 1
146- : 1 ;
147- const students = mockFetchStudents ( accessToken ) ;
148-
149- for ( let i = 0 ; i < csvData . length ; i ++ ) {
150- const row = csvData [ i ] ;
151- const team : OptionType [ ] = [ ] ;
152- row . forEach ( ( username : string ) => {
153- const student = students ?. find ( ( s : any ) => s . username . trim ( ) === username . trim ( ) ) ;
154- if ( student ) {
155- team . push ( {
156- label : student . name ,
157- value : student
158- } ) ;
159- }
160- } ) ;
161-
162- const studentNames : string [ ] = [ ] ;
163- const studentIds : number [ ] = [ ] ;
164-
165- team . forEach ( ( option : OptionType | undefined ) => {
166- if ( option && option . value && typeof option . value . userId === 'number' ) {
167- studentNames . push ( option . value . name ) ;
168- studentIds . push ( option . value . userId ) ;
169- }
170- } ) ;
171-
172- newTeams . push ( {
173- teamId : teamId ++ ,
174- assessmentId : assessmentId ,
175- assessmentName : assessmentName ,
176- assessmentType : assessmentType ,
177- studentIds : studentIds ,
178- studentNames : studentNames
179- } ) ;
180- }
181-
182- mockTeamFormationOverviews . push ( ...newTeams ) ;
183-
184- return mockTeamFormationOverviews . sort (
185- ( subX : TeamFormationOverview , subY : TeamFormationOverview ) =>
186- subY . assessmentId - subX . assessmentId
187- ) ;
137+ // NOTE: xlsx dependency removed, providing stub implementation
138+ console . warn ( 'mockBulkUploadTeam: xlsx functionality disabled' ) ;
139+ return [ ] ;
188140 }
189141} ;
190142
0 commit comments