|
1 | 1 | package com.openelements.conduct.service; |
2 | 2 |
|
3 | 3 | import com.openelements.conduct.api.dto.AnalysisDto; |
4 | | -import com.openelements.conduct.api.dto.TrendSummaryDto; |
5 | 4 | import com.openelements.conduct.data.ViolationState; |
6 | 5 | import com.openelements.conduct.repository.ViolationReport; |
7 | 6 | import com.openelements.conduct.repository.ViolationReportRepository; |
@@ -114,23 +113,6 @@ public AnalysisDto generateAnalysis() { |
114 | 113 | ); |
115 | 114 | } |
116 | 115 |
|
117 | | - public TrendSummaryDto generateTrendSummary() { |
118 | | - AnalysisDto analysis = generateAnalysis(); |
119 | | - |
120 | | - String trend = determineTrend(analysis.generalGrowthOfChecksInPercentage()); |
121 | | - String description = String.format("General growth: %.1f%%, Violations growth: %.1f%%", |
122 | | - analysis.generalGrowthOfChecksInPercentage(), |
123 | | - analysis.growthOfViolationCountAgainstLastWeek()); |
124 | | - |
125 | | - return new TrendSummaryDto( |
126 | | - trend, |
127 | | - analysis.generalGrowthOfChecksInPercentage(), |
128 | | - description, |
129 | | - analysis.totalNoViolationCount() + analysis.totalPossibleViolationCount() + analysis.totalViolationCount(), |
130 | | - analysis.averageViolationCountPerDay() |
131 | | - ); |
132 | | - } |
133 | | - |
134 | 116 | private AnalysisDto createEmptyAnalysis() { |
135 | 117 | return new AnalysisDto( |
136 | 118 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, LocalDateTime.now() |
@@ -165,14 +147,4 @@ private double calculateGrowthPercentage(int oldValue, int newValue) { |
165 | 147 | } |
166 | 148 | return ((double) (newValue - oldValue) / oldValue) * 100.0; |
167 | 149 | } |
168 | | - |
169 | | - private String determineTrend(double growthPercentage) { |
170 | | - if (Math.abs(growthPercentage) < 10) { |
171 | | - return "STABLE"; |
172 | | - } else if (growthPercentage > 0) { |
173 | | - return "INCREASING"; |
174 | | - } else { |
175 | | - return "DECREASING"; |
176 | | - } |
177 | | - } |
178 | 150 | } |
0 commit comments