From 6665b9ff40d6b7793d26fce66c27baae89e6c02a Mon Sep 17 00:00:00 2001 From: Brian030601 Date: Mon, 13 Nov 2023 15:10:37 +0800 Subject: [PATCH 1/6] Fix RepoSense --- src/main/java/seedu/duke/calendar/CalendarManager.java | 2 +- src/main/java/seedu/duke/calendar/Event.java | 4 +++- src/main/java/seedu/duke/calendar/command/EventCommand.java | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/seedu/duke/calendar/CalendarManager.java b/src/main/java/seedu/duke/calendar/CalendarManager.java index 187b887263..53d4d396f6 100644 --- a/src/main/java/seedu/duke/calendar/CalendarManager.java +++ b/src/main/java/seedu/duke/calendar/CalendarManager.java @@ -1,4 +1,4 @@ -//@@author Brian030601 & jingxizhu +//@@author Brian030601 package seedu.duke.calendar; diff --git a/src/main/java/seedu/duke/calendar/Event.java b/src/main/java/seedu/duke/calendar/Event.java index 77e6b5a372..868c5f5bdc 100644 --- a/src/main/java/seedu/duke/calendar/Event.java +++ b/src/main/java/seedu/duke/calendar/Event.java @@ -1,4 +1,4 @@ -//@@author Brian030601 & Cheezeblokz +//@@author Brian030601 package seedu.duke.calendar; @@ -9,6 +9,7 @@ public class Event { private LocalDateTime from; private LocalDateTime to; + //@@author Cheezeblokz // Event is a constructor method for Event class. public Event(String name, LocalDateTime from, LocalDateTime to) { this.name = name; @@ -16,6 +17,7 @@ public Event(String name, LocalDateTime from, LocalDateTime to) { this.to = to; } + //@@author Cheezeblokz // getName returns the name of the event. public String getName() { return name; diff --git a/src/main/java/seedu/duke/calendar/command/EventCommand.java b/src/main/java/seedu/duke/calendar/command/EventCommand.java index 1ddbf994c7..0c51a49f86 100644 --- a/src/main/java/seedu/duke/calendar/command/EventCommand.java +++ b/src/main/java/seedu/duke/calendar/command/EventCommand.java @@ -1,4 +1,4 @@ -//@@author Brian030601 & Cheezeblokz +//@@author Brian030601 package seedu.duke.calendar.command; From 8e62ec55e5089b61ec1722ce6c40eaeb78f58278 Mon Sep 17 00:00:00 2001 From: Wendelin Wemhoener Date: Mon, 13 Nov 2023 16:52:25 +0800 Subject: [PATCH 2/6] Add more exception-handling --- data/flashcards/flashcard.txt | 2 +- docs/team/wendelinwemhoener.md | 10 ++++- .../command/DeleteFlashcardCommand.java | 37 +++++++++++++++---- .../flashcard/command/StartReviewCommand.java | 9 +++-- .../exceptions/FlashcardException.java | 9 +++++ .../InvalidFlashcardIdException.java | 11 ++++++ .../InvalidReviewModeException.java | 10 +++++ 7 files changed, 74 insertions(+), 14 deletions(-) create mode 100644 src/main/java/seedu/duke/flashcard/exceptions/FlashcardException.java create mode 100644 src/main/java/seedu/duke/flashcard/exceptions/InvalidFlashcardIdException.java create mode 100644 src/main/java/seedu/duke/flashcard/exceptions/InvalidReviewModeException.java diff --git a/data/flashcards/flashcard.txt b/data/flashcards/flashcard.txt index 720cb83428..1e7395445a 100644 --- a/data/flashcards/flashcard.txt +++ b/data/flashcards/flashcard.txt @@ -1 +1 @@ -3 | dfdf | dfdf | 5 +2 | Hello | Duke | 5 diff --git a/docs/team/wendelinwemhoener.md b/docs/team/wendelinwemhoener.md index 047c7bb91b..d021ad3dbe 100644 --- a/docs/team/wendelinwemhoener.md +++ b/docs/team/wendelinwemhoener.md @@ -11,11 +11,17 @@ taking. ### Code Contribution See my code contribution [here on the tP Code Dashboard](https://nus-cs2113-ay2324s1.github.io/tp-dashboard/?search=wendelinwemhoener&breakdown=true) +- implemented architecture that my team reused +- made sure that build check and ui text testcase passed +- javadoc for all methods (except getters/setters and constructors) ### Contributions to the UG +- wrote the general sections + ### Contributions to the DG + ### Contributions to team-based tasks - I set up the GitHub team org, created the project board on GitHub and set @@ -26,5 +32,5 @@ See my code contribution [here on the tP Code Dashboard](https://nus-cs2113-ay23 - I documented target user profile and value proposition in UG/DG - I set up the Google Doc we used for coordinating the project in the initial phase -- I set up and administrated our Telegram chat group to allow for easy and - efficient communication +- I set up and administrated our Telegram chat group to allow for + efficient communication and coordinated our weekly meetings diff --git a/src/main/java/seedu/duke/flashcard/command/DeleteFlashcardCommand.java b/src/main/java/seedu/duke/flashcard/command/DeleteFlashcardCommand.java index 1989dcae5d..51489ffec9 100644 --- a/src/main/java/seedu/duke/flashcard/command/DeleteFlashcardCommand.java +++ b/src/main/java/seedu/duke/flashcard/command/DeleteFlashcardCommand.java @@ -3,6 +3,7 @@ package seedu.duke.flashcard.command; import seedu.duke.flashcard.FlashcardList; +import seedu.duke.flashcard.exceptions.InvalidFlashcardIdException; import java.util.Scanner; @@ -42,7 +43,25 @@ protected void executeBeginnerMode(Scanner scanner, return; } - deleteFlashcardById(flashcardId, flashcardList); + tryDeleteFlashcardById(flashcardId, flashcardList); + } + + /** + * Tries to delete a flashcard given its id and prints whether it worked. + * + * @param flashcardId The id of the flashcard to delete. + * @param flashcardList The list of flashcards to operate on. + */ + public void tryDeleteFlashcardById(int flashcardId, + FlashcardList flashcardList) { + try { + deleteFlashcardById(flashcardId, flashcardList); + } catch (InvalidFlashcardIdException e) { + System.out.println(" Couldn't find a flashcard with id " + + flashcardId); + System.out.println(" No deletion has been performed. Please " + + "try again with a valid id."); + } } /** @@ -61,20 +80,25 @@ protected void executeExpertMode(Scanner scanner, try { int flashcardId = Integer.parseInt(commandParts[2]); - deleteFlashcardById(flashcardId, flashcardList); + tryDeleteFlashcardById(flashcardId, flashcardList); } catch (NumberFormatException e) { System.out.println(" Invalid id! Id must be an integer"); } } /** - * Tries to delete a flashcard by id and prints whether it succeeded. + * Tries to delete a flashcard by id. + * + * If the deletion is successful, a success message is printed; + * otherwise, an exception is thrown. * * @param flashcardId The id of the flashcard to delete. * @param flashcardList The list of all known flashcards. + * @throws InvalidFlashcardIdException if flashcardId is invalid. */ private void deleteFlashcardById(int flashcardId, - FlashcardList flashcardList) { + FlashcardList flashcardList) + throws InvalidFlashcardIdException { boolean deletionWasSuccessful = flashcardList.deleteFlashcardById(flashcardId); @@ -82,10 +106,7 @@ private void deleteFlashcardById(int flashcardId, System.out.println(" Flashcard with id " + flashcardId + " has been successfully deleted."); } else { - System.out.println(" Couldn't find a flashcard with id " - + flashcardId); - System.out.println(" No deletion has been performed. Please " - + "try again with a valid id."); + throw new InvalidFlashcardIdException(); } } } diff --git a/src/main/java/seedu/duke/flashcard/command/StartReviewCommand.java b/src/main/java/seedu/duke/flashcard/command/StartReviewCommand.java index eee1e12588..ad89ecc66f 100644 --- a/src/main/java/seedu/duke/flashcard/command/StartReviewCommand.java +++ b/src/main/java/seedu/duke/flashcard/command/StartReviewCommand.java @@ -4,6 +4,7 @@ import seedu.duke.calendar.Calendar; import seedu.duke.flashcard.FlashcardList; +import seedu.duke.flashcard.exceptions.InvalidReviewModeException; import seedu.duke.flashcard.review.RandomReviewMode; import seedu.duke.flashcard.review.ReviewMode; import seedu.duke.flashcard.review.SpacedRepetitionReviewMode; @@ -90,12 +91,14 @@ protected void executeExpertMode(Scanner scanner, String choice = commandParts[2].toLowerCase(); if (!choices.contains(choice)) { - System.out.println(" Invalid choice! Your choice must be a" - + " or b! Please try again."); - return; + throw new InvalidReviewModeException(); } startReview(scanner, flashcardList, choice); + } catch (InvalidReviewModeException e) { + System.out.println(" Invalid choice! Your choice must be a" + + " or b! Please try again."); + return; } catch (IndexOutOfBoundsException e) { System.out.println(" Invalid syntax! The syntax is 'review " + "flashcards REVIEW_MODE'"); diff --git a/src/main/java/seedu/duke/flashcard/exceptions/FlashcardException.java b/src/main/java/seedu/duke/flashcard/exceptions/FlashcardException.java new file mode 100644 index 0000000000..58ad4cb36c --- /dev/null +++ b/src/main/java/seedu/duke/flashcard/exceptions/FlashcardException.java @@ -0,0 +1,9 @@ +//@@author wendelinwemhoener + +package seedu.duke.flashcard.exceptions; + +/** + * Base class for all custom exceptions related to flashcards. + */ +public class FlashcardException extends Exception { +} diff --git a/src/main/java/seedu/duke/flashcard/exceptions/InvalidFlashcardIdException.java b/src/main/java/seedu/duke/flashcard/exceptions/InvalidFlashcardIdException.java new file mode 100644 index 0000000000..da729d3ba4 --- /dev/null +++ b/src/main/java/seedu/duke/flashcard/exceptions/InvalidFlashcardIdException.java @@ -0,0 +1,11 @@ +//@@author wendelinwemhoener + +package seedu.duke.flashcard.exceptions; + +/** + * Exception for when a flashcardId is not valid (i.e. no flashcard with + * that id appears in the list of flashcards which are currently being + * worked on). + */ +public class InvalidFlashcardIdException extends FlashcardException { +} diff --git a/src/main/java/seedu/duke/flashcard/exceptions/InvalidReviewModeException.java b/src/main/java/seedu/duke/flashcard/exceptions/InvalidReviewModeException.java new file mode 100644 index 0000000000..5fc0bfafaa --- /dev/null +++ b/src/main/java/seedu/duke/flashcard/exceptions/InvalidReviewModeException.java @@ -0,0 +1,10 @@ +//@@author wendelinwemhoener + +package seedu.duke.flashcard.exceptions; + +/** + * Exception for when the input for choosing a flashcard review mode is + * incorrect. + */ +public class InvalidReviewModeException extends FlashcardException { +} From ff2ed435167f4caa33f8173f84e1a465486a9759 Mon Sep 17 00:00:00 2001 From: Wendelin Wemhoener Date: Mon, 13 Nov 2023 17:15:37 +0800 Subject: [PATCH 3/6] Added more logging --- data/flashcards/flashcard.txt | 2 ++ .../seedu/duke/flashcard/FlashcardCommandParser.java | 12 ++++++++++++ .../java/seedu/duke/flashcard/FlashcardList.java | 12 ++++++++++++ src/main/java/seedu/duke/flashcard/FlashcardUi.java | 10 ++++++++++ 4 files changed, 36 insertions(+) diff --git a/data/flashcards/flashcard.txt b/data/flashcards/flashcard.txt index 1e7395445a..687234aca0 100644 --- a/data/flashcards/flashcard.txt +++ b/data/flashcards/flashcard.txt @@ -1 +1,3 @@ 2 | Hello | Duke | 5 +3 | Hello | Duke | 5 +4 | Hello | Duke | 5 diff --git a/src/main/java/seedu/duke/flashcard/FlashcardCommandParser.java b/src/main/java/seedu/duke/flashcard/FlashcardCommandParser.java index cec901d612..8c28d303c5 100644 --- a/src/main/java/seedu/duke/flashcard/FlashcardCommandParser.java +++ b/src/main/java/seedu/duke/flashcard/FlashcardCommandParser.java @@ -11,11 +11,16 @@ import seedu.duke.flashcard.command.DeleteFlashcardCommand; import seedu.duke.flashcard.command.UnknownCommand; +import java.util.logging.Level; +import java.util.logging.Logger; + /** * Parses input entered by the user into a FlashcardCommand for further * processing. */ public class FlashcardCommandParser { + private Logger logger; + /** * Returns the FlashcardCommand corresponding to the passed input. * @@ -25,8 +30,13 @@ public class FlashcardCommandParser { public FlashcardCommand parseInput(String input, Calendar calendar) { assert input != null : "input must not be null"; + logger = Logger.getLogger("FlashcardCommandParser"); + logger.setLevel(Level.WARNING); + input = input.toLowerCase().strip(); + logger.log(Level.INFO, "trying to find matching FlashcardCommand"); + if (input.equals("create flashcard")) { return new CreateFlashcardCommand(); } else if (input.equals("list flashcards")) { @@ -39,6 +49,8 @@ public FlashcardCommand parseInput(String input, Calendar calendar) { return new DeleteFlashcardCommand(input); } + logger.log(Level.INFO, "input doesn't match any know command"); + return new UnknownCommand(); } } diff --git a/src/main/java/seedu/duke/flashcard/FlashcardList.java b/src/main/java/seedu/duke/flashcard/FlashcardList.java index 958867a5c6..a497e85c2e 100644 --- a/src/main/java/seedu/duke/flashcard/FlashcardList.java +++ b/src/main/java/seedu/duke/flashcard/FlashcardList.java @@ -3,6 +3,8 @@ package seedu.duke.flashcard; import java.util.ArrayList; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Container class for a list of flashcards. @@ -10,6 +12,7 @@ */ public class FlashcardList { private ArrayList flashcards; + private Logger logger; /** * Instantiates and returns a FlashcardList holding the passed flashcards. @@ -18,6 +21,9 @@ public class FlashcardList { */ public FlashcardList(ArrayList flashcards) { this.flashcards = flashcards; + + logger = Logger.getLogger("FlashcardUi"); + logger.setLevel(Level.WARNING); } public ArrayList getFlashcards() { @@ -46,6 +52,8 @@ public void add(Flashcard flashcard) { * Deletes all flashcards in the FlashcardList, effectively emptying it. */ public void deleteAllFlashcards() { + logger.log(Level.INFO, "clearing the list of flashcards"); + flashcards.clear(); assert flashcards.size() == 0 : "flashcardList should be empty now"; @@ -68,6 +76,8 @@ public boolean isEmpty() { * @return Whether the deletion was successful (true if successful). */ public boolean deleteFlashcardById(int flashcardId) { + logger.log(Level.INFO, "trying to delete flashcard by id"); + int indexToDeleteAt = -1; for (int i = 0; i < flashcards.size(); i++) { @@ -77,9 +87,11 @@ public boolean deleteFlashcardById(int flashcardId) { } if (indexToDeleteAt == -1) { + logger.log(Level.INFO, "deletion was unsuccessful"); return false; } else { flashcards.remove(indexToDeleteAt); + logger.log(Level.INFO, "successfully deleted flashcard"); return true; } } diff --git a/src/main/java/seedu/duke/flashcard/FlashcardUi.java b/src/main/java/seedu/duke/flashcard/FlashcardUi.java index c5f8678876..91891c6200 100644 --- a/src/main/java/seedu/duke/flashcard/FlashcardUi.java +++ b/src/main/java/seedu/duke/flashcard/FlashcardUi.java @@ -5,6 +5,8 @@ import seedu.duke.flashcard.command.FlashcardCommand; import java.util.Scanner; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Responsible for interfacing with the user by managing the dispatching of @@ -13,6 +15,7 @@ public class FlashcardUi { private Scanner scanner; private FlashcardList flashcardList; + private Logger logger; /** * Instantiates and returns a new FlashcardUi. @@ -24,6 +27,9 @@ public FlashcardUi(FlashcardList flashcardList) { assert flashcardList != null : "flashcardList cannot be null"; this.flashcardList = flashcardList; + + logger = Logger.getLogger("FlashcardUi"); + logger.setLevel(Level.WARNING); } /** @@ -34,7 +40,11 @@ public FlashcardUi(FlashcardList flashcardList) { * @param command The command that shall be executed. */ public void executeCommand(FlashcardCommand command) { + logger.log(Level.INFO, "executing the command"); + command.execute(scanner, flashcardList); + + logger.log(Level.INFO, "execution of command finished"); } /** From ff87cbeb49baae295910f395ff2f278449f3bacb Mon Sep 17 00:00:00 2001 From: Brian030601 Date: Mon, 13 Nov 2023 17:45:13 +0800 Subject: [PATCH 4/6] Fix Git Username --- docs/AboutUs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/AboutUs.md b/docs/AboutUs.md index 1e50ca0376..fe9d633a91 100644 --- a/docs/AboutUs.md +++ b/docs/AboutUs.md @@ -5,6 +5,6 @@ Display | Name | Github Profile | Portfolio --------|:------------------:|:--------------:|:---------: ![](https://media.licdn.com/dms/image/C4D03AQGTLbALYjG82Q/profile-displayphoto-shrink_800_800/0/1580629728751?e=1701907200&v=beta&t=PEfw_qZfZA39rJRfo5_Pg4o_RmbPwdneiPX3ftNt9dA) | Wendelin Wemhoener | [Github](https://github.com/wendelinwemhoener/) | [Portfolio](docs/team/wendelinwemhoener.md) ![](https://via.placeholder.com/100.png?text=Photo) | Zhu Jingxi | [Github](https://github.com/Cheezeblokz) | [Portfolio](docs/team/zhujingxi.md) -![](/Users/brian/Desktop/Colgate/NUS Fall 2023/CS2113/Team Project/docs/photo/kherlenbayasgalan.jpg) | Kherlen Bayasgalan | [Github](https://github.com/Brian030601) | [Portfolio](docs/team/Brian030601.md) +![](/Users/brian/Desktop/Colgate/NUS Fall 2023/CS2113/Team Project/docs/photo/kherlenbayasgalan.jpg) | Kherlen Bayasgalan | [Github](https://github.com/Brian030601) | [Portfolio](docs/team/brian030601.md) ![](https://via.placeholder.com/100.png?text=Photo) | Bang Junhyeong | [Github](https://github.com/junhyeong0411) | [Portfolio](docs/team/bangjunhyeong.md) ![](https://via.placeholder.com/100.png?text=Photo) | Don Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) From 3b55748336f2ab01bbd4b4649505e757b690fef3 Mon Sep 17 00:00:00 2001 From: Wendelin Wemhoener Date: Mon, 13 Nov 2023 19:19:11 +0800 Subject: [PATCH 5/6] Add links to DG --- docs/DeveloperGuide.md | 18 +++++++++++++++++- docs/team/wendelinwemhoener.md | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 92af184710..8c80fe954f 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -6,7 +6,23 @@ ## Design & implementation -{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} +### flashcard package + +The API of the flashcard package is defined in [FlashcardComponent.java](https://github.com/AY2324S1-CS2113-F11-3/tp/blob/master/src/main/java/seedu/duke/flashcard/FlashcardComponent.java). + +The flashcard package is structured into multiple parts: + +- [Flashcard.java](https://github.com/AY2324S1-CS2113-F11-3/tp/blob/master/src/main/java/seedu/duke/flashcard/Flashcard.java) +- [FlashcardCommandParser.java](https://github.com/AY2324S1-CS2113-F11-3/tp/blob/master/src/main/java/seedu/duke/flashcard/FlashcardCommandParser.java) +- [FlashcardComponent.java](https://github.com/AY2324S1-CS2113-F11-3/tp/blob/master/src/main/java/seedu/duke/flashcard/FlashcardComponent.java) +- [FlashcardDirectory.java](https://github.com/AY2324S1-CS2113-F11-3/tp/blob/master/src/main/java/seedu/duke/flashcard/FlashcardDirectory.java) +- [FlashcardList.java](https://github.com/AY2324S1-CS2113-F11-3/tp/blob/master/src/main/java/seedu/duke/flashcard/FlashcardList.java) +- [FlashcardUi.java](https://github.com/AY2324S1-CS2113-F11-3/tp/blob/master/src/main/java/seedu/duke/flashcard/FlashcardUi.java) +- [command package](https://github.com/AY2324S1-CS2113-F11-3/tp/tree/master/src/main/java/seedu/duke/flashcard/command) +- [exceptions package](https://github.com/AY2324S1-CS2113-F11-3/tp/tree/master/src/main/java/seedu/duke/flashcard/exceptions) +- [review package](https://github.com/AY2324S1-CS2113-F11-3/tp/tree/master/src/main/java/seedu/duke/flashcard/review) + + ### Storage Components diff --git a/docs/team/wendelinwemhoener.md b/docs/team/wendelinwemhoener.md index d021ad3dbe..50aad97a73 100644 --- a/docs/team/wendelinwemhoener.md +++ b/docs/team/wendelinwemhoener.md @@ -21,6 +21,8 @@ See my code contribution [here on the tP Code Dashboard](https://nus-cs2113-ay23 ### Contributions to the DG +product scope + ### Contributions to team-based tasks From 4f205aae26be8aab04ebb5acc22bceb033d2a4fe Mon Sep 17 00:00:00 2001 From: Brian030601 Date: Mon, 13 Nov 2023 19:57:16 +0800 Subject: [PATCH 6/6] Update UG --- data/events/event.txt | 5 +- docs/UserGuide.md | 218 +++++++++++++----- docs/team/brian030601.md | 2 +- .../calendar/command/AddEventCommand.java | 4 +- .../calendar/command/AddGoalEventCommand.java | 2 +- .../command/ListCalendarEventsCommand.java | 2 +- 6 files changed, 162 insertions(+), 71 deletions(-) diff --git a/data/events/event.txt b/data/events/event.txt index caf531b3fc..4d5463886c 100644 --- a/data/events/event.txt +++ b/data/events/event.txt @@ -1,4 +1 @@ -hello | 2023-12-20T12:30:30 | 2023-12-20T12:30:30 -EC3333 | 2023-12-20T12:30:30 | 2023-12-20T12:30:40 -Deadline | 2023-12-20T12:30:30 | 10 | 1 -More Deadline | 2023-12-20T12:30:30 | 20 | 1 +Do User | 2023-12-20T12:30:30 | 2023-12-20T13:30:30 diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 3c020f448c..6d50fa23e3 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -9,8 +9,8 @@ the courses they are taking. ## Quick Start 1. Ensure that you have Java 11 or above installed. -2. Down the latest jar from [the latest release on GitHub](https://github.com/AY2324S1-CS2113-F11-3/tp/releases). -3. Run the jar via `java -jar duke.jar` +2. Download the latest jar from [the latest release on GitHub](https://github.com/AY2324S1-CS2113-F11-3/tp/releases). +3. Run the jar file via `java -jar duke.jar` ## Features @@ -306,102 +306,181 @@ Enter your command: delete all flashcards All your flashcards have been successfully deleted. -### General Explanation of Calendar Features +### Calendar-related features -Here is your features list: - -+ `add event` , `delete event` -+ `list events` , `find event` -+ `delete all events` +#### General explanation of flashcards -Users can use the above features to handle their events +TaskLinker's calendar feature allows users to manage their time effectively +by adding, listing, finding, and deleting events. Events in the calendar have a +specified start and end time, making it easy for users to plan their schedules. +This feature is particularly useful for individuals with busy schedules or +those who want to keep track of their upcoming appointments or tasks. -#### Adding a todo: `todo` +The TaskLinker is also integrated with the flashcards and can be used for setting +a goal to review flashcards. Add goal event can be used to take user input for +setting a goal to review flashcards. -Adds a new item to the list of todo items. +Here is your features list: -Format: `todo n/TODO_NAME d/DEADLINE` ++ `add event` , `delete event` ++ `list events` , `find event` ++ `delete all events` , `add goal event` -* The `DEADLINE` can be in a natural language format. -* The `TODO_NAME` cannot contain punctuation. +Users can use the above features to handle their events` -Example of usage: +#### Adding an event to the calendar: `add event` -`todo n/Write the rest of the User Guide d/next week` +Adds an event to the calendar with start and end time. -`todo n/Refactor the User Guide to remove passive voice d/13/04/2020` +After entering this command, the user is asked to enter the event name on the calendar. +Once the name is given, the user should press ENTER to continue. Once the name is entered, +the user is prompted to give a start time and an end time for the event. +The start and the end time should be in an acceptable format (`yyyy-mm-ddThh:mm:ss`.) +If it is not in an acceptable format, (`Invalid date and time format. Please try again.`) +message will appear and prompt the user to enter a new start time. +Furthermore, the end time should be later than the start time as an event cannot +end before it's start time. If an earlier time is given for the end time than the +start time, the TaskLinker displays (`End time is before or equal to the start time. Please enter the correct end time.`) +message and starts over from (`Enter your command:`). -#### Add an Event to the Calendar +Format: +
+Enter your command: add event
+What's the event?: Name [Event Name]
+When does it start?: yyyy-mm-ddThh:mm:ss [Start Time]
+When does it end?: yyyy-mm-ddThh:mm:ss [End Time]
+
-**Adds an event to the calendar with start and end time** +Example of usage: +
+Enter your command: add event
+What's the event?: Do HW
+When does it start?: 2023-12-20T12:30:30
+When does it end?: 2023-12-20T13:40:30
 
