-
-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathMainAnalyticsController.java
More file actions
61 lines (45 loc) · 2.28 KB
/
MainAnalyticsController.java
File metadata and controls
61 lines (45 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package ai.elimu.web.analytics;
import ai.elimu.dao.LetterSoundAssessmentEventDao;
import ai.elimu.dao.LetterSoundLearningEventDao;
import ai.elimu.dao.NumberLearningEventDao;
import ai.elimu.dao.StoryBookLearningEventDao;
import ai.elimu.dao.StudentDao;
import ai.elimu.dao.VideoLearningEventDao;
import ai.elimu.dao.WordAssessmentEventDao;
import ai.elimu.dao.WordLearningEventDao;
import ai.elimu.model.v2.enums.analytics.research.ResearchExperiment;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/analytics")
@RequiredArgsConstructor
@Slf4j
public class MainAnalyticsController {
private final StudentDao studentDao;
private final LetterSoundAssessmentEventDao letterSoundAssessmentEventDao;
private final LetterSoundLearningEventDao letterSoundLearningEventDao;
private final WordAssessmentEventDao wordAssessmentEventDao;
private final WordLearningEventDao wordLearningEventDao;
private final NumberLearningEventDao numberLearningEventDao;
private final StoryBookLearningEventDao storyBookLearningEventDao;
private final VideoLearningEventDao videoLearningEventDao;
@GetMapping
public String handleRequest(Model model) {
log.info("handleRequest");
model.addAttribute("studentCount", studentDao.readCount());
model.addAttribute("researchExperimentCount", ResearchExperiment.values().length);
model.addAttribute("letterSoundAssessmentEventCount", letterSoundAssessmentEventDao.readCount());
model.addAttribute("letterSoundLearningEventCount", letterSoundLearningEventDao.readCount());
model.addAttribute("wordAssessmentEventCount", wordAssessmentEventDao.readCount());
model.addAttribute("wordLearningEventCount", wordLearningEventDao.readCount());
// TODO: number assessment events
model.addAttribute("numberLearningEventCount", numberLearningEventDao.readCount());
model.addAttribute("storyBookLearningEventCount", storyBookLearningEventDao.readCount());
model.addAttribute("videoLearningEventCount", videoLearningEventDao.readCount());
return "analytics/main";
}
}