summaryrefslogtreecommitdiff
path: root/src/main/java/com/stileeducation/markr/service
diff options
context:
space:
mode:
authorSzymon Szukalski <szymon@skas.io>2024-07-23 16:30:53 +1000
committerSzymon Szukalski <szymon@skas.io>2024-07-23 16:30:53 +1000
commit6f62cf9d52e1d5353be33f1fbf3429b0be456dc7 (patch)
tree682bb46d22e7d041ab7fa14041b1ff745bfc8e85 /src/main/java/com/stileeducation/markr/service
parentaec0dff5477cafce865410381a722fedbac04ac1 (diff)
Implement simple /results/:id/aggregate endpoint and test
Diffstat (limited to 'src/main/java/com/stileeducation/markr/service')
-rw-r--r--src/main/java/com/stileeducation/markr/service/TestResultsService.java3
-rw-r--r--src/main/java/com/stileeducation/markr/service/TestResultsServiceImpl.java16
2 files changed, 18 insertions, 1 deletions
diff --git a/src/main/java/com/stileeducation/markr/service/TestResultsService.java b/src/main/java/com/stileeducation/markr/service/TestResultsService.java
index 810cffa..2740e50 100644
--- a/src/main/java/com/stileeducation/markr/service/TestResultsService.java
+++ b/src/main/java/com/stileeducation/markr/service/TestResultsService.java
@@ -1,7 +1,10 @@
package com.stileeducation.markr.service;
+import com.stileeducation.markr.dto.AggregatedTestResultsDTO;
import com.stileeducation.markr.dto.MCQTestResultsDTO;
public interface TestResultsService {
MCQTestResultsDTO importTestResults(MCQTestResultsDTO mcqTestResults);
+
+ AggregatedTestResultsDTO aggregateTestResults(String testId);
}
diff --git a/src/main/java/com/stileeducation/markr/service/TestResultsServiceImpl.java b/src/main/java/com/stileeducation/markr/service/TestResultsServiceImpl.java
index 0d4cdc9..abb7f18 100644
--- a/src/main/java/com/stileeducation/markr/service/TestResultsServiceImpl.java
+++ b/src/main/java/com/stileeducation/markr/service/TestResultsServiceImpl.java
@@ -1,5 +1,6 @@
package com.stileeducation.markr.service;
+import com.stileeducation.markr.dto.AggregatedTestResultsDTO;
import com.stileeducation.markr.dto.MCQTestResultsDTO;
import org.springframework.stereotype.Service;
@@ -8,8 +9,21 @@ public class TestResultsServiceImpl implements TestResultsService {
@Override
public MCQTestResultsDTO importTestResults(MCQTestResultsDTO testResults) {
- System.out.println(testResults);
return testResults;
}
+ @Override
+ public AggregatedTestResultsDTO aggregateTestResults(String testId) {
+ AggregatedTestResultsDTO results = new AggregatedTestResultsDTO();
+ results.setMean(65.0);
+ results.setStddev(0.0);
+ results.setMin(65.0);
+ results.setMax(65.0);
+ results.setP25(65.0);
+ results.setP50(65.0);
+ results.setP75(65.0);
+ results.setCount(1);
+ return results;
+ }
+
} \ No newline at end of file