Skip to content

Commit

Permalink
fix: fix event comparison logic
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuhanming committed Apr 3, 2020
1 parent c82011e commit 84b7df8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/java/modulo/logic/parser/ParserUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ public static EventType parseEventType(String eventType) throws ParseException {
*/
public static DisplayableType parseDisplayableType(String displayableType) throws ParseException {
String cleanedDisplayableType = displayableType.toLowerCase().trim();
if (cleanedDisplayableType.equals("m") || cleanedDisplayableType.equals("module")) {
if (cleanedDisplayableType.equals("m") || cleanedDisplayableType.contains("module")) {
return DisplayableType.MODULE;
} else if (cleanedDisplayableType.equals("e") || cleanedDisplayableType.equals("event")) {
} else if (cleanedDisplayableType.equals("e") || cleanedDisplayableType.contains("event")) {
return DisplayableType.EVENT;
}
throw new ParseException(MESSAGE_INVALID_DISPLAYABLE_TYPE);
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/modulo/model/event/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ public void removeDeadline(Deadline deadline) {

/**
* Removes all deadlines from the list of deadlines.
*
*/
public void removeAllDeadlines() {
deadlines.clear();
Expand Down Expand Up @@ -143,6 +142,7 @@ public boolean isSameEvent(Event otherEvent) {
return otherEvent != null
&& otherEvent.getName().toString().toLowerCase().equals(getName().toString().toLowerCase())
&& otherEvent.getParentModule().getModuleCode().equals(getParentModule().getModuleCode())
&& otherEvent.getParentModule().getAcademicYear().equals(getParentModule().getAcademicYear())
&& otherEvent.getEventType().equals(getEventType());
}

Expand All @@ -158,7 +158,8 @@ public boolean isSameCategoryOfEvents(Event otherEvent) {
}

return otherEvent.getEventType().equals(getEventType())
&& otherEvent.getParentModule().getModuleCode().equals(getParentModule().getModuleCode());
&& otherEvent.getParentModule().getModuleCode().equals(getParentModule().getModuleCode())
&& otherEvent.getParentModule().getAcademicYear().equals(getParentModule().getAcademicYear());
}

/**
Expand Down

0 comments on commit 84b7df8

Please sign in to comment.