diff --git a/src/models/rapla-middleware/RaPlaMiddleware.router.ts b/src/models/rapla-middleware/RaPlaMiddleware.router.ts index f9e47b2..5b73741 100644 --- a/src/models/rapla-middleware/RaPlaMiddleware.router.ts +++ b/src/models/rapla-middleware/RaPlaMiddleware.router.ts @@ -13,6 +13,8 @@ export const raPlaMiddlewareRouter = express.Router(); raPlaMiddlewareRouter.get('/', async (req: Request, res: Response) => { try { + logger.info('Starting transaction'); + let user = (req.query.user ?? '').toString(); let file = (req.query.file ?? '').toString(); let blockers = (req.query.blockers ?? '').toString() === '1'; @@ -33,6 +35,8 @@ raPlaMiddlewareRouter.get('/', async (req: Request, res: Response) => { res.set({'Content-Disposition': 'attachment; filename=' + file + '.ics'}); res.status(200).send(resultingFile); + + logger.info('Stopping transaction'); } catch (e) { let errorGuid = Guid.create().toString(); logger.error('Error handling a request: ' + e.message, {reference: errorGuid}); diff --git a/src/models/rapla-middleware/icalgenerator/icalgenerator.service.ts b/src/models/rapla-middleware/icalgenerator/icalgenerator.service.ts index c01ff0a..6e9c5a7 100644 --- a/src/models/rapla-middleware/icalgenerator/icalgenerator.service.ts +++ b/src/models/rapla-middleware/icalgenerator/icalgenerator.service.ts @@ -96,11 +96,13 @@ export const removeElective = function (ical: iCalFile, chosenElective: string): let electiveToRemove = electiveModules; electiveToRemove.splice(parseInt(chosenElective), 1); + logger.info('Chosen elective: ' + chosenElective); + logger.info(JSON.stringify(electiveToRemove)); + ical.body.forEach((event) => { let addEvent = true; electiveToRemove.forEach((module) => { if (event.includes(module.name)) { - logger.info('Removing elective ' + module.name); addEvent = false; } }); @@ -121,12 +123,14 @@ export const removeProfile = function (ical: iCalFile, chosenProfile: string): i let profileToRemove = profileModules; profileToRemove.splice(parseInt(chosenProfile), 1); + logger.info('Chosen profile: ' + chosenProfile); + logger.info(JSON.stringify(profileToRemove)); + ical.body.forEach((event) => { let addEvent = true; profileToRemove.forEach((module) => { module.names.forEach((name) => { if (event.includes(name)) { - logger.info('Removing profile ' + name); addEvent = false; } });