From aacf1847a8b7b3168a3013eb84020791beb169fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9D=AC=EC=B0=AC?= <138795506+chanrhan@users.noreply.github.com> Date: Mon, 12 Jan 2026 19:07:09 +0900 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20=EC=A3=BC=EA=B0=84=20=EA=B2=B0?= =?UTF-8?q?=EA=B3=BC=20=EC=A0=95=EC=82=B0=20=EC=98=A4=EB=A5=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: ERROR 로그를 파일로 저장하도록 수정 * test: 테스트 코드 및 예외 처리 추가 * fix: getStreak 쿼리 올바르게 수정 * feat: 주말(토,일) 주간 패스 방지 추가 * feat: DateUtil에서 주의 시작을 월요일로 설정 * fix: updateStreak() 쿼리 기준값 변경 (toDate -> fromDate) * fix: 쿼리 오류 수정 * test: 수정 내역에 맞게 테스트 코드 수정 --------- Co-authored-by: chanrhan --- .github/workflows/ci.yml | 2 +- build.gradle | 12 +- gradle/libs.versions.toml | 3 + .../src/js/components/UserProgress.jsx | 10 +- .../com/baektracker/common/util/DateUtil.java | 7 +- .../domain/problem/model/BaekjoonProblem.java | 2 + .../domain/problem/model/SolvedProblem.java | 2 + .../SolvedProblemQueryRepository.java | 2 +- .../test/controller/TestController.java | 26 ++ .../baektracker/domain/user/model/User.java | 3 + .../weekly_result/model/WeeklyResult.java | 15 +- .../service/WeeklyResultService.java | 21 +- .../global/code/ApiResponseCode.java | 2 +- src/main/resources/application.yml | 3 + .../db/procedure/init_user_streak.sql | 2 + src/main/resources/logback-spring.xml | 22 +- .../resources/mapper/WeeklyResultMapper.xml | 27 +- .../BaektrackerApplicationTests.java | 7 +- .../baektracker/common/util/DateUtilTest.java | 18 ++ .../service/WeeklyResultServiceTest.java | 245 ++++++++++++++++++ 20 files changed, 381 insertions(+), 50 deletions(-) create mode 100644 src/main/java/com/baektracker/domain/test/controller/TestController.java rename src/test/java/com/baektracker/{hanco => }/BaektrackerApplicationTests.java (52%) create mode 100644 src/test/java/com/baektracker/common/util/DateUtilTest.java create mode 100644 src/test/java/com/baektracker/domain/weekly_result/service/WeeklyResultServiceTest.java diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee79c335..027089f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,4 +39,4 @@ jobs: run: chmod +x gradlew - name: Build (includes React build) - run: ./gradlew clean bootJar --no-daemon + run: ./gradlew clean build --no-daemon diff --git a/build.gradle b/build.gradle index ab95fdfd..02d8e48e 100644 --- a/build.gradle +++ b/build.gradle @@ -23,6 +23,12 @@ dependencies { implementation libs.org.mybatis.spring.boot.mybatis.spring.boot.starter runtimeOnly libs.org.springframework.boot.spring.boot.devtools + // Test + testImplementation libs.org.junit.jupiter.junit.jupiter + testImplementation libs.org.mockito.mockito.junit.jupiter + testImplementation libs.org.assertj.assertj.core + + // JPA implementation libs.org.springframework.boot.spring.boot.starter.data.jpa @@ -77,6 +83,10 @@ tasks.withType(Javadoc) { options.encoding = 'UTF-8' } +tasks.test { + useJUnitPlatform() +} + def frontendDir = "$projectDir/src/main/frontend" def querydslDir = layout.buildDirectory.dir("generated/querydsl").get().asFile def reactBuildDir = layout.buildDirectory.dir("frontend").get().asFile @@ -138,4 +148,4 @@ tasks.register('copyReactBuildFiles', Copy) { dependsOn "buildReact" from "$frontendDir/build" into reactBuildDir -} \ No newline at end of file +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1853abaa..5a6b9b7f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -42,3 +42,6 @@ org-springframework-boot-spring-boot-starter-tomcat = { module = "org.springfram org-springframework-boot-spring-boot-starter-web = { module = "org.springframework.boot:spring-boot-starter-web", version.ref = "org-springframework-boot-spring-boot-starter-web" } org-springframework-security-spring-security-test = { module = "org.springframework.security:spring-security-test", version.ref = "org-springframework-security-spring-security-test" } org-webjars-jquery = { module = "org.webjars:jquery", version.ref = "org-webjars-jquery" } +org-junit-jupiter-junit-jupiter = { module = "org.junit.jupiter:junit-jupiter" } +org-mockito-mockito-junit-jupiter = { module = "org.mockito:mockito-junit-jupiter" } +org-assertj-assertj-core = { module = "org.assertj:assertj-core" } diff --git a/src/main/frontend/src/js/components/UserProgress.jsx b/src/main/frontend/src/js/components/UserProgress.jsx index abfa326f..e3135aea 100644 --- a/src/main/frontend/src/js/components/UserProgress.jsx +++ b/src/main/frontend/src/js/components/UserProgress.jsx @@ -223,11 +223,11 @@ export function UserProgress({fromDate, toDate}) { {user.nickname} {isWeekPass ? 이번주 패스 : ''} - {user.weekPassCount > 0 && ( - - 🛡️{user.weekPassCount} - - )} + {/*{user.weekPassCount > 0 && (*/} + {/* */} + {/* 🛡️{user.weekPassCount}*/} + {/* */} + {/*)}*/}
) -} \ No newline at end of file +} diff --git a/src/main/frontend/src/js/setup/utils/DateUtils.js b/src/main/frontend/src/js/setup/utils/DateUtils.js index b9d035ef..a66c28f8 100644 --- a/src/main/frontend/src/js/setup/utils/DateUtils.js +++ b/src/main/frontend/src/js/setup/utils/DateUtils.js @@ -154,7 +154,7 @@ export const DateUtils = { if (orgMonth === 12 && (days) >= (totalDays - orgDate)) { date.setFullYear(date.getFullYear() + 1); - date.setMonth(1); + date.setMonth(0); date.setDate((days) - (totalDays - orgDate)); } else { date.setDate(orgDate + (days)); @@ -209,4 +209,4 @@ export const DateUtils = { newDate.setDate(newDate.getDate() + addOffset); return newDate; } -} \ No newline at end of file +}