From ba04562f58cfdf6441282af8c4d7ecf123be33b4 Mon Sep 17 00:00:00 2001 From: eun-seong Date: Thu, 7 Mar 2024 03:09:25 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20Answer=EB=A5=BC=20long=20=EA=B0=92?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EA=B5=90=EC=B2=B4(#114)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dnd/namuiwiki/domain/statistic/StatisticsService.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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);