From 1347c1fb64284d8dfbff3ea7876b918dd03ffbbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Sch=C3=BCtze?= Date: Sat, 13 Jul 2019 23:21:10 +0200 Subject: [PATCH] Fixed XLSX export for empty comments. --- .../services/motion-xlsx-export.service.ts | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/client/src/app/site/motions/services/motion-xlsx-export.service.ts b/client/src/app/site/motions/services/motion-xlsx-export.service.ts index 78b2348f6..c41d7acd2 100644 --- a/client/src/app/site/motions/services/motion-xlsx-export.service.ts +++ b/client/src/app/site/motions/services/motion-xlsx-export.service.ts @@ -114,7 +114,11 @@ export class MotionXlsxExportService { }; }) ); - columns.push(...comments.map(commentId => ({ header: this.commentRepo.getViewModel(commentId).getTitle() }))); + if (comments) { + columns.push( + ...comments.map(commentId => ({ header: this.commentRepo.getViewModel(commentId).getTitle() })) + ); + } worksheet.columns = columns; @@ -148,15 +152,17 @@ export class MotionXlsxExportService { } }) ); - data.push( - ...comments.map(commentId => { - const section = this.commentRepo.getViewModel(commentId); - const motionComment = motion.getCommentForSection(section); - return motionComment && motionComment.comment - ? reconvertChars(stripHtmlTags(motionComment.comment)) - : ''; - }) - ); + if (comments) { + data.push( + ...comments.map(commentId => { + const section = this.commentRepo.getViewModel(commentId); + const motionComment = motion.getCommentForSection(section); + return motionComment && motionComment.comment + ? reconvertChars(stripHtmlTags(motionComment.comment)) + : ''; + }) + ); + } return data; });