From e39e22d7ccb77538f1e69e6450a025c305331912 Mon Sep 17 00:00:00 2001 From: "aj4941@naver.com" Date: Mon, 25 Sep 2023 13:16:21 +0900 Subject: [PATCH] =?UTF-8?q?:pencil2:=20[FIX]=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=EC=B6=94=EC=B6=9C=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../testInfo/dataloader/DataLoader.java | 24 +++++++++---------- .../testStart/service/GetProblemsService.java | 2 ++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/java/swm_nm/morandi/domain/testInfo/dataloader/DataLoader.java b/src/main/java/swm_nm/morandi/domain/testInfo/dataloader/DataLoader.java index 944f8730..a61c3175 100644 --- a/src/main/java/swm_nm/morandi/domain/testInfo/dataloader/DataLoader.java +++ b/src/main/java/swm_nm/morandi/domain/testInfo/dataloader/DataLoader.java @@ -264,10 +264,10 @@ private void insertTestTypeData() { // PK 13번 : 브론즈 랜덤 디펜스 List difficultyRanges13 = new ArrayList<>(); - difficultyRanges13.add(new DifficultyRange(DifficultyLevel.B4, DifficultyLevel.B3)); - difficultyRanges13.add(new DifficultyRange(DifficultyLevel.B3, DifficultyLevel.B2)); - difficultyRanges13.add(new DifficultyRange(DifficultyLevel.B2, DifficultyLevel.B1)); - difficultyRanges13.add(new DifficultyRange(DifficultyLevel.B2, DifficultyLevel.B1)); + difficultyRanges13.add(new DifficultyRange(DifficultyLevel.B4, DifficultyLevel.B1)); + difficultyRanges13.add(new DifficultyRange(DifficultyLevel.B4, DifficultyLevel.B2)); + difficultyRanges13.add(new DifficultyRange(DifficultyLevel.B4, DifficultyLevel.B1)); + difficultyRanges13.add(new DifficultyRange(DifficultyLevel.B4, DifficultyLevel.B1)); TestType testType13 = TestType.builder() .testTypename("브론즈 랜덤 디펜스") @@ -284,10 +284,10 @@ private void insertTestTypeData() { // PK 14번 : 실버 랜덤 디펜스 List difficultyRanges14 = new ArrayList<>(); - difficultyRanges14.add(new DifficultyRange(DifficultyLevel.S5, DifficultyLevel.S4)); - difficultyRanges14.add(new DifficultyRange(DifficultyLevel.S4, DifficultyLevel.S3)); - difficultyRanges14.add(new DifficultyRange(DifficultyLevel.S3, DifficultyLevel.S2)); - difficultyRanges14.add(new DifficultyRange(DifficultyLevel.S2, DifficultyLevel.S1)); + difficultyRanges14.add(new DifficultyRange(DifficultyLevel.S5, DifficultyLevel.S1)); + difficultyRanges14.add(new DifficultyRange(DifficultyLevel.S5, DifficultyLevel.S1)); + difficultyRanges14.add(new DifficultyRange(DifficultyLevel.S5, DifficultyLevel.S1)); + difficultyRanges14.add(new DifficultyRange(DifficultyLevel.S5, DifficultyLevel.S1)); TestType testType14 = TestType.builder() .testTypename("실버 랜덤 디펜스") @@ -304,10 +304,10 @@ private void insertTestTypeData() { // PK 15번 : 골드 랜덤 디펜스 List difficultyRanges15 = new ArrayList<>(); - difficultyRanges15.add(new DifficultyRange(DifficultyLevel.G5, DifficultyLevel.G4)); - difficultyRanges15.add(new DifficultyRange(DifficultyLevel.G4, DifficultyLevel.G3)); - difficultyRanges15.add(new DifficultyRange(DifficultyLevel.G3, DifficultyLevel.G2)); - difficultyRanges15.add(new DifficultyRange(DifficultyLevel.G2, DifficultyLevel.G1)); + difficultyRanges15.add(new DifficultyRange(DifficultyLevel.G5, DifficultyLevel.G1)); + difficultyRanges15.add(new DifficultyRange(DifficultyLevel.G5, DifficultyLevel.G1)); + difficultyRanges15.add(new DifficultyRange(DifficultyLevel.G5, DifficultyLevel.G1)); + difficultyRanges15.add(new DifficultyRange(DifficultyLevel.G5, DifficultyLevel.G1)); TestType testType15 = TestType.builder() .testTypename("골드 랜덤 디펜스") diff --git a/src/main/java/swm_nm/morandi/domain/testStart/service/GetProblemsService.java b/src/main/java/swm_nm/morandi/domain/testStart/service/GetProblemsService.java index 8e4b40bd..82db7f7e 100644 --- a/src/main/java/swm_nm/morandi/domain/testStart/service/GetProblemsService.java +++ b/src/main/java/swm_nm/morandi/domain/testStart/service/GetProblemsService.java @@ -36,6 +36,7 @@ public void getProblemsByTestType(TestType testType, List bojProblem List difficultyRanges = testType.getDifficultyRanges(); long index = 1; for (DifficultyRange difficultyRange : difficultyRanges) { + if (bojProblems.size() >= testType.getProblemCount()) break; int start = DifficultyLevel.getLevelByValue(difficultyRange.getStart()); int end = DifficultyLevel.getLevelByValue(difficultyRange.getEnd()); boolean flag = false; @@ -67,6 +68,7 @@ public void getProblemsByApi(TestType testType, String bojId, List b List difficultyRanges = testType.getDifficultyRanges(); long index = 1; for (DifficultyRange difficultyRange : difficultyRanges) { + if (bojProblems.size() >= testType.getProblemCount()) break; if (bojProblems.get((int) (index - 1)).getProblemId() != 0) { index++; continue;