Skip to content

Commit

Permalink
DaVinciInfoserverParser: rooms, subjects (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
johan12345 committed Oct 12, 2017
1 parent 89a0c3a commit b850eb5
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 49 deletions.
6 changes: 3 additions & 3 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 26 additions & 21 deletions .idea/modules/parser/parser.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 24 additions & 19 deletions .idea/modules/sample/sample.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions .idea/modules/substitution-schedule-parser.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import me.vertretungsplan.objects.SubstitutionScheduleDay;
import me.vertretungsplan.objects.credential.UserPasswordCredential;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.http.client.HttpResponseException;
Expand Down Expand Up @@ -132,10 +133,15 @@ private static SubstitutionSchedule parseDaVinciJson(JSONObject json, Substituti
timeFmt.parseLocalTime(lesson.getString("startTime")),
timeFmt.parseLocalTime(lesson.getString("endTime"))));

if (changes.has("lessonTitle")) {
substitution.setSubject(changes.getString("lessonTitle"));
} else if (lesson.has("courseTitle")) {
substitution.setSubject(lesson.getString("courseTitle"));
substitution.setPreviousSubject(changes.optString("subjectCode", null));
substitution.setSubject(changes.optString("newSubjectCode", null));

if (lesson.has("roomCodes")) {
substitution.setRoom(StringUtils.join(toStringList(lesson.getJSONArray("roomCodes")), ", "));
}
if (changes.has("absentRoomCodes")) {
substitution.setPreviousRoom(
StringUtils.join(toStringList(changes.getJSONArray("absentRoomCodes")), ", "));
}

substitution.setType(changes.optString("caption", "Vertretung"));
Expand Down

0 comments on commit b850eb5

Please sign in to comment.