use of org.eyeseetea.malariacare.presentation.factory.monitor.MonitorBuilder in project pictureapp by EyeSeeTea.
the class MonitorService method prepareMonitorData.
private void prepareMonitorData() {
Log.i(TAG, "Preparing monitor data...");
//Take last 6 months sent surveys in order to create monitor stats on top of them.
List<Survey> sentSurveysForMonitor = Survey.findSentSurveysAfterDate(TimePeriodCalculator.getInstance().getMinDateForMonitor());
Log.i(TAG, String.format("Found %d surveys to build monitor info, aggregating data...", sentSurveysForMonitor.size()));
MonitorBuilder monitorBuilder = new MonitorBuilder(getApplicationContext());
monitorBuilder.addSurveys(sentSurveysForMonitor);
//Since intents does NOT admit NON serializable as values we use Session instead
Log.i(TAG, String.format("Monitor data calculated ok", sentSurveysForMonitor.size()));
Session.putServiceValue(PREPARE_MONITOR_DATA, monitorBuilder);
LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(PREPARE_MONITOR_DATA));
}
Aggregations