Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

PLF-5826: [Forum statistics gadget] Uncaught data error when there is no... #465

Open
wants to merge 1 commit into
base: stable/4.0.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;

import javax.jcr.Node;
Expand Down Expand Up @@ -95,6 +97,13 @@ public void start() {
if (!forumHome.hasNode(STATISTIC_WEEK_HOME)) {
Node statisticWeekHome = forumHome.addNode(STATISTIC_WEEK_HOME, "nt:unstructured");
session.save();
// Initiate the first Forum Weekly Statistic
ForumsWeeklyStatistic weeklyStatistic = new ForumsWeeklyStatistic();
weeklyStatistic.setStartDate(new Date());
weeklyStatistic.setLastStatEntry(new Date());
weeklyStatistic.setPostsCountOfWeek(getPostCountForumStatistic());
weeklyStatistic.setStartPostsCountOfWeek(getPostCountForumStatistic());
saveForumsWeeklyStatistic(weeklyStatistic);
}
} catch (Exception e) {
LOG.error("can not start ForumsWeeklyStatisticService", e);
Expand Down Expand Up @@ -250,5 +259,4 @@ public long getPostCountForumStatistic() throws Exception {
}
return 0;
}

}