Skip to content

Commit 6ae8fc6

Browse files
authored
Merge pull request #137 from kjoon418/main
feat: `Task.hasFeedback` 조건 개선
2 parents 0564b25 + d2fa712 commit 6ae8fc6

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/main/kotlin/goodspace/bllsoneshot/entity/assignment/Comment.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ class Comment(
6363
val isRead: Boolean
6464
get() = readByMentee
6565

66+
@get:Transient
67+
val hasAnswer: Boolean
68+
get() = answer?.content != null
69+
6670
fun markAsRead() {
6771
readByMentee = true
6872
}

src/main/kotlin/goodspace/bllsoneshot/entity/assignment/Task.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,11 @@ class Task(
6969
fun hasProofShot(): Boolean =
7070
proofShots.isNotEmpty()
7171

72-
fun hasFeedback(): Boolean =
73-
proofShots.any { it.hasFeedback() }
72+
fun hasFeedback(): Boolean {
73+
return proofShots.any { it.hasFeedback() }
74+
|| generalComment?.content != null
75+
|| hasAnswer()
76+
}
7477

7578
fun hasReadAllFeedbacks(): Boolean {
7679
if (!hasFeedback()) return false
@@ -99,6 +102,9 @@ class Task(
99102
proofShots.forEach { it.clearTemporaryAnswers() }
100103
}
101104

105+
private fun hasAnswer(): Boolean =
106+
questions.any { it.hasAnswer }
107+
102108
companion object {
103109
private const val MINIMUM_ACTUAL_MINUTES = 0
104110
}

0 commit comments

Comments
 (0)