Skip to content

Commit

Permalink
TODO: write test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
billstark committed Oct 24, 2016
1 parent 9a32f88 commit bc031c0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/main/java/seedu/address/model/task/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ public void updateTask(Name name, UniqueTagList tags, TaskDate startDate, TaskDa
}
needModification.update(startDate, endDate);
}

getLastAppendedComponent().setTaskReferrence(this);
}

@Override
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/seedu/address/model/task/TaskComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public void setEndDate(TaskDate endDate) {
this.endDate = endDate;
}

public void setTaskReferrence(Task task) {
this.taskReference = task;
}

public TaskDate getStartDate() {
return startDate;
}
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/seedu/address/model/task/UniqueTaskList.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,13 @@ public boolean updateTask(Task target, Name name, UniqueTagList tags, TaskDate s

int componentToChange = internalComponentList.indexOf(t.getLastAppendedComponent());
t.updateTask(name, tags, startDate, endDate, recurringType);
internalComponentList.set(componentToChange, t.getLastAppendedComponent()); // added as a stop gap measure
System.out.println(internalComponentList.get(componentToChange).getStartDate().getInputDate());
internalComponentList.clear();
for(Task h: internalList) {
System.out.println(h.getName().fullName);
System.out.println(h.getTaskDateComponent().get(0).getTaskReference().getName().fullName);
internalComponentList.addAll(h.getTaskDateComponent());
}

taskFoundAndUpdated = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/seedu/address/logic/LogicManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ public void execute_edit_fromDateIsBehindToDate_notAllowed() throws Exception {
@Test
public void execute_edit_timeSlotOccupied_notAllowed() throws Exception {
// setup expectations
Task dummyTask = new Task(new Name("dummy"), new UniqueTagList(),
Task dummyTask = new Task(new Name("BLOCKED SLOT"), new UniqueTagList(),
new TaskDate("10 oct 2pm"), new TaskDate("10 oct 5pm"), RecurringType.NONE);
Task beforeModification = new Task(new Name("anything"), new UniqueTagList(),
new TaskDate("10 oct 10am"), new TaskDate("10 oct 12am"), RecurringType.NONE);
Expand Down

0 comments on commit bc031c0

Please sign in to comment.