Skip to content

Commit

Permalink
refactor: Answer를 long 값으로 교체(#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
eun-seong committed Mar 8, 2024
1 parent 4f6d805 commit ba04562
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit ba04562

Please sign in to comment.