Skip to content

Commit

Permalink
bugfix in logic of CheckDuplicatesOverdue
Browse files Browse the repository at this point in the history
  • Loading branch information
TehZiHuai committed Nov 10, 2019
1 parent 979877e commit 75de2ea
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/main/java/Operations/CheckAnomaly.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public static Boolean checkDuplicateOverdue(Task task) {
String assignee = task.getAssignee();
String date = task.getDate().toString();
ArrayList<Task> temp = OverdueList.getOverdueList();
for (int i = 0; i < temp.size(); i++) {
if (temp.get(i).getDescription().equals(name)
&& temp.get(i).getAssignee().equals(assignee)
&& temp.get(i).getDate().toString().equals(date)
&& temp.get(i).getClass().equals(task.getClass())) {
for (Task value : temp) {
if (value.getDescription().equals(name)
&& value.getAssignee().equals(assignee)
&& value.getDate().toString().equals(date)
&& value.getClass().equals(task.getClass())) {
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/Operations/TaskList.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void list(OverdueList overdueList) throws RoomShareException {
for (int i = 0; i < tasks.size(); i++) {
if (new Date().after(tasks.get(i).getDate()) && !(tasks.get(i) instanceof Leave)) {
tasks.get(i).setOverdue(true);
if (CheckAnomaly.checkDuplicateOverdue(tasks.get(i))) {
if (!CheckAnomaly.checkDuplicateOverdue(tasks.get(i))) {
// no duplicates in overdue list
overdueList.add(tasks.get(i));
}
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/RoomShare.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public class RoomShare {
private TaskList taskList;
private OverdueList overdueList;
private Parser parser;
private RecurHandler recurHandler;
private TempDeleteList tempDeleteList;
private TaskCreator taskCreator;
private Help help;
Expand All @@ -32,7 +31,7 @@ public class RoomShare {
* Constructor of a RoomShare class. Creates all necessary objects and collections for RoomShare to run
* Also loads the ArrayList of tasks from the data.txt file
*/
public RoomShare() throws RoomShareException {
private RoomShare() throws RoomShareException {
ui = new Ui();
help = new Help();
ui.startUp();
Expand All @@ -57,7 +56,7 @@ public RoomShare() throws RoomShareException {
overdueList = new OverdueList(emptyList);
}
listRoutine = new ListRoutine(taskList, overdueList);
recurHandler = new RecurHandler(taskList);
RecurHandler recurHandler = new RecurHandler(taskList);
if (recurHandler.checkRecurrence()) {
ui.showChangeInTaskList();
taskList.list(overdueList);
Expand All @@ -68,7 +67,7 @@ public RoomShare() throws RoomShareException {
/**
* Deals with the operation flow of RoomShare.
*/
public void run() throws RoomShareException, IOException, InterruptedException {
private void run() throws RoomShareException, IOException, InterruptedException {
boolean isExit = false;
while (!isExit) {
TaskType type;
Expand Down

0 comments on commit 75de2ea

Please sign in to comment.