mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-01-18 21:06:44 -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("Users");
|
||||||
targetEndpoints.add("Subjects");
|
targetEndpoints.add("Subjects");
|
||||||
targetEndpoints.add("Classrooms");
|
targetEndpoints.add("Classrooms");
|
||||||
targetEndpoints.add("Timetables");
|
|
||||||
targetEndpoints.add("Substitutions");
|
targetEndpoints.add("Substitutions");
|
||||||
|
targetEndpoints.add("Timetables");
|
||||||
targetEndpoints.add("Colors");
|
targetEndpoints.add("Colors");
|
||||||
|
|
||||||
targetEndpoints.add("SavedGradeCategories");
|
targetEndpoints.add("SavedGradeCategories");
|
||||||
@ -346,8 +346,8 @@ public class Librus implements EdziennikInterface {
|
|||||||
switch (feature) {
|
switch (feature) {
|
||||||
case FEATURE_TIMETABLE:
|
case FEATURE_TIMETABLE:
|
||||||
targetEndpoints.add("Classrooms");
|
targetEndpoints.add("Classrooms");
|
||||||
targetEndpoints.add("Timetables");
|
|
||||||
targetEndpoints.add("Substitutions");
|
targetEndpoints.add("Substitutions");
|
||||||
|
targetEndpoints.add("Timetables");
|
||||||
break;
|
break;
|
||||||
case FEATURE_AGENDA:
|
case FEATURE_AGENDA:
|
||||||
targetEndpoints.add("Events");
|
targetEndpoints.add("Events");
|
||||||
@ -1663,6 +1663,7 @@ public class Librus implements EdziennikInterface {
|
|||||||
try {
|
try {
|
||||||
for (Map.Entry<String, JsonElement> dayEl: timetables.entrySet()) {
|
for (Map.Entry<String, JsonElement> dayEl: timetables.entrySet()) {
|
||||||
JsonArray day = dayEl.getValue().getAsJsonArray();
|
JsonArray day = dayEl.getValue().getAsJsonArray();
|
||||||
|
Date lessonDate = Date.fromY_m_d(dayEl.getKey());
|
||||||
for (JsonElement lessonGroupEl: day) {
|
for (JsonElement lessonGroupEl: day) {
|
||||||
if ((lessonGroupEl instanceof JsonArray && ((JsonArray) lessonGroupEl).size() == 0) || lessonGroupEl instanceof JsonNull || lessonGroupEl == null) {
|
if ((lessonGroupEl instanceof JsonArray && ((JsonArray) lessonGroupEl).size() == 0) || lessonGroupEl instanceof JsonNull || lessonGroupEl == null) {
|
||||||
continue;
|
continue;
|
||||||
@ -1737,8 +1738,27 @@ public class Librus implements EdziennikInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
JsonElement classroom;
|
JsonElement classroom;
|
||||||
if ((classroom = lesson.get(substitution && !cancelled ? "OrgClassroom" : "Classroom")) != null) {
|
JsonElement substitutionClassroom;
|
||||||
lessonObject.classroomName = classrooms.get(classroom.getAsJsonObject().get("Id").getAsInt());
|
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);
|
lessonList.add(lessonObject);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user