From db8ae28537d433b530802a9bbd50b94b6ac41e89 Mon Sep 17 00:00:00 2001 From: "Jo G." <1451036+jo-elimu@users.noreply.github.com> Date: Mon, 26 Aug 2024 13:55:50 +0700 Subject: [PATCH] Update src/main/java/ai/elimu/web/analytics/StoryBookLearningEventCsvExportController.java Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- ...oryBookLearningEventCsvExportController.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/ai/elimu/web/analytics/StoryBookLearningEventCsvExportController.java b/src/main/java/ai/elimu/web/analytics/StoryBookLearningEventCsvExportController.java index f878848a4..a792c0479 100644 --- a/src/main/java/ai/elimu/web/analytics/StoryBookLearningEventCsvExportController.java +++ b/src/main/java/ai/elimu/web/analytics/StoryBookLearningEventCsvExportController.java @@ -65,7 +65,22 @@ public void handleRequest( ); csvPrinter.flush(); - csvPrinter.close(); + for (StoryBookLearningEvent storyBookLearningEvent : storyBookLearningEvents) { + logger.info("storyBookLearningEvent.getId(): " + storyBookLearningEvent.getId()); + + csvPrinter.printRecord( + storyBookLearningEvent.getId(), + storyBookLearningEvent.getTimestamp().getTimeInMillis(), + storyBookLearningEvent.getAndroidId(), + storyBookLearningEvent.getPackageName(), + (storyBookLearningEvent.getStoryBook() == null) ? null : storyBookLearningEvent.getStoryBook().getId(), + storyBookLearningEvent.getStoryBookTitle(), + storyBookLearningEvent.getLearningEventType() + ); + + csvPrinter.flush(); + } + csvPrinter.close(); } String csvFileContent = stringWriter.toString();