style: fix linting issues met Prettier
This commit is contained in:
		
							parent
							
								
									78267a2416
								
							
						
					
					
						commit
						86dadeae81
					
				
					 2 changed files with 29 additions and 30 deletions
				
			
		|  | @ -2,12 +2,9 @@ import { Request, Response } from 'express'; | |||
| import { themes } from '../data/themes.js'; | ||||
| import { FALLBACK_LANG } from '../config.js'; | ||||
| import learningPathService from '../services/learning-paths/learning-path-service'; | ||||
| import {BadRequestException, NotFoundException} from '../exceptions'; | ||||
| import {Language} from "../entities/content/language"; | ||||
| import { | ||||
|     PersonalizationTarget, personalizedForGroup, | ||||
|     personalizedForStudent | ||||
| } from "../services/learning-paths/learning-path-personalization-util"; | ||||
| import { BadRequestException, NotFoundException } from '../exceptions'; | ||||
| import { Language } from '../entities/content/language'; | ||||
| import { PersonalizationTarget, personalizedForGroup, personalizedForStudent } from '../services/learning-paths/learning-path-personalization-util'; | ||||
| 
 | ||||
| /** | ||||
|  * Fetch learning paths based on query parameters. | ||||
|  | @ -26,10 +23,10 @@ export async function getLearningPaths(req: Request, res: Response): Promise<voi | |||
|     let personalizationTarget: PersonalizationTarget | undefined; | ||||
| 
 | ||||
|     if (forStudent) { | ||||
|         personalizationTarget = await personalizedForStudent(forStudent) | ||||
|         personalizationTarget = await personalizedForStudent(forStudent); | ||||
|     } else if (forGroupNo) { | ||||
|         if (!assignmentNo || !classId) { | ||||
|             throw new BadRequestException("If forGroupNo is specified, assignmentNo and classId must also be specified."); | ||||
|             throw new BadRequestException('If forGroupNo is specified, assignmentNo and classId must also be specified.'); | ||||
|         } | ||||
|         personalizationTarget = await personalizedForGroup(classId, parseInt(assignmentNo), parseInt(forGroupNo)); | ||||
|     } | ||||
|  | @ -53,6 +50,11 @@ export async function getLearningPaths(req: Request, res: Response): Promise<voi | |||
|         hruidList = themes.flatMap((theme) => theme.hruids); | ||||
|     } | ||||
| 
 | ||||
|     const learningPaths = await learningPathService.fetchLearningPaths(hruidList, language as Language, `HRUIDs: ${hruidList.join(', ')}`, personalizationTarget); | ||||
|     const learningPaths = await learningPathService.fetchLearningPaths( | ||||
|         hruidList, | ||||
|         language as Language, | ||||
|         `HRUIDs: ${hruidList.join(', ')}`, | ||||
|         personalizationTarget | ||||
|     ); | ||||
|     res.json(learningPaths.data); | ||||
| } | ||||
|  |  | |||
|  | @ -2,12 +2,7 @@ import { LearningPathNode } from '../../entities/content/learning-path-node.enti | |||
| import { Student } from '../../entities/users/student.entity'; | ||||
| import { Group } from '../../entities/assignments/group.entity'; | ||||
| import { Submission } from '../../entities/assignments/submission.entity'; | ||||
| import { | ||||
|     getClassRepository, | ||||
|     getGroupRepository, | ||||
|     getStudentRepository, | ||||
|     getSubmissionRepository | ||||
| } from '../../data/repositories'; | ||||
| import { getClassRepository, getGroupRepository, getStudentRepository, getSubmissionRepository } from '../../data/repositories'; | ||||
| import { LearningObjectIdentifier } from '../../entities/content/learning-object-identifier'; | ||||
| import { LearningPathTransition } from '../../entities/content/learning-path-transition.entity'; | ||||
| import { JSONPath } from 'jsonpath-plus'; | ||||
|  | @ -23,12 +18,11 @@ export async function personalizedForStudent(username: string): Promise<Personal | |||
|     const student = await getStudentRepository().findByUsername(username); | ||||
|     if (student) { | ||||
|         return { | ||||
|             type: "student", | ||||
|             student: student | ||||
|         } | ||||
|     }  | ||||
|         return undefined; | ||||
|      | ||||
|             type: 'student', | ||||
|             student: student, | ||||
|         }; | ||||
|     } | ||||
|     return undefined; | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  | @ -38,7 +32,11 @@ export async function personalizedForStudent(username: string): Promise<Personal | |||
|  * @param assignmentNumber Number of the assignment for which this group was created | ||||
|  * @param groupNumber Number of the group for which we want to personalize the learning path. | ||||
|  */ | ||||
| export async function personalizedForGroup(classId: string, assignmentNumber: number, groupNumber: number): Promise<PersonalizationTarget | undefined> { | ||||
| export async function personalizedForGroup( | ||||
|     classId: string, | ||||
|     assignmentNumber: number, | ||||
|     groupNumber: number | ||||
| ): Promise<PersonalizationTarget | undefined> { | ||||
|     const clazz = await getClassRepository().findById(classId); | ||||
|     if (!clazz) { | ||||
|         return undefined; | ||||
|  | @ -48,16 +46,15 @@ export async function personalizedForGroup(classId: string, assignmentNumber: nu | |||
|             within: clazz, | ||||
|             id: assignmentNumber, | ||||
|         }, | ||||
|         groupNumber: groupNumber | ||||
|     }) | ||||
|         groupNumber: groupNumber, | ||||
|     }); | ||||
|     if (group) { | ||||
|         return { | ||||
|             type: "group", | ||||
|             group: group | ||||
|         } | ||||
|     }  | ||||
|         return undefined; | ||||
|      | ||||
|             type: 'group', | ||||
|             group: group, | ||||
|         }; | ||||
|     } | ||||
|     return undefined; | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  |  | |||
		Reference in a new issue
	
	 Lint Action
						Lint Action