mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2024-11-24 19:04:38 -06:00
[API/Librus] Show map value in descriptive grades.
This commit is contained in:
parent
45d31d2358
commit
95a150f7d8
@ -32,19 +32,16 @@ class LibrusApiGrades(override val data: DataLibrus,
|
||||
val subjectId = grade.getJsonObject("Subject")?.getLong("Id") ?: -1
|
||||
val addedDate = Date.fromIso(grade.getString("AddDate"))
|
||||
|
||||
val category = data.gradeCategories.singleOrNull { it.categoryId == categoryId }
|
||||
val categoryName = category?.text ?: ""
|
||||
val color = category?.color ?: -1
|
||||
var weight = category?.weight ?: 0f
|
||||
val value = Utils.getGradeValue(name)
|
||||
|
||||
|
||||
if (name == "-" || name == "+"
|
||||
|| name.equals("np", ignoreCase = true)
|
||||
|| name.equals("bz", ignoreCase = true)) {
|
||||
weight = 0f
|
||||
val category = data.gradeCategories.singleOrNull {
|
||||
it.categoryId == categoryId && it.type == GradeCategory.TYPE_NORMAL
|
||||
}
|
||||
|
||||
val value = Utils.getGradeValue(name)
|
||||
val weight = if (name == "-" || name == "+"
|
||||
|| name.equals("np", ignoreCase = true)
|
||||
|| name.equals("bz", ignoreCase = true)) 0f
|
||||
else category?.weight ?: 0f
|
||||
|
||||
val description = grade.getJsonArray("Comments")?.asJsonObjectList()?.let { comments ->
|
||||
if (comments.isNotEmpty()) {
|
||||
data.gradeCategories.singleOrNull {
|
||||
@ -57,8 +54,8 @@ class LibrusApiGrades(override val data: DataLibrus,
|
||||
val gradeObject = Grade(
|
||||
profileId,
|
||||
id,
|
||||
categoryName,
|
||||
color,
|
||||
category?.text ?: "",
|
||||
category?.color ?: -1,
|
||||
description,
|
||||
name,
|
||||
value,
|
||||
|
@ -30,7 +30,12 @@ class LibrusApiTextGrades(override val data: DataLibrus,
|
||||
val teacherId = grade.getJsonObject("AddedBy")?.getLong("Id") ?: return@forEach
|
||||
val semester = grade.getInt("Semester") ?: return@forEach
|
||||
val subjectId = grade.getJsonObject("Subject")?.getLong("Id") ?: return@forEach
|
||||
val description = grade.getString("RealGradeValue") ?: grade.getString("Map") ?: ""
|
||||
|
||||
val map = grade.getString("Map")
|
||||
val realValue = grade.getString("RealGradeValue")
|
||||
|
||||
val name = map ?: realValue ?: return@forEach
|
||||
val description = if (map != null && map != realValue) realValue ?: "" else ""
|
||||
|
||||
val categoryId = grade.getJsonObject("Skill")?.getLong("Id") ?: return@forEach
|
||||
|
||||
@ -45,8 +50,8 @@ class LibrusApiTextGrades(override val data: DataLibrus,
|
||||
id,
|
||||
category?.text ?: "",
|
||||
category?.color ?: -1,
|
||||
"",
|
||||
description,
|
||||
name,
|
||||
0f,
|
||||
0f,
|
||||
semester,
|
||||
|
Loading…
Reference in New Issue
Block a user