Skip to content

Commit

Permalink
small update (nusCS2113-AY1920S1#45)
Browse files Browse the repository at this point in the history
* test

* test

* test

* test

* test

* test

* test

* image

* image

* image

* image

* update

* update

* update

* update

* update

* update

* refactor Schedule to TimeFrame

* Add implements Comparable<TimeFrame>

* 092919 ui fix (nusCS2113-AY1920S1#2)

* udate

* udate

* refactor Schedule to TimeFrame

* update

* update

* update change in schedule command

* fix merge conflict and bug

* minor code change
  • Loading branch information
limsiying authored Sep 29, 2019
1 parent 72bd9de commit a7ff5d3
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 97 deletions.
185 changes: 101 additions & 84 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,52 @@ By: `CS2113T-T09-2`

== Introduction

Duchess is a Command Line Interface (CLI) calendar. It provides an interface for students to manage both their school timetable and commitments schedule while providing useful contextual information and features.
Duchess is a calendar application tailor-made for NUS students. Duchess closes the gap between NUSMODS and generic calendar applications by providing a unified interface for students to manage both their school timetable and commitments schedule while providing academic contextual information and features.

== Quick Start

image::Ui.PNG[]

. Ensure you have Java `11` or above installed in your Computer.
. Download the latest `duchess.jar` link:{repoURL}/releases[here].
. Copy the file to the folder you want to use as the home folder for your Calander.
. Copy the file to the folder you want to use as the home folder for your Calendar.
. Double-click the file to start the app.
+
image::Ui.PNG[]
+
. Type a command in the input field and press kbd:[Enter] to execute it.
. Refer to <<Features>> for details of all commands.

[[Features]]
== Features

=== Adding todo task: `todo <task>`
=== Adding a deadline task: `deadline <task> /by <deadline>`

Adds a deadline to the task list.

Adds a todo task to the task list. The todo task is initially marked as undone.
* The deadline is initially marked as undone.

Example of usage:
Example of usage:

`todo go buy running shoes`
* `deadline get1004 slides /by 8/10/2019 0900`
* `deadline geh1049 essay /by 20/9/2019 1800`

Expected outcome:

```
Got it. I've added this task:
[T][✘] go buy running shoes
Now you have 1 task in the list.
[D][✘] geh1049 essay (by: 20/9/2019 1800)
Now you have 1 task in your list.
```

=== Adding an event task: `event <event> /at <start datetime> to <end datetime>`

Adds an event to the task list. The event is initially marked as undone.
Adds an event to the task list.

* The event is initially marked as undone.

Example of usage:
Example of usage:

`event student life fair /at 10/9/2019 1400 to 10/9/2019 1750`
* `event welcome dinner /at 22/9/2019 1800 to 22/9/2019 2200`
* `event student life fair /at 10/9/2019 1400 to 10/9/2019 1750`

Expected outcome:

Expand All @@ -63,151 +72,159 @@ Got it. I've added this task:
Now you have 1 task in your list.
```

=== Adding a deadline task: `deadline <task> /by <deadline>`
=== Adding todo task: `todo <task>`

Adds a todo task to the task list.

Adds a deadline to the task list. The deadline is initially marked as undone.
* The todo task is initially marked as undone.

Example of usage:
Example of usage:

`deadline geh1049 essay /by 20/9/2019 1800`
* `todo fix bugs in code`
* `todo go buy running shoes`

Expected outcome:

```
Got it. I've added this task:
[D][✘] geh1049 essay (by: 20/9/2019 1800)
Now you have 1 task in your list.
[T][✘] go buy running shoes
Now you have 1 task in the list.
```

=== Display task list: `list`
=== Display tasks with deadlines: `reminder`

Displays task list in numbered bullet point format.
Display all tasks with deadlines.

Example of usage:
Example of usage:

`list`
* `reminder`

Expected outcome:

```
Here are the tasks in your list:
1. [T][✘] go buy running shoes
2. [E][✘] student life fair (at: 10/09/2019 1400 to 10/09/2019 1750)
3. [D][✘] geh1049 essay (by: 20/9/2019 1800)
You currently have these deadlines.
1. [D][✘] health and wellness transcript (by: 19/09/2019 0800)
```

=== Mark task as done: `done <task number>`
=== Display schedule for a particular date: `schedule /for <date>`

Marks a task in the task list as done.
Displays the schedule for a specific day.

Example of usage:
Example of usage:

`done 1`
* `schedule /for 12/12/2019`

Expected outcome:

```
Nice! I've marked this task as done:
[T][✓] go buy running shoes
Here is your schedule for 12/12/2019:
1. [E][✘] NUSMUN (at: 10/12/2019 0900 to 13/12/2019 1900)
2. [D][✘] geh1049 essay (by: 12/12/2019 1800)
```

=== Remove task from task list: `delete <task number>`
=== Display task list: `list`

Removes task from task list.
Displays task list in numbered bullet point format.

Example of usage:
Example of usage:

`delete 1`
* `list`

Expected outcome:

```
Noted. I've removed this task:
[T][✓] go buy running shoes
Now you have 2 tasks in the list.
Here are the tasks in your list:
1. [T][✘] go buy running shoes
2. [E][✘] student life fair (at: 10/09/2019 1400 to 10/09/2019 1750)
3. [D][✘] geh1049 essay (by: 20/9/2019 1800)
```

=== Find tasks containing keyword: `find <keyword>`
=== Exiting the program: `bye`

Displays list of tasks containing keyword.
Exits the program.

Example of usage:
Example of usage:

`find geh1049`
* `bye`

Expected outcome:

```
Here are the matching tasks in your list:
1. [T][✓] geh1049 readings
2. [D][✘] geh1049 essay (by: 20/9/2019 1800)
Bye. Hope to see you again soon!
```

=== Display schedule for a paticular date: `schedule <date>`
=== Find tasks containing keyword: `find <keyword>`

Displays the schedule for a specific day. Time and task details are printed in a timetable. Ongoing events beginning before or lasting past the date are indicated below the timetable.
Displays list of tasks containing keyword.

* The search is case sensitive. eg `find geh1049` will not match `GEH1049`
* The order of the keywords matter. eg `find essay geh1049` will not match `geh1049 essay`
* If there is only one keyword, partial words will be matched. eg `find geh` will match `geh1049 essay`
* If there is more than one keyword, tasks matching all input keywords will be matched. eg `find geh essay` will match `geh essay on dengue` but not `geh1049 essay`.

Example of usage:
Example of usage:

`schedule 17/9/2019`
* `find geh1049`

Expected outcome:

```
Here is your schedule:
-----------------------------------------------------
| 17/9/2019 |
-----------------------------------------------------
| Time | Task |
-----------------------------------------------------
| 1400 | [E][Γ✘] student life fair |
-----------------------------------------------------
Here are your ongoing tasks:
1. [E][✘] health and wellness forum (at: 14/09/2019 1500 to 18/09/2019 1200)
Here are the matching tasks in your list:
1. [T][✓] geh1049 readings
2. [D][✘] geh1049 essay (by: 20/9/2019 1800)
```

=== Display tasks with deadlines: `reminder`
=== Mark task as done: `done <task number>`

Display all tasks with deadlines.
Marks task numbered `<task number>` in task list as done.

Example of usage:
* Task number in task list can be retrieved using `list` command.

`reminder`
Example of usage:

* `done 1`

Expected outcome:

```
You currently have these deadlines.
1. [D][✘] health and wellness transcript (by: 19/09/2019 0800)
Nice! I've marked this task as done:
[T][✓] go buy running shoes
```

=== Push back time bound tasks: `snooze <task number>`
=== Remove task from task list: `delete <task number>`

Removes task numbered `<task number>` in task list.

Adds a week to time bound task. Deadline and event timings are pushed back by a week.
* Task number in task list can be retrieved using `list` command.

Example of usage:
Example of usage:

`snooze 1`
* `delete 1`

Expected outcome:

```
Noted. I've snoozed this task:
[D][✘] health and wellness transcript (by: 26/09/2019 0800)
Noted. I've removed this task:
[T][✓] go buy running shoes
Now you have 2 tasks in the list.
```

=== Exiting the program: `bye`
=== Push back time bound tasks: `snooze <task number>`

Exits the program.
Adds a week to time bound task.

* Deadline and event timings are pushed back by a week.
* Task number in task list can be retrieved using `list` command.

Example of usage:
Example of usage:

`bye`
* `snooze 1`

Expected outcome:

```
Bye. Hope to see you again soon!
Noted. I've snoozed this task:
[D][✘] health and wellness transcript (by: 26/09/2019 0800)
```

== FAQ
Expand All @@ -217,14 +234,14 @@ Bye. Hope to see you again soon!

== Command Summary

. Add todo: `todo <task>`
. Add event: `event <event> /at <start datetime> to <end datetime>`
. Add deadline: `deadline <task> /by <deadline>`
. Add event: `event <event> /at <start datetime> to <end datetime>`
. Add todo: `todo <task>`
. Display deadlines: `reminder`
. Display schedule: `schedule <date>`
. Display tasks: `list`
. Exit: `bye`
. Find task: `find <keyword>`
. Mark as done: `done <task number>`
. Remove task: `delete <task number>`
. Find task: `find <keyword>`
. Display schedule: `schedule <date>`
. Display deadlines: `reminder`
. Snooze task: `snooze <task number>`
. Exit: `bye`
16 changes: 10 additions & 6 deletions src/main/java/duchess/logic/commands/ViewScheduleCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -39,8 +40,11 @@ public ViewScheduleCommand(List<String> words) throws DukeException {
*/
private Date processDate(String time) throws DukeException {
try {
// todo fix bug which allows input 'schedule 12/12/2019' without /for
String dateString = words.get(words.indexOf("/for") + 1) + time;
int index = words.indexOf("/for");
if (index == -1) {
throw new DukeException("Format for viewing schedule: schedule /for <date>");
}
String dateString = words.get(index + 1) + time;
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy HHmm");
formatter.setLenient(false);
return formatter.parse(dateString);
Expand All @@ -55,14 +59,14 @@ private Date processDate(String time) throws DukeException {
public void execute(TaskList taskList, Ui ui, Storage storage) throws DukeException {
List<Task> tasksForToday =
taskList.getTasks().stream()
.filter(task -> task.getTimeFrame().fallsWithin(this.timeFrame))
.collect(Collectors.toList());
.filter(task -> task.getTimeFrame().fallsWithin(this.timeFrame))
.collect(Collectors.toList());

if (tasksForToday.size() <= 0) {
throw new DukeException("There are no tasks in the schedule.");
}

tasksForToday.sort((a, b) -> a.getTimeFrame().compareTo(b.getTimeFrame()));
Collections.sort(tasksForToday);
ui.showScheduleResult(tasksForToday, words.get(words.indexOf("/for") + 1));
}
}
}
2 changes: 0 additions & 2 deletions src/main/java/duchess/model/TimeFrame.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package duchess.model;

import duchess.logic.commands.exceptions.DukeException;

import java.util.Date;

public class TimeFrame implements Comparable<TimeFrame> {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/duchess/model/task/Deadline.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ public String toString() {
public TimeFrame getTimeFrame() {
return TimeFrame.ofInstantaneousTask(this.deadline);
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/duchess/model/task/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ public String toString() {
public TimeFrame getTimeFrame() {
return new TimeFrame(this.start, this.end);
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/duchess/model/task/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ public final boolean clashesWith(Task that) {
public abstract List<Task> getReminders();

public abstract boolean containsKeyword(String keyword);
}
}
2 changes: 1 addition & 1 deletion src/main/java/duchess/model/task/Todo.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ public void snooze() throws DukeException {
public List<Task> getReminders() {
return new ArrayList<>();
}
}
}
Loading

0 comments on commit a7ff5d3

Please sign in to comment.