This commit is contained in:
parent
50dfb4c94a
commit
0a336082ed
|
@ -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});
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user