Skip to content

Commit

Permalink
Merge branch 'branch-A-UserGuide'
Browse files Browse the repository at this point in the history
  • Loading branch information
Pluiexo authored and Pluiexo committed Feb 22, 2024
2 parents 1e65633 + 5bfa08a commit 44da68d
Show file tree
Hide file tree
Showing 7 changed files with 217 additions and 17 deletions.
218 changes: 204 additions & 14 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,220 @@
# Duke User Guide
<h1>Plato User Guide <img src="headerIcon.png" alt = "plato" width="70" height="70" style="margin-left: 30px; margin-top:30px"> </h1>

// Update the title above to match the actual product name
---

// Product screenshot goes here
![This is the product](Ui.png)

// Product intro goes here
Plato is a desktop application for managing your everyday task, optimised with CLI-like(Command Line Interface) inputs, it
delivers a beautiful smart personal assistant to interact with.

## Adding deadlines

// Describe the action and its outcome.
# Table of Contents
1. [Features](#features)
1. [Add Task](#add-task)
* [Todo](#todo)
* [Deadline](#deadline)
* [Event](#event)
* [Specification for DateTimeFormat](#specification-for-datetimeformat)
2. [Manage Task](#manage-task)
3. [Query Task](#query-task)
* [Find](#find)
* [View](#view)
2. [Save Information](#saving-the-data)
3. [Extra information](#credits)

// Give examples of usage
---
# Features

Example: `keyword (optional arguments)`

// A description of the expected outcome goes here

## Add Task

Adds a task to the current task list
There are three types of task you can add, todo, deadline and event.

### Todo

The todo task just contains a description of the task.
Usage: `todo [DESCRIPTION]`

Examples:

* `todo Cook Dinner`

* `todo Read Book`

Expected outcome:
```
Got it. I've added this task:
[T][ ] Cook Dinner
Now you got 1 tasks in your list.
```

### Deadline

The deadline task is a a todo task with a date to complete by.

Usage: `deadline [DESCRIPTION] /by [DateTimeFormat]`

<sub>**Refer to the section below for the specification of [DateTimeFormat]**</sub>

Examples:

* `deadline cs3230 /by 2359 23/02/2024`

* `deadline cs2103 /by 23:59 23-02-24`

Expected outcome:
```
Got it. I've added this task:
[D][ ] cs3230 (by:23-02-2024 23:59)
Now you got 2 tasks in your list.
```

### Event

The event task is a todo task that spans a period of time.

Usage:
`event [DESCRIPTION] /from [DateTimeFormat] /to [DateTimeFormat]`

<sub>**Refer to the section below for the specification of [DateTimeFormat]**</sub>

Examples:

* `event cs2103 planning /from 1800 24/02/24 /to 1900 27/02/24`

* `event midterm study session /from 01:00pm 28-02-24 /to 02:00pm 30-02-24`

Expected outcome:
```
Got it. I've added this task:
[E][ ] cs2103 planning (from:23-02-2024 18:00)
Now you got 3 tasks in your list.
```
### Specification for `[DateTimeFormat]`

It comes in two parts `[DateFormats]` and `[TimeFormats]`.
`[TimeFormats]` can be omitted and Plato will assume the time to be midnight of that particular day.

The order of the `[DateFormats]` and `[TimeFormats]` does not matter as long as a space between them to differentiate the two

> If your [DateTimeFormat] is invalid, Plato will store them as normal strings instead ,this is to support a wider variety of users.
> This will affect the Query:view command later.
Usage:
```
[DateFormats]
[DateFormats] [TimeFormats]
[TimeFormats] [DateFormats]
```

Examples :
```
12-04-24 1800
03:30pm 15/03/2024
```
expected output

Current acceptable **[DateFormats]** are :
```
dd-mm-yy
dd/mm/yy
dd-mm-yyyy
dd/mm/yyyy
```

> [!NOTE]
> If the year used is 2 digits, Plato will assume the year in the current millennium
Current acceptable **[TimeFormats]** in 12 or 24 hour formats are allowed as follows:
```
HHMM
HH:MM
HH:MM[am/pm]
```
> [!CAUTION]
> Time written in 12-hour format requires specifying am/pm. Otherwise, Plato will assume 24-hour format.

---

## Manage Task
You can modify existing task with unmark, mark, delete at the particular index.
Usages:
```
umark [INDEX]
mark [INDEX]
delete [INDEX]
```

Examples:
```
mark 1
delete 3
```

Expected outcome:
```
Nice! I've marked this task as done:
[T][X] Cook dinner
Noted. I've removed this task
[E][ ] cs2103 planning (from:23-02-2024 18:00)
Now you have 2 taks in the list
```
---

## Query Task

When you know specific information about task and you wish to find a specific task by their attributes.

### Find

Finds in the description of each task if it matches the keyword

Usage: `find [KEYWORD]`

### View

View the all the task being scheduled on that date.

Usage: `view [DateFormats]`

<sub>**Refer to the section above for the specification of [DateFormat]**</sub>

> If your [DateTimeFormat] is invalid when adding the task, Plato will not show them in the results when you try to search for it.
Examples:
```
find Cook
view 23-02-24
```

Expected outcome:
```
Here are the matching task in your list:
1. [T][X] Cook dinner
Here are the task scheduled on that date:
1. [E][ ] cs2103 planning (from:23-02-2024 18:00)
```

---

# Saving the data

Plato's data are saved in the hard disk automatically at an fixed interval. There is no need to save manually.

---

# Editing the data file

## Feature ABC
Plato's data are saved automatically as a .txt file `[JAR file location]/data/tasks.txt`. Advanced users are welcome to update or import their own data.

// Feature details

> [!WARNING]
> If your file changes to data file is of an invalid format. Plato will flush out the old data and start afresh.
## Feature XYZ
# Credits
All images used are artworks of my own!

// Feature details
Binary file added docs/Ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/headerIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/main/java/plato/parser/DateHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ public static Optional<LocalDate> checkDate(String testDate) throws PlatoExcepti
* @return An Optional that contains LocalTime if it exists.
*/
public static Optional<LocalTime> checkTime(String testTime) throws PlatoException {
//Remove the date so that it is easier to check for the time, and prevent conflicts
Matcher removeDate = PATTERN_DATE.matcher(testTime);
if (removeDate.find()) {
testTime = testTime.replaceAll(removeDate.group(), "");
}

Matcher match = TIME_PATTERN.matcher(testTime);
Matcher am = Pattern.compile("(?i)[ap]m").matcher(testTime);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/plato/task/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public String toString() {
if (byDateTime == null) {
return "[E]" + super.toString() + " (from: " + from + " to " + by + ")";
} else {
return "[E]" + super.toString() + " (from: " + DateHandler.formatDate(fromDateTime) + " to "
return "[E]" + super.toString() + " (from: " + DateHandler.formatDate(fromDateTime) + " to: "
+ DateHandler.formatDate(byDateTime) + ")";
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/plato/task/TaskManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public class TaskManager {
private static final String RESPONSE_UMARK = "OK, I've marked this task as not done yet:";
private static final String RESPONSE_REMOVE = "Noted. I've removed this task";
private static final String RESPONSE_ADD = "Got it. I've added this task:";
private static final String RESPONSE_FIND = "Here are the matching tasks in your list";
private static final String RESPONSE_VIEW_DATES = "Here are the task scheduled on that date!!";
private static final String RESPONSE_FIND = "Here are the matching tasks in your list: ";
private static final String RESPONSE_VIEW_DATES = "Here are the task scheduled on that date: ";

private static final String RESPONSE_EMPTY = "You have no tasks!!!! Add something to do you peasant!! ";
private static final String RESPONSE_EMPTY_SEARCH = "Sorry I couldn't find anything that fits that search :(";
Expand Down
5 changes: 5 additions & 0 deletions src/test/java/plato/parser/DateHandlerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@ public void check_date_success() throws PlatoException {
public void checkTime_success() throws PlatoException {
assertEquals(LocalTime.of(18, 0), DateHandler.checkTime("1800 12-04-23").orElse(LocalTime.of(0, 0)));
}

@Test
public void checkTime_dateyearfull_success() throws PlatoException {
assertEquals(LocalTime.of(23, 59), DateHandler.checkTime("2359 15/02/2024").orElse(LocalTime.of(0, 0)));
}
}

0 comments on commit 44da68d

Please sign in to comment.