diff --git a/services/backend/src/routes/updater.js b/services/backend/src/routes/updater.js index ebc77a24ef..47a74de1aa 100644 --- a/services/backend/src/routes/updater.js +++ b/services/backend/src/routes/updater.js @@ -9,7 +9,6 @@ const { updateSISRedisCache, updateSISStudents, updateStudentsByStudentNumber, - updateStudentsIndividually, } = require('../services/sisUpdaterService') const logger = require('../util/logger') const { jobMaker, getJobs } = require('../worker/queue') @@ -38,11 +37,6 @@ router.get('/update/v2/students', async (_req, res) => { } }) -router.get('/update/v2/students_individually', async (_req, res) => { - await updateStudentsIndividually() - res.status(200).send() -}) - router.post('/update/v2/customlist/:type', async (req, res) => { const { type } = req.params const list = req.body diff --git a/services/backend/src/services/sisUpdaterService.js b/services/backend/src/services/sisUpdaterService.js index 44ad7dfb8b..9240701925 100644 --- a/services/backend/src/services/sisUpdaterService.js +++ b/services/backend/src/services/sisUpdaterService.js @@ -2,8 +2,7 @@ const axios = require('axios') const { Op } = require('sequelize') const { SIS_UPDATER_URL, SECRET_TOKEN } = require('../conf-backend') -const { Studyplan, Student, StudyrightElement } = require('../models') -const logger = require('../util/logger') +const { Studyplan } = require('../models') const client = axios.create({ baseURL: SIS_UPDATER_URL }) @@ -40,37 +39,6 @@ const updateSISRedisCache = async () => { const response = await client.get('/v1/rediscache', params) return response.data } -const delay = time => { - return new Promise(res => { - setTimeout(res, time) - }) -} - -const updateStudentsIndividually = async () => { - try { - const studentNumbers = await Student.findAll({ - attributes: ['studentnumber'], - include: { - model: StudyrightElement, - where: { - code: { [Op.regexp]: '(KH*|MH*)' }, - }, - }, - }) - const uniqueStudents = [...new Set(studentNumbers.map(s => s.studentnumber))] - const chunkSize = 4000 - for (let from = 0; from < uniqueStudents.length - chunkSize; from += chunkSize) { - await client.post( - 'v1/students', - { studentnumbers: uniqueStudents.slice(from, from + chunkSize), individualMode: true }, - params - ) - await delay(200) - } - } catch (e) { - logger.error(e) - } -} const studyplansUpdate = async days => { const limitDate = new Date() @@ -100,5 +68,4 @@ module.exports = { abort, updateCoursesByCourseCode, studyplansUpdate, - updateStudentsIndividually, } diff --git a/services/frontend/src/components/Updater/index.jsx b/services/frontend/src/components/Updater/index.jsx index cd0ce76bed..2f4501f986 100644 --- a/services/frontend/src/components/Updater/index.jsx +++ b/services/frontend/src/components/Updater/index.jsx @@ -26,7 +26,6 @@ export const Updater = () => { const updateSISMeta = () => apiCall('meta', '/updater/update/v2/meta', 'get') const updateSISStudents = () => apiCall('students', '/updater/update/v2/students', 'get') - const updateSISStudentsIndividually = () => apiCall('students', '/updater/update/v2/students_individually', 'get') const updateSISProgrammes = () => apiCall('curriculums', '/updater/update/v2/programmes') const updateSISCustomList = () => apiCall('custom list', `/updater/update/v2/customlist/${type}`, 'post', customList.trim().split('\n')) @@ -99,7 +98,6 @@ export const Updater = () => {