private ReportResult generateReport(Path userCsvFolder, Profile profile,
DashBoard dash, long now) throws Exception {
int fetchCount = (int) report.reportType.getFetchCount(report.granularityType);
long startFrom = now - TimeUnit.DAYS.toMillis(report.reportType.getDuration());
startFrom = (startFrom / report.granularityType.period) * report.granularityType.period;
Path output = Paths.get(userCsvFolder.toString() + ".zip");
boolean hasData = generateReport(output, profile, dash, fetchCount, startFrom);
if (hasData) {
sendEmail(output);
return ReportResult.OK;
}
log.info("No data for report for user {} and reportId {}.", key.user.email, report.id);
return ReportResult.NO_DATA;
}