-#### Usage
+Event 'Do HW' From: 2023-12-20T12:30:30, To: 2023-12-20T13:40:30 
+has been added to your Calendar
+
-+ Format: `add event` [Command] -+ What's the event?: `Event name` [Event name] -+ When does it start?: `yyyy-mm-ddThh:mm:ss` [Start time] -+ When does it end?: `yyyy-mm-ddThh:mm:ss` [End time] +#### Adding a goal event to the calendar: `add goal event` -**Example of usage**: +Adds a goal of reviewing flashcards as an event to the calendar. -+ `Enter your command: add event` -+ `What's the event?: Do HW` -+ `When does it start?: 2023-12-20T12:30:30` -+ `When does it end?: 2023-12-20T12:40:30` +After entering (`add goal event`) command, the user is asked to provide a name +for this goal event. After the name, the user is prompted to give an end time +for the event. The end time serves as a deadline for the goal. -#### Delete an Event From the Calendar +After the deadline has been given, then the goal should be given. Goal of reviewing +some number of flashcards by the given deadline. Same as adding an event, if an unacceptable +format of end time is given, the TaskLinker will display (`Invalid date and time format. Please try again.`) +message. -**deletes an event from the calendar with event name** +Format: +
+Enter your command: add goal event
+What's the event?: Name [Goal Name]
+When does it end?: yyyy-mm-ddThh:mm:ss [End Time]
+How many flashcard to review by then?: Number [# of flashcards to review]
+
-#### Usage +Example of usage: +
+Enter your command: add goal event
+What's the event?: Do Flashcards
+When does it end?: 2023-12-20T12:30:30
+How many flashcard to review by then?: 20
 
-+ Format: `delete event` 
-+ Enter the event name: `Event name` [Event name]
+Goal 'Do Flashcards' review 20 flashcards by: 2023-12-20T12:30:30 (Reviewed: 0) 
+has been added to your Calendar
+
-**Example of usage**: +#### Delete an event from the calendar: `delete event` -+ `Enter your command: delete event` -+ `Enter the event name: Do HW` +Deletes an event from the calendar with event name. -#### Delete All Events From the Calendar +After the (`delete event`) command has been given, the user is prompted to give +the name of the event he/she wants to delete from the calendar. If the given +event exist in the calendar, then TaskLinker will display (`[Event Name] has been deleted from your Calendar!`). +Then the event gets deleted from the event list. -**deletes all events from the calendar** +However, if the given event name doesn't exist in the calendar. Then the event +doesn't exist in the calendar message will display (`[Event Name] doesn't exist in your Calendar!`). +The user then enter a different command. -#### Usage +Format: +
+Enter your command: delete event
+What's the event?: Name [Event Name]
+    [Event Name] has been deleted from your Calendar!
+
-+ Format: `delete all events` +Example of usage: +
+Enter your command: delete event
+What's the event?: hello
+    hello has been deleted from your Calendar!
+
-**Example of usage**: +#### Delete all events from the Calendar: `delete all events` -+ `Enter your command: delete all events` +Deletes all events from the calendar. -#### Find an Event From the Calendar +Once the (`delete all events`) command has been given by the user, +the TaskLinker will clear all events in the calendar. If the exact +command is not entered, the feature will not work. -**finds an event from the calendar** +Format & Example: +
+Enter your command: delete all events
+    All your events have been successfully deleted from the Calendar.
+
-##### Usage +#### Find an event from the Calendar: `find event` -+ Format: `find event` -+ What event are you looking for?: `event name` +Finds an event from the calendar. -**Example of usage**: +Once the (`find event`) command has been entered, the user is prompted to +give the name of the event he/she is looking for. The input user gives can +just be partial name of the event. If so, the feature will list all +events that included the given input. -+ `Enter your command: find event` -+ `What event are you looking for?: Do HW` +However, if the given input is not found from the events in the Calendar, +then the (`No such event found`) message will be displayed. -#### List All Events From the Calendar +Format: +
+Enter your command: find event
+What's the event?: Name [Event Name]
+1. Event 'Event Name' From: yyyy-mm-ddThh:mm:ss, To: yyyy-mm-ddThh:mm:ss
+    These events have been found
+
-**Lists all events from the calendar** +Example of usage: +
+Enter your command: find event
+What's the event?: Do HW
+1. Event 'Do HW' From: 2023-12-20T12:30:30, To: 2023-12-20T13:30:30
+    These events have been found
+
-#### Usage +#### List all events from the Calendar: `list events` -+ Format: `list events` +Lists all events from the calendar -**Example of usage**: +Once the (`list events`) command has been entered, the TaskLinker lists +all the events in the event list. If there is no event in the event list, +the (`The Calendar is empty!`) message will be displayed. -+ `Enter your command: find event` +Format & Example: +
+Enter your command: list events
+    Here is a list of all your events: 
+--------------------------------------------------------------------------------
+1. Event 'Do User' From: 2023-12-20T12:30:30, To: 2023-12-20T13:30:30
+--------------------------------------------------------------------------------
+
## FAQ @@ -415,6 +494,14 @@ Every event and flashcard are automatically save after each command. **A**: You can transfer your data by copying & pasting the data folder. +**Q**: Why is the calendar features needed? + +**A**: The calendar features are used for adding a flashcard review and other goals. + +**Q**: Are the flashcard and the calendar use different commands? + +**A**: Yes, they have different command based on their features. + ## Command Summary * [Listing all flashcards](#listing-all-flashcards-list-flashcards): `list @@ -427,8 +514,15 @@ Every event and flashcard are automatically save after each command. flashcard` * [Deleting all flashcards](#deleting-all-flashcards-delete-all-flashcards) `delete all flashcards` -* Create an event: `add event` -* Delete an event: `delete event` -* Delete all events: `delete all events` -* Find an event: `find event` -* List events: `list events` +* [Create an event](#adding-an-event-to-the-calendar-add-event): + `add event` +* [Add a goal event](#adding-a-goal-event-to-the-calendar-add-goal-event): + `add goal event` +* [Delete an event](#delete-an-event-from-the-calendar-delete-event): + `delete event` +* [Delete all events](#delete-all-events-from-the-calendar-delete-all-events): + `delete all events` +* [Find an event](#find-an-event-from-the-calendar-find-event): + `find event` +* [List all events](#list-all-events-from-the-calendar-list-events): + `list events` diff --git a/docs/team/brian030601.md b/docs/team/brian030601.md index 91f6b8cd2e..1cb9b0c583 100644 --- a/docs/team/brian030601.md +++ b/docs/team/brian030601.md @@ -1,4 +1,4 @@ -# Kherlen Bayasgalan (brian030601) - Project Portfolio Page +# Kherlen Bayasgalan (Brian030601) - Project Portfolio Page ## Overview diff --git a/src/main/java/seedu/duke/calendar/command/AddEventCommand.java b/src/main/java/seedu/duke/calendar/command/AddEventCommand.java index 2f70cffe04..c9d8f7f9b5 100644 --- a/src/main/java/seedu/duke/calendar/command/AddEventCommand.java +++ b/src/main/java/seedu/duke/calendar/command/AddEventCommand.java @@ -49,7 +49,7 @@ public void executeBeginnerMode(Scanner scanner, EventList eventList) { if (endTime.isAfter(startTime)) { Event event = new Event(eventName, startTime, endTime); eventList.addEvent(event); - System.out.println(event + " has been added to your Calendar"); + System.out.println(" " + event + " has been added to your Calendar"); } else { System.out.println(" End time is before or equal to the start time. Please enter the correct end time."); } @@ -66,7 +66,7 @@ protected void executeExpertMode(Scanner scanner, EventList eventList) { if (endTime.isAfter(startTime)) { Event event = new Event(eventName, startTime, endTime); eventList.addEvent(event); - System.out.println(event + " has been added to your Calendar"); + System.out.println(" " + event + " has been added to your Calendar"); } else { System.out.println(" End time is before or equal to the start time. " + "Please enter the correct end time."); diff --git a/src/main/java/seedu/duke/calendar/command/AddGoalEventCommand.java b/src/main/java/seedu/duke/calendar/command/AddGoalEventCommand.java index 43114fc792..b2149abc38 100644 --- a/src/main/java/seedu/duke/calendar/command/AddGoalEventCommand.java +++ b/src/main/java/seedu/duke/calendar/command/AddGoalEventCommand.java @@ -24,7 +24,7 @@ public void executeBeginnerMode(Scanner scanner, EventList eventList) { String eventName = scanner.nextLine(); LocalDateTime endTime = parseDateTimeInput(scanner, - "When does it end? (yyyy-MM-ddTHH:mm:ss) (e.g., 2023-12-20T12:30:30): "); + "What is the deadline? (yyyy-MM-ddTHH:mm:ss) (e.g., 2023-12-20T12:30:30): "); int goal = parseIntegerInput(scanner, "How many flashcard to review by then?: "); diff --git a/src/main/java/seedu/duke/calendar/command/ListCalendarEventsCommand.java b/src/main/java/seedu/duke/calendar/command/ListCalendarEventsCommand.java index 7dc2bfd913..bd3bf643b4 100644 --- a/src/main/java/seedu/duke/calendar/command/ListCalendarEventsCommand.java +++ b/src/main/java/seedu/duke/calendar/command/ListCalendarEventsCommand.java @@ -22,7 +22,7 @@ public class ListCalendarEventsCommand extends EventCommand{ public void execute(Scanner scanner, EventList eventList) { if (eventList.getSize() > 0) { - System.out.println("Here is a list of all your events: "); + System.out.println(" Here is a list of all your events: "); printLine(); int count = 0;