API-28: Fixing a bug where an empty week in rapla would make the API return HTTP 500 instead of an empty list
All checks were successful
Jenkins Production Deployment

This commit is contained in:
Patrick Müller 2021-09-30 13:55:55 +02:00
parent 3fa133d4ec
commit 558d076537

View File

@ -25,6 +25,10 @@ export const getChanges = async (course: string, week: string): Promise<Event[]>
relevantEventIds.push(row.entry_id); relevantEventIds.push(row.entry_id);
}); });
if (relevantEventIds.length < 1) {
return [];
}
let rows = await conn.query('SELECT c.change_id, c.entry_id, c.change_timestamp, c.isDeleted, c.new_summary, c.new_description, c.new_start, c.new_last_modified, c.new_end, c.new_created, c.new_location, c.new_organizer, c.new_categories, e.uid FROM rapla_changes c LEFT OUTER JOIN rapla_entries e ON c.entry_id = e.entry_id WHERE c.entry_id IN (?) ORDER BY c.change_id', [relevantEventIds]); let rows = await conn.query('SELECT c.change_id, c.entry_id, c.change_timestamp, c.isDeleted, c.new_summary, c.new_description, c.new_start, c.new_last_modified, c.new_end, c.new_created, c.new_location, c.new_organizer, c.new_categories, e.uid FROM rapla_changes c LEFT OUTER JOIN rapla_entries e ON c.entry_id = e.entry_id WHERE c.entry_id IN (?) ORDER BY c.change_id', [relevantEventIds]);
let eventsMap = new Map(); let eventsMap = new Map();