Fix not being able to change from 1st to 3rd semester

This commit is contained in:
ProgramistaZpolski 2024-08-12 17:05:37 +02:00
parent 86f9afc184
commit c77ce50f9b

View file

@ -59,13 +59,17 @@ class GradePresenter @Inject constructor(
} }
fun onSemesterSelected(index: Int) { fun onSemesterSelected(index: Int) {
if (selectedIndex != index - 1) { if (selectedIndex != index + 1) {
Timber.i("Change semester in grade view to ${index + 1}") Timber.i("Change semester in grade view to ${index + 1}")
selectedIndex = index + 1 selectedIndex = index + 1
selectedSemesterId = availableSemesters[index].semesterId selectedSemesterId = availableSemesters[index].semesterId
loadedSemesterId.clear() loadedSemesterId.clear()
view?.let { view?.let {
it.setCurrentSemesterName(availableSemesters[index].semesterName, availableSemesters[index].start.year, availableSemesters[index].end.year) it.setCurrentSemesterName(
availableSemesters[index].semesterName,
availableSemesters[index].start.year,
availableSemesters[index].end.year
)
notifyChildrenSemesterChange() notifyChildrenSemesterChange()
loadChild(it.currentPageIndex) loadChild(it.currentPageIndex)
} }