mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-04-03 23:34:27 +02:00
[API/Librus] Add syncing grade comments
This commit is contained in:
parent
07d4616974
commit
1a74c2a174
@ -291,6 +291,7 @@ public class Librus implements EdziennikInterface {
|
|||||||
targetEndpoints.add("DescriptiveGrades");
|
targetEndpoints.add("DescriptiveGrades");
|
||||||
targetEndpoints.add("TextGrades");
|
targetEndpoints.add("TextGrades");
|
||||||
targetEndpoints.add("BehaviourGrades");
|
targetEndpoints.add("BehaviourGrades");
|
||||||
|
targetEndpoints.add("GradesComments");
|
||||||
|
|
||||||
targetEndpoints.add("Events");
|
targetEndpoints.add("Events");
|
||||||
targetEndpoints.add("CustomTypes");
|
targetEndpoints.add("CustomTypes");
|
||||||
@ -364,6 +365,8 @@ public class Librus implements EdziennikInterface {
|
|||||||
targetEndpoints.add("DescriptiveGrades");
|
targetEndpoints.add("DescriptiveGrades");
|
||||||
targetEndpoints.add("TextGrades");
|
targetEndpoints.add("TextGrades");
|
||||||
targetEndpoints.add("BehaviourGrades");
|
targetEndpoints.add("BehaviourGrades");
|
||||||
|
|
||||||
|
targetEndpoints.add("GradesComments");
|
||||||
break;
|
break;
|
||||||
case FEATURE_HOMEWORK:
|
case FEATURE_HOMEWORK:
|
||||||
targetEndpoints.add("Homework");
|
targetEndpoints.add("Homework");
|
||||||
@ -509,6 +512,9 @@ public class Librus implements EdziennikInterface {
|
|||||||
case "TextGrades":
|
case "TextGrades":
|
||||||
getTextGrades();
|
getTextGrades();
|
||||||
break;
|
break;
|
||||||
|
case "GradesComments":
|
||||||
|
getGradesComments();
|
||||||
|
break;
|
||||||
case "BehaviourGrades":
|
case "BehaviourGrades":
|
||||||
getBehaviourGrades();
|
getBehaviourGrades();
|
||||||
break;
|
break;
|
||||||
@ -1970,6 +1976,32 @@ public class Librus implements EdziennikInterface {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getGradesComments() {
|
||||||
|
callback.onActionStarted(R.string.sync_action_syncing_grade_comments);
|
||||||
|
apiRequest("Grades/Comments", data -> {
|
||||||
|
if (data == null) {
|
||||||
|
r("finish", "GradesComments");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonArray comments = data.get("Comments").getAsJsonArray();
|
||||||
|
for (JsonElement commentEl : comments) {
|
||||||
|
JsonObject comment = commentEl.getAsJsonObject();
|
||||||
|
long gradeId = comment.get("Grade").getAsJsonObject().get("Id").getAsLong();
|
||||||
|
String text = comment.get("Text").getAsString();
|
||||||
|
|
||||||
|
for (Grade grade : gradeList) {
|
||||||
|
if (grade.id == gradeId) {
|
||||||
|
grade.description = text;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
r("finish", "GradesComments");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void getPointGradesCategories() {
|
private void getPointGradesCategories() {
|
||||||
if (!fullSync || !enablePointGrades) {
|
if (!fullSync || !enablePointGrades) {
|
||||||
// cancel every not-full sync; no need to download categories again
|
// cancel every not-full sync; no need to download categories again
|
||||||
|
@ -851,4 +851,6 @@
|
|||||||
<string name="messages_compose_menu_discard">Abort message</string>
|
<string name="messages_compose_menu_discard">Abort message</string>
|
||||||
<string name="messages_compose_menu_save_draft">Save draft</string>
|
<string name="messages_compose_menu_save_draft">Save draft</string>
|
||||||
<string name="messages_compose_menu_send">Send</string>
|
<string name="messages_compose_menu_send">Send</string>
|
||||||
|
<string name="sync_action_syncing_grade_comments">Getting grade comments</string>
|
||||||
|
<string name="sync_action_syncing_school_free_days">Getting school free days</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -908,4 +908,5 @@
|
|||||||
<string name="homework_tab_current">Aktualne</string>
|
<string name="homework_tab_current">Aktualne</string>
|
||||||
<string name="homework_tab_past">Minione</string>
|
<string name="homework_tab_past">Minione</string>
|
||||||
<string name="homework_no_data">Brak zadań domowych.</string>
|
<string name="homework_no_data">Brak zadań domowych.</string>
|
||||||
|
<string name="sync_action_syncing_grade_comments">Pobieranie komentarzy ocen</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user