diff --git a/src/main/kotlin/com/yourssu/soongpt/domain/timetable/business/dto/TimetableCourseResponse.kt b/src/main/kotlin/com/yourssu/soongpt/domain/timetable/business/dto/TimetableCourseResponse.kt index 524d3da..e03aeed 100644 --- a/src/main/kotlin/com/yourssu/soongpt/domain/timetable/business/dto/TimetableCourseResponse.kt +++ b/src/main/kotlin/com/yourssu/soongpt/domain/timetable/business/dto/TimetableCourseResponse.kt @@ -1,5 +1,6 @@ package com.yourssu.soongpt.domain.timetable.business.dto +import com.yourssu.soongpt.domain.course.implement.Classification import com.yourssu.soongpt.domain.course.implement.Course import com.yourssu.soongpt.domain.courseTime.business.dto.CourseTimeResponse import com.yourssu.soongpt.domain.courseTime.implement.CourseTime @@ -8,7 +9,7 @@ data class TimetableCourseResponse( val courseName: String, val professorName: String?, val classification: String, - val credit: Int, + val credit: Double, val courseTime: List, ) { companion object { @@ -17,9 +18,16 @@ data class TimetableCourseResponse( courseName = course.courseName, professorName = course.professorName, classification = course.classification.name, - credit = course.credit, + credit = course.credit.toDouble() + addCreditIfChapel(course.classification), courseTime = courseTimes.map { CourseTimeResponse.from(it) }, ) } + + private fun addCreditIfChapel(classification: Classification): Double { + if (classification == Classification.CHAPEL) { + return 0.5 + } + return 0.0 + } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/yourssu/soongpt/domain/timetable/business/dto/TimetableResponse.kt b/src/main/kotlin/com/yourssu/soongpt/domain/timetable/business/dto/TimetableResponse.kt index 502b381..39ef67e 100644 --- a/src/main/kotlin/com/yourssu/soongpt/domain/timetable/business/dto/TimetableResponse.kt +++ b/src/main/kotlin/com/yourssu/soongpt/domain/timetable/business/dto/TimetableResponse.kt @@ -6,7 +6,7 @@ data class TimetableResponse( val timetableId: Long, val tag: String, var score: Int?, - val totalCredit: Int, + val totalCredit: Double, val courses: List, ) { companion object { @@ -20,4 +20,4 @@ data class TimetableResponse( ) } } -} \ No newline at end of file +}