resolve conflicts and merge

This commit is contained in:
Lukas Barragan Torres 2023-05-05 11:02:18 +02:00
commit 13b9c0591f
38 changed files with 1291 additions and 64 deletions

View file

@ -0,0 +1,20 @@
package be.ugent.sel.studeez.data
import be.ugent.sel.studeez.data.local.models.task.Subject
import javax.inject.Inject
import javax.inject.Singleton
/**
* Used to communicate the selected subject from the subject overview other screens.
* Because this is a singleton-class the view-models of both screens observe the same data.
*/
@Singleton
class SelectedSubject @Inject constructor() {
private lateinit var subject: Subject
operator fun invoke() = subject
fun set(subject: Subject) {
this.subject = subject
}
fun isSet() = this::subject.isInitialized
}

View file

@ -0,0 +1,21 @@
package be.ugent.sel.studeez.data
import be.ugent.sel.studeez.data.local.models.task.Task
import javax.inject.Inject
import javax.inject.Singleton
/**
* Used to communicate the selected task from the task overview other screens.
* Because this is a singleton-class the view-models of both screens observe the same data.
*/
@Singleton
class SelectedTask @Inject constructor() {
private lateinit var task: Task
operator fun invoke() = task
fun set(task: Task) {
this.task = task
}
fun isSet() = this::task.isInitialized
}

View file

@ -7,4 +7,4 @@ data class SessionReport(
@DocumentId val id: String = "",
val studyTime: Int = 0,
val endTime: Timestamp = Timestamp(0, 0)
)
)

View file

@ -0,0 +1,10 @@
package be.ugent.sel.studeez.data.local.models.task
import com.google.firebase.firestore.DocumentId
data class Subject(
@DocumentId val id: String = "",
val name: String = "",
val time: Int = 0,
val argb_color: Long = 0,
)

View file

@ -0,0 +1,19 @@
package be.ugent.sel.studeez.data.local.models.task
import com.google.firebase.firestore.DocumentId
data class Task(
@DocumentId val id: String = "",
val name: String = "",
val completed: Boolean = false,
val time: Int = 0,
val subjectId: String = "",
)
object TaskDocument {
const val id = "id"
const val name = "name"
const val completed = "completed"
const val time = "time"
const val subjectId = "subjectId"
}

View file

@ -3,19 +3,19 @@ package be.ugent.sel.studeez.data.local.models.timer_functional
data class HoursMinutesSeconds(val hours: Int, val minutes: Int, val seconds: Int) {
constructor(sec: Int): this(
sec / (60 * 60),
(sec / (60)) % 60,
sec % 60
hours = sec / (60 * 60),
minutes = (sec / (60)) % 60,
seconds = sec % 60,
)
fun getTotalSeconds(): Int {
return hours * 60 * 60 + minutes * 60 + seconds
return (hours * 60 * 60) + (minutes * 60) + seconds
}
override fun toString(): String {
val hoursString = hours.toString().padStart(2, '0')
val minutesString = minutes.toString().padStart(2, '0')
val secondsString = seconds.toString().padStart(2, '0')
return "$hoursString : $minutesString : $secondsString"
return "$hoursString:$minutesString:$secondsString"
}
}

View file

@ -10,4 +10,4 @@ class Time(var time: Int) {
fun getAsHMS(): HoursMinutesSeconds {
return HoursMinutesSeconds(time)
}
}
}