forked from github/szkolny
[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 subjectId = grade.getJsonObject("Subject")?.getLong("Id") ?: -1
|
||||||
val addedDate = Date.fromIso(grade.getString("AddDate"))
|
val addedDate = Date.fromIso(grade.getString("AddDate"))
|
||||||
|
|
||||||
val category = data.gradeCategories.singleOrNull { it.categoryId == categoryId }
|
val category = data.gradeCategories.singleOrNull {
|
||||||
val categoryName = category?.text ?: ""
|
it.categoryId == categoryId && it.type == GradeCategory.TYPE_NORMAL
|
||||||
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 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 ->
|
val description = grade.getJsonArray("Comments")?.asJsonObjectList()?.let { comments ->
|
||||||
if (comments.isNotEmpty()) {
|
if (comments.isNotEmpty()) {
|
||||||
data.gradeCategories.singleOrNull {
|
data.gradeCategories.singleOrNull {
|
||||||
@ -57,8 +54,8 @@ class LibrusApiGrades(override val data: DataLibrus,
|
|||||||
val gradeObject = Grade(
|
val gradeObject = Grade(
|
||||||
profileId,
|
profileId,
|
||||||
id,
|
id,
|
||||||
categoryName,
|
category?.text ?: "",
|
||||||
color,
|
category?.color ?: -1,
|
||||||
description,
|
description,
|
||||||
name,
|
name,
|
||||||
value,
|
value,
|
||||||
|
@ -30,7 +30,12 @@ class LibrusApiTextGrades(override val data: DataLibrus,
|
|||||||
val teacherId = grade.getJsonObject("AddedBy")?.getLong("Id") ?: return@forEach
|
val teacherId = grade.getJsonObject("AddedBy")?.getLong("Id") ?: return@forEach
|
||||||
val semester = grade.getInt("Semester") ?: return@forEach
|
val semester = grade.getInt("Semester") ?: return@forEach
|
||||||
val subjectId = grade.getJsonObject("Subject")?.getLong("Id") ?: 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
|
val categoryId = grade.getJsonObject("Skill")?.getLong("Id") ?: return@forEach
|
||||||
|
|
||||||
@ -45,8 +50,8 @@ class LibrusApiTextGrades(override val data: DataLibrus,
|
|||||||
id,
|
id,
|
||||||
category?.text ?: "",
|
category?.text ?: "",
|
||||||
category?.color ?: -1,
|
category?.color ?: -1,
|
||||||
"",
|
|
||||||
description,
|
description,
|
||||||
|
name,
|
||||||
0f,
|
0f,
|
||||||
0f,
|
0f,
|
||||||
semester,
|
semester,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user