Add support for lesson cancelled two times
This commit is contained in:
parent
f66c7e9998
commit
e639d0e751
3 changed files with 36 additions and 6 deletions
|
@ -64,7 +64,7 @@ internal class TimetableParser {
|
|||
)
|
||||
}
|
||||
}
|
||||
divs.size == 2 && divs.has(0,CLASS_CHANGES) -> {
|
||||
divs.size == 2 && divs.has(0, CLASS_CHANGES) -> {
|
||||
val oldLesson = getLessonInfo(lesson, divs[0])
|
||||
val newLesson = getLessonInfo(lesson, divs[1])
|
||||
val isNewLessonEmpty = divs[1]?.select("span").isNullOrEmpty()
|
||||
|
@ -103,7 +103,14 @@ internal class TimetableParser {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
divs.has(0, CLASS_MOVED_OR_CANCELED) && divs.has(1, CLASS_CHANGES) && divs.has(1, CLASS_MOVED_OR_CANCELED) && divs.has(2, null) -> {
|
||||
val oldLesson = getLessonInfo(lesson, divs[0])
|
||||
getLessonInfo(lesson, divs[2]).copy(
|
||||
subjectOld = oldLesson.subject,
|
||||
teacherOld = oldLesson.teacher,
|
||||
roomOld = oldLesson.room,
|
||||
)
|
||||
}
|
||||
else -> getLessonInfo(lesson, divs[1])
|
||||
}
|
||||
else -> null
|
||||
|
|
|
@ -24,14 +24,14 @@ class TimetableTest : BaseLocalTest() {
|
|||
private const val MONDAY_OFFSET = 0
|
||||
private const val TUESDAY_OFFSET = 7
|
||||
private const val WEDNESDAY_OFFSET = 14
|
||||
private const val THURSDAY_OFFSET = 20
|
||||
private const val FRIDAY_OFFSET = 26
|
||||
private const val THURSDAY_OFFSET = 21
|
||||
private const val FRIDAY_OFFSET = 27
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getTimetableTest() {
|
||||
assertEquals(5, headers.size)
|
||||
assertEquals(32, timetable.size)
|
||||
assertEquals(33, timetable.size)
|
||||
assertEquals(2, additional.size)
|
||||
}
|
||||
|
||||
|
@ -731,6 +731,28 @@ class TimetableTest : BaseLocalTest() {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getReplacementFromNestedLesson() {
|
||||
with(timetable[WEDNESDAY_OFFSET + 6]) {
|
||||
// środa, 6
|
||||
assertEquals(6, number)
|
||||
assertEquals(getLocalDateTime(2018, 9, 26, 12, 35, 0), start)
|
||||
assertEquals(getLocalDateTime(2018, 9, 26, 13, 20, 0), end)
|
||||
|
||||
assertEquals("Chemia", subject)
|
||||
assertEquals("", group)
|
||||
assertEquals("Kość Elżbieta", teacher)
|
||||
assertEquals("411", room)
|
||||
assertEquals("przeniesiona z lekcji 6, 25.05.2023", info)
|
||||
assertEquals("Fizyka", subjectOld)
|
||||
assertEquals("Rekiel Jarosław", teacherOld)
|
||||
assertEquals("513", roomOld)
|
||||
|
||||
assertEquals(false, canceled)
|
||||
assertEquals(true, changes)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getDayHeader_empty() {
|
||||
with(headers[0]) {
|
||||
|
|
|
@ -91,7 +91,8 @@
|
|||
[
|
||||
"6<br />12:35<br />13:20",
|
||||
"<div><span class='x-treelabel-ppl x-treelabel-inv'>Wychowanie fizyczne [1/2]</span><span class='x-treelabel-ppl x-treelabel-inv'></span><span class='x-treelabel-ppl x-treelabel-inv'>H1</span><span class='x-treelabel-ppl x-treelabel-inv'>Nazwisko Imie</span>(nieobecność nauczyciela: zastępstwo)</div>",
|
||||
"<div><span class='x-treelabel-ppl x-treelabel-zas'>estetyka i historia fotografii</span><span class='x-treelabel-ppl x-treelabel-zas'></span><span class='x-treelabel-ppl x-treelabel-zas'>Kaczyński Bartosz</span>(zastępstwo: Morawiecki Mariusz)</div><div><span class=''>Historia</span><span class=''></span><span class=''>Morawiecki Mariusz</span></div>"
|
||||
"<div><span class='x-treelabel-ppl x-treelabel-zas'>estetyka i historia fotografii</span><span class='x-treelabel-ppl x-treelabel-zas'></span><span class='x-treelabel-ppl x-treelabel-zas'>Kaczyński Bartosz</span>(zastępstwo: Morawiecki Mariusz)</div><div><span class=''>Historia</span><span class=''></span><span class=''>Morawiecki Mariusz</span></div>",
|
||||
"<div><span class='x-treelabel-ppl x-treelabel-inv'>Fizyka</span><span class='x-treelabel-ppl x-treelabel-inv'>513</span><span class='x-treelabel-ppl x-treelabel-inv'>Rekiel Jarosław</span>(nieobecność nauczyciela: zastępstwo)</div><div><span class='x-treelabel-ppl x-treelabel-zas x-treelabel-inv'>Historia</span><span class='x-treelabel-ppl x-treelabel-zas x-treelabel-inv'>513</span><span class='x-treelabel-ppl x-treelabel-zas x-treelabel-inv'>Szozda Anna</span>(przeniesiona z lekcji 7, 25.05.2023)<br/>(nieobecność nauczyciela: zastępstwo)</div><div><span class=''>Chemia</span><span class=''>411</span><span class=''>Kość Elżbieta</span>(przeniesiona z lekcji 6, 25.05.2023)</div>"
|
||||
]
|
||||
],
|
||||
"Additionals": [
|
||||
|
|
Loading…
Reference in a new issue