forked from github/szkolny
[API] Add trimming whitespaces from events' titles.
This commit is contained in:
parent
ddb2760c16
commit
db57c258c5
@ -49,14 +49,14 @@ class EdudziennikWebHomework(override val data: DataEdudziennik,
|
||||
val teacherName = homeworkElement.child(2).text()
|
||||
val teacher = data.getTeacherByFirstLast(teacherName)
|
||||
|
||||
val topic = homeworkElement.child(4).text()
|
||||
val topic = homeworkElement.child(4).text()?.trim()
|
||||
|
||||
val eventObject = Event(
|
||||
profileId = profileId,
|
||||
id = id,
|
||||
date = date,
|
||||
time = startTime,
|
||||
topic = topic,
|
||||
topic = topic ?: "",
|
||||
color = null,
|
||||
type = Event.TYPE_HOMEWORK,
|
||||
teacherId = teacher.id,
|
||||
|
@ -66,7 +66,7 @@ class IdziennikWebExams(override val data: DataIdziennik,
|
||||
val subjectId = data.getSubject(subjectName, null, subjectName).id
|
||||
val teacherName = exam.getString("wpisal") ?: return@forEach
|
||||
val teacherId = data.getTeacherByLastFirst(teacherName).id
|
||||
val topic = exam.getString("zakres") ?: ""
|
||||
val topic = exam.getString("zakres")?.trim() ?: ""
|
||||
|
||||
val lessonList = data.db.timetableDao().getForDateNow(profileId, examDate)
|
||||
val startTime = lessonList.firstOrNull { it.subjectId == subjectId }?.startTime
|
||||
|
@ -58,7 +58,7 @@ class IdziennikWebHomework(override val data: DataIdziennik,
|
||||
val teacherId = data.getTeacherByLastFirst(teacherName).id
|
||||
val lessonList = data.db.timetableDao().getForDateNow(profileId, eventDate)
|
||||
val startTime = lessonList.firstOrNull { it.subjectId == subjectId }?.displayStartTime
|
||||
val topic = homework.getString("tytul") ?: ""
|
||||
val topic = homework.getString("tytul")?.trim() ?: ""
|
||||
|
||||
val seen = when (profile?.empty) {
|
||||
true -> true
|
||||
|
@ -35,7 +35,7 @@ class LibrusApiEvents(override val data: DataLibrus,
|
||||
events?.forEach { event ->
|
||||
val id = event.getLong("Id") ?: return@forEach
|
||||
val eventDate = Date.fromY_m_d(event.getString("Date"))
|
||||
val topic = event.getString("Content") ?: ""
|
||||
val topic = event.getString("Content")?.trim() ?: ""
|
||||
val type = event.getJsonObject("Category")?.getLong("Id") ?: -1
|
||||
val teacherId = event.getJsonObject("CreatedBy")?.getLong("Id") ?: -1
|
||||
val subjectId = event.getJsonObject("Subject")?.getLong("Id") ?: -1
|
||||
|
@ -30,7 +30,7 @@ class MobidziennikApiEvents(val data: DataMobidziennik, rows: List<String>) {
|
||||
val teacherId = cols[1].toLong()
|
||||
val subjectId = cols[3].toLong()
|
||||
var type = Event.TYPE_DEFAULT
|
||||
var topic = cols[5]
|
||||
var topic = cols[5].trim()
|
||||
Regexes.MOBIDZIENNIK_EVENT_TYPE.find(topic)?.let {
|
||||
val typeText = it.groupValues[1]
|
||||
when (typeText) {
|
||||
|
@ -26,7 +26,7 @@ class MobidziennikApiHomework(val data: DataMobidziennik, rows: List<String>) {
|
||||
val id = cols[0].toLong()
|
||||
val teacherId = cols[7].toLong()
|
||||
val subjectId = cols[6].toLong()
|
||||
val topic = Html.fromHtml(cols[1])?.toString() ?: ""
|
||||
val topic = Html.fromHtml(cols[1])?.toString()?.trim() ?: ""
|
||||
val eventDate = Date.fromYmd(cols[2])
|
||||
val startTime = Time.fromYmdHm(cols[3])
|
||||
|
||||
|
@ -57,7 +57,7 @@ class VulcanApiEvents(override val data: DataVulcan,
|
||||
val eventDate = Date.fromY_m_d(event.getString("DataTekst") ?: return@forEach)
|
||||
val subjectId = event.getLong("IdPrzedmiot") ?: -1
|
||||
val teacherId = event.getLong("IdPracownik") ?: -1
|
||||
val topic = event.getString("Opis") ?: ""
|
||||
val topic = event.getString("Opis")?.trim() ?: ""
|
||||
|
||||
val lessonList = data.db.timetableDao().getForDateNow(profileId, eventDate)
|
||||
val startTime = lessonList.firstOrNull { it.subjectId == subjectId }?.startTime
|
||||
|
Loading…
Reference in New Issue
Block a user