From bc60169383e327a9bcdef53d92a4dda07557523f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Wed, 20 Mar 2019 14:00:07 +0100 Subject: [PATCH] Add cookie with current school year --- .../wulkanowy/api/interceptor/StudentAndParentInterceptor.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/io/github/wulkanowy/api/interceptor/StudentAndParentInterceptor.kt b/src/main/kotlin/io/github/wulkanowy/api/interceptor/StudentAndParentInterceptor.kt index 809351f4..8e741cce 100644 --- a/src/main/kotlin/io/github/wulkanowy/api/interceptor/StudentAndParentInterceptor.kt +++ b/src/main/kotlin/io/github/wulkanowy/api/interceptor/StudentAndParentInterceptor.kt @@ -2,6 +2,7 @@ package io.github.wulkanowy.api.interceptor import okhttp3.Interceptor import okhttp3.Response +import org.threeten.bp.LocalDate.now import java.net.CookieManager import java.net.HttpCookie import java.net.URI @@ -18,7 +19,8 @@ class StudentAndParentInterceptor( arrayOf( arrayOf("idBiezacyDziennik", diaryId), arrayOf("idBiezacyUczen", studentId), - arrayOf("idBiezacyDziennikPrzedszkole", 0) + arrayOf("idBiezacyDziennikPrzedszkole", 0), + arrayOf("biezacyRokSzkolny", if (now().monthValue < 9) now().year - 1 else now().year) // TODO: replace this with a year based on config ).forEach { cookie -> arrayOf("opiekun", "uczen").forEach { module -> HttpCookie(cookie[0].toString(), cookie[1].toString()).let {