Add getGrades() in StudentPlusService
This commit is contained in:
parent
eaff0f4bf2
commit
f53fc32821
3 changed files with 23 additions and 2 deletions
|
@ -386,8 +386,10 @@ class Scrapper {
|
|||
type = -1,
|
||||
)
|
||||
}
|
||||
|
||||
return student.getGrades(semester)
|
||||
return when (isEduOne) {
|
||||
true -> studentPlus.getGrades(semester)
|
||||
else -> student.getGrades(semester)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getGradesPartialStatistics(semesterId: Int): List<GradesStatisticsPartial> {
|
||||
|
|
|
@ -11,6 +11,9 @@ import io.github.wulkanowy.sdk.scrapper.attendance.SentExcuseStatus
|
|||
import io.github.wulkanowy.sdk.scrapper.exception.FeatureDisabledException
|
||||
import io.github.wulkanowy.sdk.scrapper.exception.VulcanClientError
|
||||
import io.github.wulkanowy.sdk.scrapper.getEncodedKey
|
||||
import io.github.wulkanowy.sdk.scrapper.grades.Grades
|
||||
import io.github.wulkanowy.sdk.scrapper.grades.mapGradesList
|
||||
import io.github.wulkanowy.sdk.scrapper.grades.mapGradesSummary
|
||||
import io.github.wulkanowy.sdk.scrapper.handleErrors
|
||||
import io.github.wulkanowy.sdk.scrapper.mobile.TokenResponse
|
||||
import io.github.wulkanowy.sdk.scrapper.register.AuthorizePermissionPlusRequest
|
||||
|
@ -140,4 +143,19 @@ internal class StudentPlusRepository(
|
|||
.split("data:image/png;base64,")[1],
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun getGrades(semesterId: Int): Grades {
|
||||
val key = getEncodedKey(studentId, diaryId, unitId)
|
||||
val res = api.getGrades(key, semesterId)
|
||||
|
||||
return Grades(
|
||||
details = res.mapGradesList(),
|
||||
summary = res.mapGradesSummary(),
|
||||
descriptive = res.gradesDescriptive,
|
||||
isAverage = res.isAverage,
|
||||
isPoints = res.isPoints,
|
||||
isForAdults = res.isForAdults,
|
||||
type = res.type,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import io.github.wulkanowy.sdk.scrapper.attendance.AttendanceExcusePlusRequest
|
|||
import io.github.wulkanowy.sdk.scrapper.attendance.AttendanceExcusesPlusResponse
|
||||
import io.github.wulkanowy.sdk.scrapper.conferences.Conference
|
||||
import io.github.wulkanowy.sdk.scrapper.grades.GradeSemester
|
||||
import io.github.wulkanowy.sdk.scrapper.grades.GradesResponse
|
||||
import io.github.wulkanowy.sdk.scrapper.mobile.Device
|
||||
import io.github.wulkanowy.sdk.scrapper.mobile.TokenResponse
|
||||
import io.github.wulkanowy.sdk.scrapper.register.AuthorizePermissionPlusRequest
|
||||
|
|
Loading…
Reference in a new issue