dateClause.append(" and (week=:fromDate or week>=:fromDate) ");
}
if (toDate!=null) {
dateClause.append(" and (week=:toDate or week<=:toDate) ");
}
DBQuery dbQuery = DBFactory.getInstance().createQuery("select businessPath,week,value from org.olat.course.statistic.weekly.WeeklyStat sv "
+ "where sv.resId=:resId "
+ dateClause);
dbQuery.setLong("resId", courseRepositoryEntryKey);
StringBuffer infoMsg = new StringBuffer();
if (fromDate!=null) {
String fromDateStr = getYear(fromDate)+"-"+getWeek(fromDate);
infoMsg.append("from date: "+fromDateStr);
dbQuery.setString("fromDate", fromDateStr);
}
if (toDate!=null) {
String toDateStr = getYear(toDate)+"-"+getWeek(toDate);
if (infoMsg!=null) {
infoMsg.append(", ");
}
infoMsg.append("to date: "+toDateStr);
dbQuery.setString("toDate", toDateStr);
}
log_.info("generateStatisticResult: Searching with params "+infoMsg.toString());
StatisticResult statisticResult = new StatisticResult(course, dbQuery.list());
fillGapsInColumnHeaders(statisticResult);
return statisticResult;
}