From 27024a95f183a78a65920537af8cbf4242184b89 Mon Sep 17 00:00:00 2001 From: leegunwoo Date: Mon, 18 May 2026 08:52:35 +0900 Subject: [PATCH] =?UTF-8?q?refactor(#399)=20:=20otherRegionCount=EB=A5=BC?= =?UTF-8?q?=20=EC=A7=80=EC=97=AD=EB=B3=80=EC=88=98=EB=A1=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/SelectSecondPassUseCase.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/bamdoliro/maru/application/form/SelectSecondPassUseCase.java b/src/main/java/com/bamdoliro/maru/application/form/SelectSecondPassUseCase.java index bd377dbc..e0255b30 100644 --- a/src/main/java/com/bamdoliro/maru/application/form/SelectSecondPassUseCase.java +++ b/src/main/java/com/bamdoliro/maru/application/form/SelectSecondPassUseCase.java @@ -21,12 +21,13 @@ public class SelectSecondPassUseCase { private final FormRepository formRepository; private final CalculateFormScoreService calculateFormScoreService; - private final AtomicInteger otherRegionCount = new AtomicInteger((int) Math.ceil(FixedNumber.TOTAL * FixedNumber.OTHER_REGION_RATE)); @Transactional public void execute() { validate(); + AtomicInteger otherRegionCount = new AtomicInteger((int) Math.ceil(FixedNumber.TOTAL * FixedNumber.OTHER_REGION_RATE)); + int regularCount = FixedNumber.REGULAR; int meisterTalentCount = FixedNumber.MEISTER_TALENT; int socialIntegrationCount = FixedNumber.SOCIAL_INTEGRATION; @@ -54,25 +55,25 @@ public void execute() { int equalOpportunityCount = (int) Math.round(socialIntegrationCount * 0.5); int societyDiversityCount = equalOpportunityCount; - processForms(equalOpportunityFormList, equalOpportunityCount, this::changeToRegularAndCalculateScoreAgain); - processForms(societyDiversityFormList, societyDiversityCount, this::changeToRegularAndCalculateScoreAgain); - processForms(meisterTalentFormList, meisterTalentCount, this::changeToRegularAndCalculateScoreAgain); + processForms(equalOpportunityFormList, equalOpportunityCount, this::changeToRegularAndCalculateScoreAgain, otherRegionCount); + processForms(societyDiversityFormList, societyDiversityCount, this::changeToRegularAndCalculateScoreAgain, otherRegionCount); + processForms(meisterTalentFormList, meisterTalentCount, this::changeToRegularAndCalculateScoreAgain,otherRegionCount); formRepository.flush(); List
regularFormList = formRepository.findFirstPassedRegularForm(); - processForms(regularFormList, regularCount, Form::fail); + processForms(regularFormList, regularCount, Form::fail, otherRegionCount); formRepository.flush(); List supernumeraryFormList = formRepository.findFirstPassedSupernumeraryForm(); List nationalVeteransEducationFormList = classifyFormsByType(supernumeraryFormList, FormType::isNationalVeteransEducation); List specialAdmissionFormList = classifyFormsByType(supernumeraryFormList, FormType::isSpecialAdmission); - processForms(nationalVeteransEducationFormList, nationalVeteransEducationCount, Form::fail); - processForms(specialAdmissionFormList, specialAdmissionCount, Form::fail); + processForms(nationalVeteransEducationFormList, nationalVeteransEducationCount, Form::fail, otherRegionCount); + processForms(specialAdmissionFormList, specialAdmissionCount, Form::fail, otherRegionCount); } - private void processForms(List formList, int count, Consumer action) { + private void processForms(List formList, int count, Consumer action, AtomicInteger otherRegionCount) { for (Form form : formList) { if (count > 0) { if (form.getEducation().getSchool().isBusan()) {