mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-01-18 12:56:45 -06:00
[API/Librus] Add showing classroom in substitutions
This commit is contained in:
parent
ea36e8e9bd
commit
3f85825c4a
@ -277,8 +277,8 @@ public class Librus implements EdziennikInterface {
|
||||
targetEndpoints.add("Users");
|
||||
targetEndpoints.add("Subjects");
|
||||
targetEndpoints.add("Classrooms");
|
||||
targetEndpoints.add("Timetables");
|
||||
targetEndpoints.add("Substitutions");
|
||||
targetEndpoints.add("Timetables");
|
||||
targetEndpoints.add("Colors");
|
||||
|
||||
targetEndpoints.add("SavedGradeCategories");
|
||||
@ -346,8 +346,8 @@ public class Librus implements EdziennikInterface {
|
||||
switch (feature) {
|
||||
case FEATURE_TIMETABLE:
|
||||
targetEndpoints.add("Classrooms");
|
||||
targetEndpoints.add("Timetables");
|
||||
targetEndpoints.add("Substitutions");
|
||||
targetEndpoints.add("Timetables");
|
||||
break;
|
||||
case FEATURE_AGENDA:
|
||||
targetEndpoints.add("Events");
|
||||
@ -1663,6 +1663,7 @@ public class Librus implements EdziennikInterface {
|
||||
try {
|
||||
for (Map.Entry<String, JsonElement> dayEl: timetables.entrySet()) {
|
||||
JsonArray day = dayEl.getValue().getAsJsonArray();
|
||||
Date lessonDate = Date.fromY_m_d(dayEl.getKey());
|
||||
for (JsonElement lessonGroupEl: day) {
|
||||
if ((lessonGroupEl instanceof JsonArray && ((JsonArray) lessonGroupEl).size() == 0) || lessonGroupEl instanceof JsonNull || lessonGroupEl == null) {
|
||||
continue;
|
||||
@ -1737,8 +1738,27 @@ public class Librus implements EdziennikInterface {
|
||||
}
|
||||
|
||||
JsonElement classroom;
|
||||
if ((classroom = lesson.get(substitution && !cancelled ? "OrgClassroom" : "Classroom")) != null) {
|
||||
lessonObject.classroomName = classrooms.get(classroom.getAsJsonObject().get("Id").getAsInt());
|
||||
JsonElement substitutionClassroom;
|
||||
if (substitution && !cancelled) {
|
||||
classroom = lesson.get("OrgClassroom");
|
||||
substitutionClassroom = lesson.get("Classroom");
|
||||
|
||||
if (classroom != null)
|
||||
lessonObject.classroomName = classrooms.get(classroom.getAsJsonObject().get("Id").getAsInt());
|
||||
|
||||
if (substitutionClassroom != null) {
|
||||
for (LessonChange lessonChange : lessonChangeList) {
|
||||
if(lessonChange.lessonDate.compareTo(lessonDate) == 0) {
|
||||
lessonChange.classroomName
|
||||
= classrooms.get(substitutionClassroom.getAsJsonObject().get("Id").getAsInt());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
classroom = lesson.get("Classroom");
|
||||
if (classroom != null)
|
||||
lessonObject.classroomName = classrooms.get(classroom.getAsJsonObject().get("Id").getAsInt());
|
||||
}
|
||||
|
||||
lessonList.add(lessonObject);
|
||||
|
Loading…
x
Reference in New Issue
Block a user