diff --git a/src/main/java/com/dnd/namuiwiki/domain/statistic/StatisticsService.java b/src/main/java/com/dnd/namuiwiki/domain/statistic/StatisticsService.java index 19be666..0e710c2 100644 --- a/src/main/java/com/dnd/namuiwiki/domain/statistic/StatisticsService.java +++ b/src/main/java/com/dnd/namuiwiki/domain/statistic/StatisticsService.java @@ -2,7 +2,6 @@ import com.dnd.namuiwiki.domain.question.entity.Question; import com.dnd.namuiwiki.domain.statistic.model.entity.PopulationStatistic; -import com.dnd.namuiwiki.domain.survey.model.entity.Answer; import com.dnd.namuiwiki.domain.survey.model.entity.Survey; import com.dnd.namuiwiki.domain.survey.type.Period; import com.dnd.namuiwiki.domain.survey.type.Relation; @@ -26,14 +25,12 @@ public void updateStatistics(Survey survey) { Question question = answer.getQuestion(); var calculationType = question.getDashboardType().getStatisticsCalculationType(); if (calculationType.isAverage()) { - updateAverageStatistic(question, period, relation, answer); + updateAverageStatistic(question, period, relation, answer.getAnswer(Long.class)); } }); } - private void updateAverageStatistic(Question question, Period period, Relation relation, Answer answer) { - long newValue = answer.getAnswer(Long.class); - + private void updateAverageStatistic(Question question, Period period, Relation relation, long newValue) { updateAverageStatisticByCategory(question, null, null, newValue); updateAverageStatisticByCategory(question, period, null, newValue); updateAverageStatisticByCategory(question, null, relation, newValue);