Skip to content

Commit

Permalink
Merge pull request #72 from TehZiHuai/master
Browse files Browse the repository at this point in the history
ensured that adding tasks with priority will be immediately sorted
  • Loading branch information
TehZiHuai authored Oct 18, 2019
2 parents 307d757 + 6497f71 commit 09ad8ef
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/Operations/TaskList.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public TaskList(ArrayList<Task> tasks) {
*/
public void add(Task newTask) {
tasks.add(newTask);
sortPriority();
}

/**
Expand Down Expand Up @@ -64,6 +65,7 @@ public void delete(int[] index, TempDeleteList deletedList) throws RoomShareExce
* Lists out all tasks in the current list in the order they were added into the list.
*/
public void list() throws RoomShareException {
sortPriority();
if( tasks.size() != 0 ){
int listCount = 1;
for (Task output : tasks) {
Expand Down

0 comments on commit 09ad8ef

Please sign in to comment.