diff options
| author | Szymon Szukalski <szymon@skas.io> | 2024-07-25 20:54:41 +1000 |
|---|---|---|
| committer | Szymon Szukalski <szymon@skas.io> | 2024-07-25 20:54:41 +1000 |
| commit | cf4edfcb4bc7d0d02cefa861a95812315f092a66 (patch) | |
| tree | 5a3996a51a7ced388a6d7f4fa5c0d2a84124010e /src/main/java/com/stileeducation/markr/service/TestResultsService.java | |
| parent | aa9bdd514ab90d0da0391b879255a22c29450e9a (diff) | |
Removed unused variables and switch to constructor injection
Diffstat (limited to 'src/main/java/com/stileeducation/markr/service/TestResultsService.java')
| -rw-r--r-- | src/main/java/com/stileeducation/markr/service/TestResultsService.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/main/java/com/stileeducation/markr/service/TestResultsService.java b/src/main/java/com/stileeducation/markr/service/TestResultsService.java index 51efe95..0c0fa66 100644 --- a/src/main/java/com/stileeducation/markr/service/TestResultsService.java +++ b/src/main/java/com/stileeducation/markr/service/TestResultsService.java @@ -10,7 +10,6 @@ import com.stileeducation.markr.entity.TestResult; import com.stileeducation.markr.repository.TestResultRepository; import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation; import org.apache.commons.math3.stat.descriptive.rank.Percentile; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @@ -21,14 +20,17 @@ public class TestResultsService { public static final boolean IS_BIAS_CORRECTED = false; - @Autowired - private TestResultRepository testResultRepository; + private final TestResultRepository testResultRepository; - @Autowired - private StudentService studentService; + private final StudentService studentService; - @Autowired - private TestService testService; + private final TestService testService; + + public TestResultsService(TestResultRepository testResultRepository, StudentService studentService, TestService testService) { + this.testResultRepository = testResultRepository; + this.studentService = studentService; + this.testService = testService; + } public TestResult findOrCreateTestResult(Student student, Test test, Integer marksAwarded) { Optional<TestResult> optionalTestResult = testResultRepository.findByStudentAndTest(student, test); |
