Skip to content

Commit

Permalink
feat: 시간표 학점 반환시 채플은 0.5학점으로 계산하여 반환. 자료형 double로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
DWL21 committed Feb 16, 2025
1 parent 8abf053 commit 04ffe99
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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<CourseTimeResponse>,
) {
companion object {
Expand All @@ -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
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<TimetableCourseResponse>,
) {
companion object {
Expand All @@ -20,4 +20,4 @@ data class TimetableResponse(
)
}
}
}
}

0 comments on commit 04ffe99

Please sign in to comment.