forked from github/szkolny
[Mobidziennik/Web] Fix custom attendance type symbols.
This commit is contained in:
parent
44647946e0
commit
530034d7da
@ -188,28 +188,34 @@ class MobidziennikWebAttendance(override val data: DataMobidziennik,
|
|||||||
}
|
}
|
||||||
entry = entry.removePrefix(typeSymbol)
|
entry = entry.removePrefix(typeSymbol)
|
||||||
|
|
||||||
val isCounted = true
|
var isCustom = false
|
||||||
val baseType = when (typeSymbol) {
|
val baseType = when (typeSymbol) {
|
||||||
"." -> TYPE_PRESENT
|
"." -> TYPE_PRESENT
|
||||||
"|" -> TYPE_ABSENT
|
"|" -> TYPE_ABSENT
|
||||||
"+" -> TYPE_ABSENT_EXCUSED
|
"+" -> TYPE_ABSENT_EXCUSED
|
||||||
"s" -> TYPE_BELATED
|
"s" -> TYPE_BELATED
|
||||||
"z" -> TYPE_RELEASED
|
"z" -> TYPE_RELEASED
|
||||||
|
else -> {
|
||||||
|
isCustom = true
|
||||||
|
when (typeSymbol) {
|
||||||
"e" -> TYPE_PRESENT_CUSTOM
|
"e" -> TYPE_PRESENT_CUSTOM
|
||||||
"en" -> TYPE_ABSENT
|
"en" -> TYPE_ABSENT
|
||||||
"ep" -> TYPE_PRESENT_CUSTOM
|
"ep" -> TYPE_PRESENT_CUSTOM
|
||||||
"+ₑ" -> TYPE_ABSENT_EXCUSED
|
"+ₑ" -> TYPE_ABSENT_EXCUSED
|
||||||
else -> TYPE_UNKNOWN
|
else -> TYPE_UNKNOWN
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
val typeName = types?.get(typeSymbol) ?: ""
|
val typeName = types?.get(typeSymbol) ?: ""
|
||||||
val typeColor = when (typeSymbol) {
|
val typeColor = when (typeSymbol) {
|
||||||
"e" -> 0xff673ab7
|
"e" -> 0xff673ab7
|
||||||
"en" -> 0xffec407a
|
"en" -> 0xffec407a
|
||||||
"ep" -> 0xff4caf50
|
"ep" -> 0xff4caf50
|
||||||
|
"+ₑ" -> 0xff795548
|
||||||
else -> null
|
else -> null
|
||||||
}?.toInt()
|
}?.toInt()
|
||||||
|
|
||||||
val typeShort = if (isCounted)
|
val typeShort = if (!isCustom)
|
||||||
data.app.attendanceManager.getTypeShort(baseType)
|
data.app.attendanceManager.getTypeShort(baseType)
|
||||||
else
|
else
|
||||||
typeSymbol
|
typeSymbol
|
||||||
@ -233,7 +239,6 @@ class MobidziennikWebAttendance(override val data: DataMobidziennik,
|
|||||||
subjectId = subjectId
|
subjectId = subjectId
|
||||||
).also {
|
).also {
|
||||||
it.lessonTopic = topic
|
it.lessonTopic = topic
|
||||||
it.isCounted = isCounted
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data.attendanceList.add(attendanceObject)
|
data.attendanceList.add(attendanceObject)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user