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) => {
|
raPlaMiddlewareRouter.get('/', async (req: Request, res: Response) => {
|
||||||
try {
|
try {
|
||||||
|
logger.info('Starting transaction');
|
||||||
|
|
||||||
let user = (req.query.user ?? '').toString();
|
let user = (req.query.user ?? '').toString();
|
||||||
let file = (req.query.file ?? '').toString();
|
let file = (req.query.file ?? '').toString();
|
||||||
let blockers = (req.query.blockers ?? '').toString() === '1';
|
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.set({'Content-Disposition': 'attachment; filename=' + file + '.ics'});
|
||||||
res.status(200).send(resultingFile);
|
res.status(200).send(resultingFile);
|
||||||
|
|
||||||
|
logger.info('Stopping transaction');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
let errorGuid = Guid.create().toString();
|
let errorGuid = Guid.create().toString();
|
||||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
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;
|
let electiveToRemove = electiveModules;
|
||||||
electiveToRemove.splice(parseInt(chosenElective), 1);
|
electiveToRemove.splice(parseInt(chosenElective), 1);
|
||||||
|
|
||||||
|
logger.info('Chosen elective: ' + chosenElective);
|
||||||
|
logger.info(JSON.stringify(electiveToRemove));
|
||||||
|
|
||||||
ical.body.forEach((event) => {
|
ical.body.forEach((event) => {
|
||||||
let addEvent = true;
|
let addEvent = true;
|
||||||
electiveToRemove.forEach((module) => {
|
electiveToRemove.forEach((module) => {
|
||||||
if (event.includes(module.name)) {
|
if (event.includes(module.name)) {
|
||||||
logger.info('Removing elective ' + module.name);
|
|
||||||
addEvent = false;
|
addEvent = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -121,12 +123,14 @@ export const removeProfile = function (ical: iCalFile, chosenProfile: string): i
|
||||||
let profileToRemove = profileModules;
|
let profileToRemove = profileModules;
|
||||||
profileToRemove.splice(parseInt(chosenProfile), 1);
|
profileToRemove.splice(parseInt(chosenProfile), 1);
|
||||||
|
|
||||||
|
logger.info('Chosen profile: ' + chosenProfile);
|
||||||
|
logger.info(JSON.stringify(profileToRemove));
|
||||||
|
|
||||||
ical.body.forEach((event) => {
|
ical.body.forEach((event) => {
|
||||||
let addEvent = true;
|
let addEvent = true;
|
||||||
profileToRemove.forEach((module) => {
|
profileToRemove.forEach((module) => {
|
||||||
module.names.forEach((name) => {
|
module.names.forEach((name) => {
|
||||||
if (event.includes(name)) {
|
if (event.includes(name)) {
|
||||||
logger.info('Removing profile ' + name);
|
|
||||||
addEvent = false;
|
addEvent = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user