sessionreport now has the id of the task
This commit is contained in:
parent
1eff33a6db
commit
45f28592ab
3 changed files with 7 additions and 4 deletions
|
@ -6,5 +6,6 @@ import com.google.firebase.firestore.DocumentId
|
|||
data class SessionReport(
|
||||
@DocumentId val id: String = "",
|
||||
val studyTime: Int = 0,
|
||||
val endTime: Timestamp = Timestamp(0, 0)
|
||||
val endTime: Timestamp = Timestamp(0, 0),
|
||||
val taskId: String
|
||||
)
|
|
@ -2,6 +2,7 @@ package be.ugent.sel.studeez.data.local.models.timer_functional
|
|||
|
||||
import be.ugent.sel.studeez.data.local.models.SessionReport
|
||||
import com.google.firebase.Timestamp
|
||||
import com.google.firebase.firestore.DocumentReference
|
||||
|
||||
abstract class FunctionalTimer(initialValue: Int) {
|
||||
var time: Time = Time(initialValue)
|
||||
|
@ -17,10 +18,11 @@ abstract class FunctionalTimer(initialValue: Int) {
|
|||
|
||||
abstract fun hasCurrentCountdownEnded(): Boolean
|
||||
|
||||
fun getSessionReport(): SessionReport {
|
||||
fun getSessionReport(taskId: String): SessionReport {
|
||||
return SessionReport(
|
||||
studyTime = totalStudyTime,
|
||||
endTime = Timestamp.now()
|
||||
endTime = Timestamp.now(),
|
||||
taskId = taskId
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class SessionViewModel @Inject constructor(
|
|||
}
|
||||
|
||||
fun endSession(openAndPopUp: (String, String) -> Unit) {
|
||||
sessionReportState.sessionReport = getTimer().getSessionReport()
|
||||
sessionReportState.sessionReport = getTimer().getSessionReport(task.id)
|
||||
openAndPopUp(StudeezDestinations.SESSION_RECAP, StudeezDestinations.SESSION_SCREEN)
|
||||
}
|
||||
}
|
Reference in a new issue