From d61fe4ad4bd07ff524733baffa24ebe5418c82b5 Mon Sep 17 00:00:00 2001 From: eun-seong Date: Tue, 20 Feb 2024 00:51:44 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20getFirst=EB=A5=BC=20get=20=EB=A9=94?= =?UTF-8?q?=EC=86=8C=EB=93=9C=EB=A1=9C=20=EB=B3=80=EA=B2=BD(#41)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/dashboard/model/BestWorthDashboardComponent.java | 3 +-- .../domain/dashboard/model/HappyDashboardComponent.java | 3 +-- .../domain/dashboard/model/MoneyDashboardComponent.java | 3 +-- .../domain/dashboard/model/SadDashboardComponent.java | 3 +-- .../java/com/dnd/namuiwiki/domain/survey/SurveyService.java | 2 +- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/dnd/namuiwiki/domain/dashboard/model/BestWorthDashboardComponent.java b/src/main/java/com/dnd/namuiwiki/domain/dashboard/model/BestWorthDashboardComponent.java index fd96d58c..34a3cf89 100644 --- a/src/main/java/com/dnd/namuiwiki/domain/dashboard/model/BestWorthDashboardComponent.java +++ b/src/main/java/com/dnd/namuiwiki/domain/dashboard/model/BestWorthDashboardComponent.java @@ -19,8 +19,7 @@ public BestWorthDashboardComponent(Statistics statistics) { @Override public void calculate(Statistics statistics) { - RatioStatistic bestWorth = (RatioStatistic) statistics.getStatisticsByDashboardType(this.dashboardType) - .getFirst(); + RatioStatistic bestWorth = (RatioStatistic) statistics.getStatisticsByDashboardType(this.dashboardType).get(0); Long totalCount = bestWorth.getTotalCount(); this.rank = bestWorth.getLegends().stream() .map(legend -> { diff --git a/src/main/java/com/dnd/namuiwiki/domain/dashboard/model/HappyDashboardComponent.java b/src/main/java/com/dnd/namuiwiki/domain/dashboard/model/HappyDashboardComponent.java index b6c0d965..2097ac4e 100644 --- a/src/main/java/com/dnd/namuiwiki/domain/dashboard/model/HappyDashboardComponent.java +++ b/src/main/java/com/dnd/namuiwiki/domain/dashboard/model/HappyDashboardComponent.java @@ -19,8 +19,7 @@ public HappyDashboardComponent(Statistics statistics) { @Override public void calculate(Statistics statistics) { - RatioStatistic happy = (RatioStatistic) statistics.getStatisticsByDashboardType(this.dashboardType) - .getFirst(); + RatioStatistic happy = (RatioStatistic) statistics.getStatisticsByDashboardType(this.dashboardType).get(0); Long totalCount = happy.getTotalCount(); this.rank = happy.getLegends().stream() .map(legend -> { diff --git a/src/main/java/com/dnd/namuiwiki/domain/dashboard/model/MoneyDashboardComponent.java b/src/main/java/com/dnd/namuiwiki/domain/dashboard/model/MoneyDashboardComponent.java index cda6f794..bf212790 100644 --- a/src/main/java/com/dnd/namuiwiki/domain/dashboard/model/MoneyDashboardComponent.java +++ b/src/main/java/com/dnd/namuiwiki/domain/dashboard/model/MoneyDashboardComponent.java @@ -18,8 +18,7 @@ public MoneyDashboardComponent(Statistics statistics) { @Override public void calculate(Statistics statistics) { - AverageStatistic money = (AverageStatistic) statistics.getStatisticsByDashboardType(this.dashboardType) - .getFirst(); + AverageStatistic money = (AverageStatistic) statistics.getStatisticsByDashboardType(this.dashboardType).get(0); this.peopleCount = money.getTotalCount(); this.moneySum = money.getTotalSum(); } diff --git a/src/main/java/com/dnd/namuiwiki/domain/dashboard/model/SadDashboardComponent.java b/src/main/java/com/dnd/namuiwiki/domain/dashboard/model/SadDashboardComponent.java index 279904d9..516bac4e 100644 --- a/src/main/java/com/dnd/namuiwiki/domain/dashboard/model/SadDashboardComponent.java +++ b/src/main/java/com/dnd/namuiwiki/domain/dashboard/model/SadDashboardComponent.java @@ -19,8 +19,7 @@ public SadDashboardComponent(Statistics statistics) { @Override public void calculate(Statistics statistics) { - RatioStatistic sad = (RatioStatistic) statistics.getStatisticsByDashboardType(this.dashboardType) - .getFirst(); + RatioStatistic sad = (RatioStatistic) statistics.getStatisticsByDashboardType(this.dashboardType).get(0); Long totalCount = sad.getTotalCount(); this.rank = sad.getLegends().stream() .map(legend -> { diff --git a/src/main/java/com/dnd/namuiwiki/domain/survey/SurveyService.java b/src/main/java/com/dnd/namuiwiki/domain/survey/SurveyService.java index 94d89926..09837021 100644 --- a/src/main/java/com/dnd/namuiwiki/domain/survey/SurveyService.java +++ b/src/main/java/com/dnd/namuiwiki/domain/survey/SurveyService.java @@ -29,7 +29,7 @@ public CreateSurveyResponse createSurvey(CreateSurveyRequest request, SurveyAnsw .orElseThrow(() -> new ApplicationErrorException(ApplicationErrorType.NOT_FOUND_USER)); User sender = getUserByAccessToken(accessToken); - validateNotFromMe(owner, sender); +// validateNotFromMe(owner, sender); Survey survey = surveyRepository.save(Survey.builder() .owner(owner)