Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ subprojects {
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-data-mongodb")

implementation("com.wafflestudio.spring:spring-boot-starter-waffle:1.0.1")
implementation("com.wafflestudio.spring:spring-boot-starter-waffle:1.0.4")

testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("com.h2database:h2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,15 @@ class LectureService(
val semesterLecturesWithLecture =
semesterLectureRepository.findAllByLectureIdOrderByYearDescSemesterDesc(lectureId)
.ifEmpty { throw LectureNotFoundException }
.let { semesterLectures ->
val (year, nextSemester) = semesterUtils.getYearAndSemesterOfNextSemester()
semesterLectures.filterNot { it.year == year && it.semester == nextSemester.value }
}

val firstSemesterLectureWithLecture = semesterLecturesWithLecture.first()
val visibleSemesterLecturesWithLecture = semesterLecturesWithLecture.let { semesterLectures ->
val (year, nextSemester) = semesterUtils.getYearAndSemesterOfNextSemester()
semesterLectures.filterNot { it.year == year && it.semester == nextSemester.value }
}

val semesterLectureIds = semesterLecturesWithLecture.map { it.id!! }
val evaluations = lectureEvaluationRepository.findBySemesterLectureIdInAndUserIdAndIsHiddenFalse(
semesterLectureIds,
visibleSemesterLecturesWithLecture.map { it.id!! },
userId,
)

Expand All @@ -106,7 +105,7 @@ class LectureService(
academicYear = firstSemesterLectureWithLecture.academicYear,
category = firstSemesterLectureWithLecture.category,
classification = firstSemesterLectureWithLecture.classification,
semesterLectures = semesterLecturesWithLecture.map { semesterLecture ->
semesterLectures = visibleSemesterLecturesWithLecture.map { semesterLecture ->
genSemesterLectureDto(
semesterLecture,
evaluations.any { it.semesterLecture.id == semesterLecture.id },
Expand Down
36 changes: 24 additions & 12 deletions core/src/main/resources/application-core.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
spring.profiles.default: local
---

spring:
datasource:
url: jdbc:mysql://localhost:3306/snutt?serverTimezone=UTC
username: snutt
password: wafflestudio
flyway:
locations: classpath:/db
baseline-on-migrate: true
config:
activate:
on-profile: local
jpa:
hibernate:
ddl-auto: none
open-in-view: false
show-sql: true
properties:
hibernate:
Expand All @@ -23,15 +18,32 @@ spring:
default-ttl: 5m
repositories:
enabled: false
server:
port: 8080

logging:
config: classpath:logback/local.xml

secret-names: dev/snutt-ev

---

spring.config.activate.on-profile: test

spring:
datasource:
url: jdbc:h2:mem:testdb;MODE=MYSQL;DATABASE_TO_UPPER=false;DB_CLOSE_DELAY=-1;NON_KEYWORDS=year
flyway:
locations: classpath:/db
baseline-on-migrate: true
data:
redis:
host: localhost
timeout: 3s
default-ttl: 5m
repositories:
enabled: false
jpa:
hibernate:
ddl-auto: none

---

Expand Down
12 changes: 12 additions & 0 deletions core/src/main/resources/logback/local.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<statusListener class="ch.qos.logback.core.status.NopStatusListener" />

<include resource="org/springframework/boot/logging/logback/defaults.xml" />
<include resource="org/springframework/boot/logging/logback/file-appender.xml" />
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>

<root level="INFO">
<appender-ref ref="CONSOLE" />
</root>
</configuration>
Loading