diff betterment

This commit is contained in:
Matti Luukkainen
2021-02-28 13:05:45 +02:00
parent 81a1ec5e8d
commit 28cecba134
@@ -8,6 +8,8 @@ const {
} = require('../models') } = require('../models')
const { Op } = require('sequelize') const { Op } = require('sequelize')
let verbose = false
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)
@@ -29,16 +31,18 @@ const populationDiff = async (programme, year) => {
if (oodiOnly.length === 0 && sisOnly.length === 0 ) { if (oodiOnly.length === 0 && sisOnly.length === 0 ) {
} else { } else {
if (oodiOnly.length > 0) { if (oodiOnly.length > 0) {
console.log(' ',year, ' oodi only ', oodiOnly.length, 'both', both.length) console.log(' ',year, ' oodi only', oodiOnly.length, 'both', both.length)
} }
if (sisOnly.length > 0) { if (sisOnly.length > 0) {
const wronglyMarked = (await cancelledButGraduated(programme)).map(s => s.student_studentnumber) const wronglyMarked = (await cancelledButGraduated(programme)).map(s => s.student_studentnumber)
const remaining = _.difference(wronglyMarked, sisOnly) const remaining = _.difference(wronglyMarked, sisOnly)
if (remaining.length==0 ) { if (remaining.length==0 ) {
console.log(' ', year,' sis only ', sisOnly.length, 'wrongly set cancel date in oodi', 'both', both.length) if (verbose) {
console.log(' ', year,' sis only' , sisOnly.length, 'wrongly set cancel date in oodi', 'both', both.length)
}
} else { } else {
console.log(' ', year, ' sis only ', sisOnly.length, 'both', both.length) console.log('******************************************')
console.log(sisOnly.join(', ')) console.log(' ', year, ' sis only', sisOnly.length, 'both', both.length, sisOnly.join(', '))
} }
} }
} }
@@ -96,7 +100,7 @@ const bscCodes = async () => {
})).map(s => s.code) })).map(s => s.code)
} }
const master = async () => { const msc = async () => {
const programmes = await masterCodes() const programmes = await masterCodes()
for (let programme of programmes) { for (let programme of programmes) {
await programmeDiff(programme) await programmeDiff(programme)
@@ -111,9 +115,22 @@ const bsc = async () => {
} }
} }
const main = async () => { const main = async () => {
// print moar/less
verbose = false
await bsc() await bsc()
await msc()
process.exit() process.exit()
} }
main() main()
/*
how to run:
docker exec backend node /usr/src/app/src/sisoodi_diff/populations.js
or:
docker exec -it backend sh
cd src/sisoodi_diff/
node populations.js
*/