Skip to content

Commit

Permalink
Fix bugs with sort feature
Browse files Browse the repository at this point in the history
  • Loading branch information
georgetayqy committed Sep 22, 2023
1 parent f45836b commit ecde3b5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 20 deletions.
18 changes: 9 additions & 9 deletions data/tasks.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
T|T|100000
T|F|bitch
E|F|bruh|2020-10-01T00:00|2022-10-05T00:00
T|F|bruh
T|F|bruh
E|F|this|2029-01-01T00:00|2099-01-01T00:00
D|T|deadline task|2023-04-29T00:00
D|F|event|2001-01-01T00:00
E|F|idk|2019-02-01T00:00|2023-02-01T00:00
T|T|naur
T|F|task
E|F|this|2029-01-01T00:00|2099-01-01T00:00
E|F|bruh|2020-10-01T00:00|2022-10-05T00:00
D|F|event|2001-01-01T00:00
T|F|this
T|F|task
T|T|naur
T|F|bruh
T|F|bruh
T|F|bitch
T|T|100000
6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,14 +413,14 @@ sort [SORT ORDER] [SORT BY]
> **ℹ️ Note**
> The values that `[SORT BY]` can take are:
> * `d` OR `des` OR `descript` OR `description`: Sorts the list by task description
> * `s` OR `st` OR `start` OR `start date`: Sorts the list by start date
> * `e` OR `en` OR `end` OR `end date`: Sorts the list by end date
> * `s` OR `st` OR `start`: Sorts the list by start date
> * `e` OR `en` OR `end`: Sorts the list by end date
> * `d` OR `dead` OR `deadln` OR `deadline`: Sorts the list by deadline
#### Examples

* `sort d d`
* `sort asc start date`
* `sort asc start`
* `sort ascend description`

#### Expected Outcome
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/juke/commands/JukeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ private static JukeSortListCommand sort(String[] args, TaskList taskList) {
+ "d/desc/descend/descending] "
+ "[d/des/descript/description | "
+ "dl/dead/deadln/deadline | "
+ "s/st/start/start date | "
+ "e/en/end/end date]");
+ "s/st/start | "
+ "e/en/end]");
}

try {
Expand All @@ -339,8 +339,8 @@ private static JukeSortListCommand sort(String[] args, TaskList taskList) {
+ "d/desc/descend/descending] "
+ "[d/des/descript/description | "
+ "dl/dead/deadln/deadline | "
+ "s/st/start/start date | "
+ "e/en/end/end date]");
+ "s/st/start | "
+ "e/en/end]");
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/main/java/juke/commons/enums/SortTypeEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ public static SortTypeEnum ofType(String type) {
case "s":
case "st":
case "start":
case "start date":
return SortTypeEnum.START_DATE;
case "e":
case "en":
case "end":
case "end date":
return SortTypeEnum.END_DATE;
case "dl":
case "dead":
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/juke/tasks/JukeTodo.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ public int sortBy(JukeTask task, SortTypeEnum sortType) {
}
}



/**
* Compares the start date between this {@code JukeTodo} object with the input {@code JukeTask} object.
*
Expand Down

0 comments on commit ecde3b5

Please sign in to comment.