turns out there is a current week too

* don't debug timetable cod on Sundays, since there are no lessons on Sunday
This commit is contained in:
Jannik 2019-09-25 22:46:58 +02:00
parent aa69d2242f
commit b240beacc9
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
2 changed files with 4 additions and 6 deletions

View File

@ -150,8 +150,8 @@ class HomeFragment : Fragment() {
for (dayIndex in dayIndexSearch..5) {
dayTimetable = timetables[weekIndexSearch].timetable.days[dayIndex]
// some wired calendar magic, calculate the correct date to be shown ((timetable week - current week * 7) + days of calendar week + 1)
val daysToAdd = (timetables[weekIndexSearch].meta.weekNumberYear - NotRetardedCalendar.getWeekOfYear() - 1) * 7 + dayIndex +1
// some wired calendar magic, calculate the correct date to be shown ((timetable week - current week * 7) + (dayIndex - dayIndex of current week)
val daysToAdd =(timetables[weekIndexSearch].meta.weekNumberYear - NotRetardedCalendar.getWeekOfYear()) * 7 + (dayIndex - NotRetardedCalendar.getDayOfWeekIndex())
dayCardView.addTimetableDay(dayTimetable, daysToAdd)
// if there are no lessons don't show the dayCardView

View File

@ -40,8 +40,6 @@ import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.
import org.mosad.seil0.projectlaogai.controller.TCoRAPIController
import org.mosad.seil0.projectlaogai.hsoparser.NotRetardedCalendar
import org.mosad.seil0.projectlaogai.uicomponents.DayCardView
import java.text.SimpleDateFormat
import java.util.*
/**
* The timetable controller class
@ -122,8 +120,8 @@ class TimeTableFragment : Fragment() {
for (dayIndex in startDayIndex..dayEndIndex) {
val dayCardView = DayCardView(context!!)
// some wired calendar magic, calculate the correct date to be shown ((timetable week - current week * 7) + days of calendar week + 1)
val daysToAdd = (timetableMeta.weekNumberYear - NotRetardedCalendar.getWeekOfYear() - 1) * 7 + dayIndex +1
// some wired calendar magic, calculate the correct date to be shown ((timetable week - current week * 7) + (dayIndex - dayIndex of current week)
val daysToAdd =(timetableMeta.weekNumberYear - NotRetardedCalendar.getWeekOfYear()) * 7 + (dayIndex - NotRetardedCalendar.getDayOfWeekIndex())
dayCardView.addTimetableDay(timetable.days[dayIndex], daysToAdd)
// if there are no lessons don't show the dayCardView