mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-01-31 05:48:19 +01:00
[APIv2/Mobidziennik] Make use of String.fixName()
This commit is contained in:
parent
debb0b1507
commit
5e90e9aa71
@ -8,7 +8,7 @@ import pl.szczodrzynski.edziennik.api.v2.mobidziennik.DataMobidziennik
|
|||||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.Lesson
|
import pl.szczodrzynski.edziennik.data.db.modules.lessons.Lesson
|
||||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange
|
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange
|
||||||
import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata
|
import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata
|
||||||
import pl.szczodrzynski.edziennik.fixWhiteSpaces
|
import pl.szczodrzynski.edziennik.fixName
|
||||||
import pl.szczodrzynski.edziennik.singleOrNull
|
import pl.szczodrzynski.edziennik.singleOrNull
|
||||||
|
|
||||||
class MobidziennikApiTimetable(val data: DataMobidziennik, rows: List<String>) {
|
class MobidziennikApiTimetable(val data: DataMobidziennik, rows: List<String>) {
|
||||||
@ -26,7 +26,7 @@ class MobidziennikApiTimetable(val data: DataMobidziennik, rows: List<String>) {
|
|||||||
data.subjectList.singleOrNull { it.longName == lesson[5] }?.let {
|
data.subjectList.singleOrNull { it.longName == lesson[5] }?.let {
|
||||||
lessonObject.subjectId = it.id
|
lessonObject.subjectId = it.id
|
||||||
}
|
}
|
||||||
data.teacherList.singleOrNull { it.fullNameLastFirst == (lesson[7]+" "+lesson[6]).fixWhiteSpaces() }?.let {
|
data.teacherList.singleOrNull { it.fullNameLastFirst == (lesson[7]+" "+lesson[6]).fixName() }?.let {
|
||||||
lessonObject.teacherId = it.id
|
lessonObject.teacherId = it.id
|
||||||
}
|
}
|
||||||
data.teamList.singleOrNull { it.name == lesson[8]+lesson[9] }?.let {
|
data.teamList.singleOrNull { it.name == lesson[8]+lesson[9] }?.let {
|
||||||
@ -52,7 +52,7 @@ class MobidziennikApiTimetable(val data: DataMobidziennik, rows: List<String>) {
|
|||||||
data.subjectList.singleOrNull { it.longName == lesson[5] }?.let {
|
data.subjectList.singleOrNull { it.longName == lesson[5] }?.let {
|
||||||
lessonChange.subjectId = it.id
|
lessonChange.subjectId = it.id
|
||||||
}
|
}
|
||||||
data.teacherList.singleOrNull { it.fullNameLastFirst == (lesson[7]+" "+lesson[6]).fixWhiteSpaces() }?.let {
|
data.teacherList.singleOrNull { it.fullNameLastFirst == (lesson[7]+" "+lesson[6]).fixName() }?.let {
|
||||||
lessonChange.teacherId = it.id
|
lessonChange.teacherId = it.id
|
||||||
}
|
}
|
||||||
data.teamList.singleOrNull { it.name == lesson[8]+lesson[9] }?.let {
|
data.teamList.singleOrNull { it.name == lesson[8]+lesson[9] }?.let {
|
||||||
|
@ -6,7 +6,7 @@ package pl.szczodrzynski.edziennik.api.v2.mobidziennik.data.api
|
|||||||
|
|
||||||
import pl.szczodrzynski.edziennik.api.v2.mobidziennik.DataMobidziennik
|
import pl.szczodrzynski.edziennik.api.v2.mobidziennik.DataMobidziennik
|
||||||
import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher
|
import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher
|
||||||
import pl.szczodrzynski.edziennik.fixWhiteSpaces
|
import pl.szczodrzynski.edziennik.fixName
|
||||||
|
|
||||||
class MobidziennikApiUsers(val data: DataMobidziennik, rows: List<String>) {
|
class MobidziennikApiUsers(val data: DataMobidziennik, rows: List<String>) {
|
||||||
init {
|
init {
|
||||||
@ -15,9 +15,12 @@ class MobidziennikApiUsers(val data: DataMobidziennik, rows: List<String>) {
|
|||||||
continue
|
continue
|
||||||
val cols = row.split("|")
|
val cols = row.split("|")
|
||||||
|
|
||||||
|
if (cols[1] != "*")
|
||||||
|
continue
|
||||||
|
|
||||||
val id = cols[0].toLong()
|
val id = cols[0].toLong()
|
||||||
val name = cols[4].fixWhiteSpaces()
|
val name = cols[4].fixName()
|
||||||
val surname = cols[5].fixWhiteSpaces()
|
val surname = cols[5].fixName()
|
||||||
|
|
||||||
data.teachersMap.put(id, "$surname $name")
|
data.teachersMap.put(id, "$surname $name")
|
||||||
data.teacherList.put(id, Teacher(data.profileId, id, name, surname))
|
data.teacherList.put(id, Teacher(data.profileId, id, name, surname))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user