[Vulcan/Hebe] Add saving unit ID.

This commit is contained in:
Kuba Szczodrzyński 2021-02-20 23:52:40 +01:00
parent 2aaf713d58
commit 4fc965d970
3 changed files with 16 additions and 2 deletions

View File

@ -158,6 +158,16 @@ class DataVulcan(app: App, profile: Profile?, loginStore: LoginStore) : Data(app
get() { mStudentSemesterId = mStudentSemesterId ?: profile?.getStudentData("studentSemesterId", 0); return mStudentSemesterId ?: 0 }
set(value) { profile?.putStudentData("studentSemesterId", value) ?: return; mStudentSemesterId = value }
private var mStudentUnitId: Int? = null
var studentUnitId: Int
get() { mStudentUnitId = mStudentUnitId ?: profile?.getStudentData("studentUnitId", 0); return mStudentUnitId ?: 0 }
set(value) { profile?.putStudentData("studentUnitId", value) ?: return; mStudentUnitId = value }
private var mStudentConstituentId: Int? = null
var studentConstituentId: Int
get() { mStudentConstituentId = mStudentConstituentId ?: profile?.getStudentData("studentConstituentId", 0); return mStudentConstituentId ?: 0 }
set(value) { profile?.putStudentData("studentConstituentId", value) ?: return; mStudentConstituentId = value }
private var mSemester1Id: Int? = null
var semester1Id: Int
get() { mSemester1Id = mSemester1Id ?: profile?.getStudentData("semester1Id", 0); return mSemester1Id ?: 0 }

View File

@ -263,7 +263,7 @@ open class VulcanHebe(open val data: DataVulcan, open val lastSync: Long?) {
when (filterType) {
HebeFilterType.BY_PUPIL -> {
// query["unitId"] = data.studentUnitId
query["unitId"] = data.studentUnitId.toString()
query["pupilId"] = data.studentId.toString()
query["periodId"] = data.studentSemesterId.toString()
}

View File

@ -57,7 +57,7 @@ class VulcanHebeMain(
return@forEach
val unit = student.getJsonObject("Unit")
//val constituentUnit = student.getJsonObject("ConstituentUnit")
val constituentUnit = student.getJsonObject("ConstituentUnit")
val login = student.getJsonObject("Login")
val periods = student.getJsonArray("Periods")?.map {
it.asJsonObject
@ -79,6 +79,8 @@ class VulcanHebeMain(
val schoolShort = unit.getString("Short") ?: return@forEach
val schoolCode = "${data.symbol}_$schoolSymbol"
val studentUnitId = unit.getInt("Id") ?: return@forEach
val studentConstituentId = constituentUnit.getInt("Id") ?: return@forEach
val studentLoginId = login.getInt("Id") ?: return@forEach
//val studentClassId = student.getInt("IdOddzial") ?: return@forEach
val studentClassName = student.getString("ClassDisplay") ?: return@forEach
@ -127,6 +129,8 @@ class VulcanHebeMain(
studentData["symbol"] = data.symbol
studentData["studentId"] = studentId
studentData["studentUnitId"] = studentUnitId
studentData["studentConstituentId"] = studentConstituentId
studentData["studentLoginId"] = studentLoginId
studentData["studentSemesterId"] = studentSemesterId
studentData["studentSemesterNumber"] = studentSemesterNumber