Skip to content

Commit 2e69225

Browse files
making sure ERI courses are ordered right
1 parent 5504cb0 commit 2e69225

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/server/util/pointRecommendCourses.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,11 @@ function pointRecommendedCourses(courses: CourseRecommendation[], userCoordinate
159159

160160
let bonusPoints = 0
161161

162+
const isChallengeCourseOrEri = c.coordinates.challenge === 1 || c.course.courseCodes.find((c) => c.includes("ERI"))
163+
162164
const mandatory = c.coordinates.mentoring === 0 ? true : false//it is believed that if course is not a mentoring course it is a mandatory course.
163165
const calculateBonusForMandatory = userCoordinates?.mentoring === undefined | null
164-
if (calculateBonusForMandatory){
166+
if (calculateBonusForMandatory && !isChallengeCourseOrEri){
165167
//lets add some extra points when the course is mandatory course
166168
if(mandatory){
167169
bonusPoints += bonusPoint
@@ -170,19 +172,17 @@ function pointRecommendedCourses(courses: CourseRecommendation[], userCoordinate
170172

171173
// Ordering: specific (RUFARM) > KAIKKI > numbered (ENG-123) > ERI (challenge)
172174
const isGenericCourse = !!c.course.courseCodes.find((c) => c.includes('KAIKKI'))
173-
const notGenericCourse = !isGenericCourse
174-
const notChallengeCourse = c.coordinates.challenge === 0 ? true : false
175175
const isNumberedCourse = c.course.courseCodes.some((code) => /\d+$/.test(code))
176176

177-
if(notGenericCourse && mandatory && notChallengeCourse){
177+
if(!isGenericCourse && mandatory && !isChallengeCourseOrEri){
178178
bonusPoints += bonusPoint // non-generic non-challenge: +1
179179
if(!isNumberedCourse){
180180
bonusPoints += bonusPoint * 2 // specific courses (RUKFARM etc): extra +2
181181
}
182182
}
183183

184184
// KAIKKI (generic) courses rank between specific and numbered courses
185-
if(isGenericCourse && mandatory && notChallengeCourse){
185+
if(isGenericCourse && mandatory && !isChallengeCourseOrEri){
186186
bonusPoints += bonusPoint * 2
187187
}
188188

0 commit comments

Comments
 (0)