mirror of
https://github.com/UniversityOfHelsinkiCS/oodikone.git
synced 2026-10-12 19:03:39 +03:00
diff betterment
This commit is contained in:
@@ -8,10 +8,75 @@ const { Op } = require('sequelize')
|
|||||||
|
|
||||||
let verbose = false
|
let verbose = false
|
||||||
|
|
||||||
|
/*
|
||||||
|
if a number under 'sis' it is found in sis-oodikone but missing form
|
||||||
|
oodi-oodikone due to a oodi-oodikone fukap
|
||||||
|
*/
|
||||||
|
|
||||||
|
const ignores = {
|
||||||
|
'KH40_001': {
|
||||||
|
'2020': {
|
||||||
|
'oodi': ['014290314'] // studyright enddate wrong in sis https://github.com/UniversityOfHelsinkiCS/oodikone/issues/2701
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'KH40_002': {
|
||||||
|
'2020': {
|
||||||
|
'sis': ['011368870'] // studyright enddate missing in sis https://github.com/UniversityOfHelsinkiCS/oodikone/issues/2701
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'KH40_003': {
|
||||||
|
'2020': {
|
||||||
|
'sis': ['015340182'] // studyright enddate missing in sis https://github.com/UniversityOfHelsinkiCS/oodikone/issues/2701
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'KH40_004': {
|
||||||
|
'2017': {
|
||||||
|
'oodi': ['011531500'] // studyright enddate too early in sis https://github.com/UniversityOfHelsinkiCS/oodikone/issues/2701
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'KH40_005': {
|
||||||
|
'2018': {
|
||||||
|
'sis': ['014650093'] // graduated but mistakenlu luop in oodi https://github.com/UniversityOfHelsinkiCS/oodikone/issues/2701
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'KH50_004': {
|
||||||
|
'2020': {
|
||||||
|
'oodi': ['013881465'] // studyright enddate too early in sis https://github.com/UniversityOfHelsinkiCS/oodikone/issues/2701
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'KH57_002': {
|
||||||
|
'2017': {
|
||||||
|
'oodi': ['014818220'] // graduation missing in sis-oodikone https://github.com/UniversityOfHelsinkiCS/oodikone/issues/2705
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'KH74_001': {
|
||||||
|
'2019': {
|
||||||
|
'sis': ['014480768'] // graduation missing in oodi https://github.com/UniversityOfHelsinkiCS/oodikone/issues/2705
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'KH90_001': {
|
||||||
|
'2020': {
|
||||||
|
'sis': ['014261181'] // many things wrong... https://github.com/UniversityOfHelsinkiCS/oodikone/issues/2707
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'KH55_001': {
|
||||||
|
'2019': {
|
||||||
|
'sis': ['015160142'] // duplicate studyrigth https://github.com/UniversityOfHelsinkiCS/oodikone/issues/2709
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'KH57_001': {
|
||||||
|
'2018': {
|
||||||
|
'sis': ['013296128']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const populationDiff = async (programme, year) => {
|
const populationDiff = async (programme, year) => {
|
||||||
const months = Number((2020 - Number(year)) * 12 + 7)
|
const months = Number((2020 - Number(year)) * 12 + 7)
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
console.log('amount of months to fetch', months)
|
//console.log('amount of months to fetch', months)
|
||||||
}
|
}
|
||||||
|
|
||||||
const query = {
|
const query = {
|
||||||
@@ -27,8 +92,22 @@ const populationDiff = async (programme, year) => {
|
|||||||
const studentsSis = resultSis.students.map(s => s.studentNumber)
|
const studentsSis = resultSis.students.map(s => s.studentNumber)
|
||||||
const studentsOodi = resultOodi.students.map(s => s.studentNumber)
|
const studentsOodi = resultOodi.students.map(s => s.studentNumber)
|
||||||
|
|
||||||
const sisOnly = _.difference(studentsSis, studentsOodi)
|
let sisOnly = _.difference(studentsSis, studentsOodi)
|
||||||
const oodiOnly = _.difference(studentsOodi, studentsSis)
|
let oodiOnly = _.difference(studentsOodi, studentsSis)
|
||||||
|
|
||||||
|
if (ignores[programme] && ignores[programme][year] ) {
|
||||||
|
|
||||||
|
const legallyInSisButNotInOodi = ignores[programme][year]['sis']
|
||||||
|
if ( legallyInSisButNotInOodi ) {
|
||||||
|
sisOnly = _.difference(sisOnly, legallyInSisButNotInOodi)
|
||||||
|
}
|
||||||
|
|
||||||
|
const inOodiNotInSis = ignores[programme][year]['oodi']
|
||||||
|
if ( inOodiNotInSis ) {
|
||||||
|
oodiOnly = _.difference(oodiOnly, inOodiNotInSis)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const both = _.intersection(studentsOodi, studentsSis)
|
const both = _.intersection(studentsOodi, studentsSis)
|
||||||
|
|
||||||
if (oodiOnly.length === 0 && sisOnly.length === 0) {
|
if (oodiOnly.length === 0 && sisOnly.length === 0) {
|
||||||
@@ -117,6 +196,7 @@ const bscCodes = async () => {
|
|||||||
})).map(s => s.code)
|
})).map(s => s.code)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const msc = async () => {
|
const msc = async () => {
|
||||||
const programmes = await masterCodes()
|
const programmes = await masterCodes()
|
||||||
for (let programme of programmes) {
|
for (let programme of programmes) {
|
||||||
@@ -131,6 +211,15 @@ const bsc = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bscnok = async () => {
|
||||||
|
let programmes = await bscCodes()
|
||||||
|
for (let programme of _.difference(programmes, ['KH60_001'])) {
|
||||||
|
await programmeDiff(programme)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
// print moar/less
|
// print moar/less
|
||||||
verbose = true
|
verbose = true
|
||||||
@@ -150,6 +239,10 @@ const main = async () => {
|
|||||||
await bsc()
|
await bsc()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (what.includes('bscnok')) {
|
||||||
|
await bscnok()
|
||||||
|
}
|
||||||
|
|
||||||
for ( let i=0; i < what.length; i++ ) {
|
for ( let i=0; i < what.length; i++ ) {
|
||||||
const programme = what[i]
|
const programme = what[i]
|
||||||
if ( programme.startsWith('KH') || programme.startsWith('MH') ) {
|
if ( programme.startsWith('KH') || programme.startsWith('MH') ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user