Skip to content

Commit

Permalink
Merge pull request #83 from AndrewJanong/event-bug-fix
Browse files Browse the repository at this point in the history
Event bug fix
  • Loading branch information
Nixx162 authored Nov 2, 2023
2 parents 785ffeb + 5e36db0 commit 0abcaa5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/seedu/address/model/event/UniqueEventList.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,23 @@ private Event getOverlappingEvent(Event newEvent) {
assert !this.contains(newEvent);
LocalDateTime newEventStartTime = newEvent.getStartTime();
LocalDateTime newEventEndTime = newEvent.getEndTime();

assert newEventStartTime != null : "Start time should not be null";

if (newEventEndTime == null) {
newEventEndTime = newEventStartTime;
}

for (Event e : this.internalList) {
LocalDateTime startTime = e.getStartTime();
LocalDateTime endTime = e.getEndTime();

assert startTime != null : "Start time should not be null";

if (endTime == null) {
endTime = startTime;
}

if (DateTimeUtil.timeIntervalsOverlap(newEventStartTime, newEventEndTime, startTime, endTime)) {
return e;
}
Expand Down

0 comments on commit 0abcaa5

Please sign in to comment.