Properly removing all blockers now
Jenkins Production Deployment Details

This commit is contained in:
Patrick Müller 2021-10-13 13:29:40 +02:00
parent 2c2e8610c3
commit 978ac90f53
2 changed files with 11 additions and 9 deletions

View File

@ -13,8 +13,6 @@ 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';
@ -35,8 +33,6 @@ 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});

View File

@ -68,10 +68,8 @@ export const parseIcal = function (icalContents: string): iCalFile {
};
export const getDuration = function (event: string): number {
let startRegex: RegExp = /DTSTART.*?(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z?\r/gm; // Fix this, doesnt match \n but matching Z doesnt work all the time
let endRegex: RegExp = /DTEND.*?(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z?\r/gm; // s.o.
// localhost:3000/rapla-middleware?user=eisenbiegler&file=TINF19B4&blockers=0&wahl=4&pflicht=2
let startRegex: RegExp = /DTSTART.*?(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z?\r/gm;
let endRegex: RegExp = /DTEND.*?(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z?\r/gm;
let startMatch = startRegex.exec(event);
@ -105,7 +103,14 @@ export const getDuration = function (event: string): number {
let startDt = new Date(startDtYear, startDtMonth - 1, startDtDay, startDtHour, startDtMinute);
let endDt = new Date(endDtYear, endDtMonth - 1, endDtDay, endDtHour, endDtMinute);
return endDt.getHours() - startDt.getHours();
let hourDifference = endDt.getHours() - startDt.getHours();
let minuteDifference = 0;
if (hourDifference === 0) {
minuteDifference = endDt.getMinutes() - startDt.getMinutes();
}
return hourDifference + (minuteDifference / 60);
};
export const serializeIcal = function (ical: iCalFile): string {
@ -126,6 +131,7 @@ export const removeBlockers = function (ical: iCalFile): iCalFile {
!event.content.includes('SUMMARY:Beginn Theorie')
&& !event.content.includes('SUMMARY:Präsenz')
&& event.duration < 10
&& event.duration > 0.25
) {
remainingEvents.push(event);
}