use of ai.elimu.model.Contributor in project webapp by elimu-ai.
the class MailChimpScheduler method executeDataSync.
/**
* Sync data registered for existing subscribers.
*/
// 20 past every hour
@Scheduled(cron = "00 20 * * * *")
public synchronized void executeDataSync() {
logger.info("executeDataSync");
if (EnvironmentContextLoaderListener.env != Environment.PROD) {
return;
}
List<Contributor> contributors = contributorDao.readAll();
logger.info("contributors.size(): " + contributors.size());
for (Contributor contributor : contributors) {
try {
String memberInfo = MailChimpApiHelper.getMemberInfo(contributor.getEmail());
if (StringUtils.isNotBlank(memberInfo)) {
// Sync Contributor data with mailing list
MailChimpApiHelper.updateTeams(contributor.getEmail(), contributor.getTeams());
}
} catch (IOException ex) {
logger.error(null, ex);
break;
}
}
logger.info("executeDataSync complete");
}
use of ai.elimu.model.Contributor in project webapp by elimu-ai.
the class AdminProjectEditController method handleRequest.
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public String handleRequest(Model model, @PathVariable Long id) {
logger.info("handleRequest");
Project project = projectDao.read(id);
model.addAttribute("project", project);
List<Contributor> contributors = contributorDao.readAll();
model.addAttribute("managers", contributors);
return "admin/project/edit";
}
use of ai.elimu.model.Contributor in project webapp by elimu-ai.
the class ApplicationOpenedEventListController method handleRequest.
@RequestMapping(method = RequestMethod.GET)
public String handleRequest(Model model, HttpSession session) {
logger.info("handleRequest");
Contributor contributor = (Contributor) session.getAttribute("contributor");
// To ease development/testing, auto-generate events
if (EnvironmentContextLoaderListener.env != Environment.PROD) {
generateEvents(contributor.getLocale());
}
List<ApplicationOpenedEvent> applicationOpenedEvents = applicationOpenedEventDao.readAll(contributor.getLocale());
model.addAttribute("applicationOpenedEvents", applicationOpenedEvents);
return "analytics/application-opened-event/list";
}
use of ai.elimu.model.Contributor in project webapp by elimu-ai.
the class DeviceListController method handleRequest.
@RequestMapping(method = RequestMethod.GET)
public String handleRequest(Model model, HttpSession session) {
logger.info("handleRequest");
Contributor contributor = (Contributor) session.getAttribute("contributor");
List<Device> devices = deviceDao.readAll(contributor.getLocale());
model.addAttribute("devices", devices);
return "analytics/device/list";
}
use of ai.elimu.model.Contributor in project webapp by elimu-ai.
the class AllophoneListController method handleRequest.
@RequestMapping(method = RequestMethod.GET)
public String handleRequest(Model model, HttpSession session) {
logger.info("handleRequest");
Contributor contributor = (Contributor) session.getAttribute("contributor");
// To ease development/testing, auto-generate Allophones
List<Allophone> allophonesGenerated = generateAllophones(contributor.getLocale());
for (Allophone allophone : allophonesGenerated) {
logger.info("allophone.getValueIpa(): /" + allophone.getValueIpa() + "/, allophone.getValueSampa(): " + allophone.getValueSampa());
Allophone existingAllophone = allophoneDao.readByValueIpa(contributor.getLocale(), allophone.getValueIpa());
if (existingAllophone == null) {
allophoneDao.create(allophone);
}
}
List<Allophone> allophones = allophoneDao.readAllOrderedByUsage(contributor.getLocale());
model.addAttribute("allophones", allophones);
int maxUsageCount = 0;
for (Allophone allophone : allophones) {
if (allophone.getUsageCount() > maxUsageCount) {
maxUsageCount = allophone.getUsageCount();
}
}
model.addAttribute("maxUsageCount", maxUsageCount);
return "content/allophone/list";
}
Aggregations