Skip to content

Commit

Permalink
Fix issue where modules with only sem2 lessons are interpreted as err…
Browse files Browse the repository at this point in the history
…or (#251)
  • Loading branch information
ccyccyccy authored Jan 20, 2020
1 parent 5309661 commit 2af7a0f
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,14 @@ private List<TimeRange> getTimeRangesForModule(String moduleCode, List<String> g
*/
private List<TimeRange> getTimeRangeFromEntry(JsonNode moduleNode, String group, String lessonType, int sem, String moduleCode) throws IllegalValueException, JsonProcessingException {
List<JsonNode> targets = new ArrayList<>();
int semIndex;
if(moduleNode.path("semesterData").path(0).path("semester").asInt() == 1) {
semIndex = sem - 1;
} else {
semIndex = sem - 2;
}
moduleNode.path("semesterData")
.path(sem - 1) // Sem 1
.path(semIndex) // Sem 1
.path("timetable")
.forEach(node -> {
if (node.path("classNo").asText().equals(group) && node.path("lessonType").asText().equals(lessonType)) {
Expand Down

0 comments on commit 2af7a0f

Please sign in to comment.