mirror of
https://github.com/UniversityOfHelsinkiCS/oodikone.git
synced 2026-10-12 19:03:39 +03:00
[Faculties] Basic information: Filter out commissioned programme students
This commit is contained in:
@@ -14,7 +14,13 @@ const {
|
||||
transferredInsideFaculty,
|
||||
transferredTo,
|
||||
} = require('./faculty')
|
||||
const { checkTransfers, findRightProgramme, getExtentFilter, isNewProgramme } = require('./facultyHelpers')
|
||||
const {
|
||||
checkCommissioned,
|
||||
checkTransfers,
|
||||
findRightProgramme,
|
||||
getExtentFilter,
|
||||
isNewProgramme,
|
||||
} = require('./facultyHelpers')
|
||||
|
||||
const filterDuplicateStudyrights = studyrights => {
|
||||
// bachelor+master students have two studyrights (separated by two last digits in studyrightid)
|
||||
@@ -91,9 +97,10 @@ const getFacultyStarters = async (
|
||||
const keys = Object.keys(codes)
|
||||
|
||||
if (!includeAllSpecials) {
|
||||
// We do not include inside transferred studyrights into faculty starters, but function below expect two arguments
|
||||
filteredStudyrights = filteredStudyrights.filter(
|
||||
studyright => !checkTransfers(studyright, insideTransfersStudyrights, transfersToOrAwayStudyrights)
|
||||
studyright =>
|
||||
!checkTransfers(studyright, insideTransfersStudyrights, transfersToOrAwayStudyrights) &&
|
||||
!checkCommissioned(studyright)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -160,7 +167,9 @@ const getFacultyGraduates = async (
|
||||
let graduatedRights = await graduatedStudyrights(faculty, code, since, studyrightWhere)
|
||||
if (!includeAllSpecials) {
|
||||
graduatedRights = graduatedRights.filter(
|
||||
studyright => !checkTransfers(studyright, insideTransfersStudyrights, transfersToOrAwayStudyrights)
|
||||
studyright =>
|
||||
!checkTransfers(studyright, insideTransfersStudyrights, transfersToOrAwayStudyrights) &&
|
||||
!checkCommissioned(studyright)
|
||||
)
|
||||
}
|
||||
graduatedRights.forEach(({ enddate, extentcode, studyrightElements }) => {
|
||||
|
||||
@@ -119,6 +119,12 @@ const checkTransfers = (studyright, insideTransfersStudyrights, transfersToOrAwa
|
||||
return allTransfers.includes(studyright.studentnumber)
|
||||
}
|
||||
|
||||
const commissionedProgrammes = ['KH50_009', 'MH50_015', 'T923103-N']
|
||||
|
||||
const checkCommissioned = studyright => {
|
||||
return studyright.studyrightElements.some(element => commissionedProgrammes.includes(element.code))
|
||||
}
|
||||
|
||||
const getExtentFilter = includeAllSpecials => {
|
||||
const filteredExtents = [16] // always filter out secondary subject students
|
||||
if (!includeAllSpecials) {
|
||||
@@ -157,6 +163,7 @@ module.exports = {
|
||||
formatOrganization,
|
||||
isNewProgramme,
|
||||
checkTransfers,
|
||||
checkCommissioned,
|
||||
getExtentFilter,
|
||||
mapCodesToIds,
|
||||
facultyProgrammeStudents,
|
||||
|
||||
Reference in New Issue
Block a user