fix mergeconflict when merging tasksoverview

This commit is contained in:
brreynie 2023-05-04 22:12:08 +02:00
commit e2ada0b9d4
67 changed files with 1833 additions and 281 deletions

View file

@ -0,0 +1,11 @@
package be.ugent.sel.studeez.data
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalTimer
import be.ugent.sel.studeez.data.local.models.timer_info.TimerInfo
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class EditTimerState @Inject constructor(){
lateinit var timerInfo: TimerInfo
}

View file

@ -1,14 +1,10 @@
package be.ugent.sel.studeez.data.local.models.timer_functional
import be.ugent.sel.studeez.data.local.models.SessionReport
import be.ugent.sel.studeez.screens.session.sessionScreens.CustomSessionScreen
import be.ugent.sel.studeez.screens.session.sessionScreens.AbstractSessionScreen
class FunctionalCustomTimer(studyTime: Int) : FunctionalTimer(studyTime) {
override fun tick() {
if (!hasEnded()) {
time.minOne()
time--
totalStudyTime++
}
}

View file

@ -11,7 +11,7 @@ class FunctionalEndlessTimer : FunctionalTimer(0) {
}
override fun tick() {
time.plusOne()
time++
totalStudyTime++
}

View file

@ -1,8 +1,5 @@
package be.ugent.sel.studeez.data.local.models.timer_functional
import be.ugent.sel.studeez.screens.session.sessionScreens.BreakSessionScreen
import be.ugent.sel.studeez.screens.session.sessionScreens.AbstractSessionScreen
class FunctionalPomodoroTimer(
private var studyTime: Int,
private var breakTime: Int, repeats: Int
@ -25,7 +22,7 @@ class FunctionalPomodoroTimer(
}
isInBreak = !isInBreak
}
time.minOne()
time--
if (!isInBreak) {
totalStudyTime++

View file

@ -1,11 +1,10 @@
package be.ugent.sel.studeez.data.local.models.timer_functional
import be.ugent.sel.studeez.data.local.models.SessionReport
import be.ugent.sel.studeez.screens.session.sessionScreens.AbstractSessionScreen
import com.google.firebase.Timestamp
abstract class FunctionalTimer(initialValue: Int) {
val time: Time = Time(initialValue)
var time: Time = Time(initialValue)
var totalStudyTime: Int = 0
fun getHoursMinutesSeconds(): HoursMinutesSeconds {

View file

@ -1,17 +1,21 @@
package be.ugent.sel.studeez.data.local.models.timer_functional
class HoursMinutesSeconds(val hours: Int, val minutes: Int, val seconds: Int) {
constructor(seconds: Int) : this(
hours = seconds / (60 * 60),
minutes = (seconds / 60) % 60,
seconds = seconds % 60,
data class HoursMinutesSeconds(val hours: Int, val minutes: Int, val seconds: Int) {
constructor(sec: Int): this(
hours = sec / (60 * 60),
minutes = (sec / (60)) % 60,
seconds = sec % 60,
)
fun getTotalSeconds(): Int {
return (hours * 60 * 60) + (minutes * 60) + seconds
}
override fun toString(): String {
return hours.toString().padStart(2, '0') +
":" +
minutes.toString().padStart(2, '0') +
":" +
seconds.toString().padStart(2, '0')
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"
}
}

View file

@ -1,16 +1,11 @@
package be.ugent.sel.studeez.data.local.models.timer_functional
class Time(initialTime: Int) {
class Time(var time: Int) {
operator fun invoke() = time
var time = initialTime
operator fun inc(): Time = Time(time + 1)
fun minOne() {
time--
}
fun plusOne() {
time++
}
operator fun dec(): Time = Time(time - 1)
fun getAsHMS(): HoursMinutesSeconds {
return HoursMinutesSeconds(time)

View file

@ -6,11 +6,10 @@ import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalTimer
class CustomTimerInfo(
name: String,
description: String,
private val studyTime: Int,
var studyTime: Int,
id: String = ""
): TimerInfo(id, name, description) {
override fun getFunctionalTimer(): FunctionalTimer {
return FunctionalCustomTimer(studyTime)
}
@ -24,4 +23,8 @@ class CustomTimerInfo(
)
}
override fun <T> accept(visitor: TimerInfoVisitor<T>): T {
return visitor.visitCustomTimerInfo(this)
}
}

View file

@ -22,4 +22,8 @@ class EndlessTimerInfo(
)
}
override fun <T> accept(visitor: TimerInfoVisitor<T>): T {
return visitor.visitEndlessTimerInfo(this)
}
}

View file

@ -2,13 +2,14 @@ package be.ugent.sel.studeez.data.local.models.timer_info
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalPomodoroTimer
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalTimer
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalTimerVisitor
class PomodoroTimerInfo(
name: String,
description: String,
private val studyTime: Int,
private val breakTime: Int,
private val repeats: Int,
var studyTime: Int,
var breakTime: Int,
val repeats: Int,
id: String = ""
): TimerInfo(id, name, description) {
@ -28,4 +29,8 @@ class PomodoroTimerInfo(
)
}
override fun <T> accept(visitor: TimerInfoVisitor<T>): T {
return visitor.visitBreakTimerInfo(this)
}
}

View file

@ -7,8 +7,8 @@ import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalTimer
*/
abstract class TimerInfo(
val id: String,
val name: String,
val description: String
var name: String,
var description: String
) {
/**
@ -21,6 +21,7 @@ abstract class TimerInfo(
* TODO implementaties hebben nog hardgecodeerde strings.
*/
abstract fun asJson(): Map<String, Any>
abstract fun <T> accept(visitor: TimerInfoVisitor<T>): T
}

View file

@ -0,0 +1,11 @@
package be.ugent.sel.studeez.data.local.models.timer_info
interface TimerInfoVisitor<T> {
fun visitCustomTimerInfo(customTimerInfo: CustomTimerInfo): T
fun visitEndlessTimerInfo(endlessTimerInfo: EndlessTimerInfo): T
fun visitBreakTimerInfo(pomodoroTimerInfo: PomodoroTimerInfo): T
}