diff --git a/build.gradle b/build.gradle
index d63c852e500..2e7639cebe5 100644
--- a/build.gradle
+++ b/build.gradle
@@ -16,6 +16,7 @@ repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
+
checkstyle {
toolVersion = '10.2'
}
@@ -70,7 +71,11 @@ dependencies {
}
shadowJar {
- archiveFileName = 'addressbook.jar'
+ archiveFileName = 'Dook.jar'
+}
+
+processResources {
+ duplicatesStrategy = 'exclude'
}
defaultTasks 'clean', 'test'
diff --git a/docs/UserGuide.md b/docs/UserGuide.md
index e340121a325..d13a2a70dc4 100644
--- a/docs/UserGuide.md
+++ b/docs/UserGuide.md
@@ -383,6 +383,13 @@ Format: `find KEYWORD [MORE_KEYWORDS]`
* Persons matching at least one keyword will be returned (i.e. `OR` search).
e.g. `Hans Bo` will return `Hans Gruber`, `Bo Yang`
+
+:information_source: **Information**
+
+For now, we can only `find` contacts by name - future implementations would include finding by other fields as well,
+so stay tuned!
+
+
Examples:
* `find John` returns `john` and `John Doe`
* `find alex david` returns `Alex Yeoh`, `David Li`
@@ -559,38 +566,50 @@ Please use this command with caution!
Dook comes preinstalled with a light and dark theme.
-![Dark Theme](images/darktheme.png)
-
-![Light Theme](images/lighttheme.png)
+Format: `theme -bg light/dark`
-Format: `-bg THEME(light/dark)`
-* changes the current theme to either dark/light
-* dark theme is the *default* on a new launch
-* Dook remembers your preferences!, it loads the most recent selected theme on launch.
+* Changes the current theme to either dark/light
+* Dark theme is the *default* on a new launch
+* Dook remembers your preferences, it loads the most recent selected theme on launch.
Examples:
* `theme -bg light`
-Any unknown theme will be met with an error message
+Below shows the application before executing `theme -bg light`:
+
+![Dark Theme](images/darktheme.png)
+
+Below shows the application after executing `theme -bg light`:
+
+![Light Theme](images/lighttheme.png)
+
+Below shows the error message upon executing an invalid theme:
![Theme_Command_Failure](images/themefailure.png)
+
+
:information_source: **Information**
+
New themes are currently being added.
+
+
### Adding aliases in Dook : `alias`
-#### **Warning! For advance users only**
+
-Dook allows the aliasing of whole commands to any input of the users choice
+**:exclamation: For advanced users only!**
-Format: `-al NEW_COMMAND -r COMMAND_TO_REPLACE`
+
+
+Dook allows the aliasing of whole commands to any input of the users choice:
-* commands like *theme -bg light* can be aliased to just *light* for convenience
-* aliases **cannot** be deleted as of the current version
-* aliases immediate tries to execute the replaced command, *does not work as a macro*
-* therefore aliases such as replacing **add -n** to **addn** does not work as intended, as add -n will be
-immediately executed and met by an error
+Format: `-al NEW_COMMAND -r COMMAND_TO_REPLACE`
+* Commands like *theme -bg light* can be aliased to just *light* for convenience
+* Aliases **cannot** be deleted as of the current version
+* Aliases immediately tries to execute the replaced command, *does not work as a macro*
+* Aliases such as replacing **add -n** to **addn** does not work as intended
### Exiting the program : `exit`
@@ -604,7 +623,7 @@ AddressBook data are saved automatically after any command that changes the data
### Editing the data file
-AddressBook data are saved automatically as a JSON file `[JAR file location]/data/addressbook.json`. Advanced users are welcome to update data directly by editing that data file.
+AddressBook data are saved automatically as a JSON file:
`[JAR file location]/data/addressbook.json`.
Advanced users are welcome to update data directly by editing that data file.
:exclamation: **Caution:**
If your changes to the data file makes its format invalid, AddressBook will discard all data and start with an empty data file at the next run. Hence, it is recommended to take a backup of the file before editing it.
@@ -615,17 +634,17 @@ Furthermore, certain edits can cause the AddressBook to behave in unexpected way
## FAQ
-**Q**: How do I install Java 11?
+**Q**: How do I install Java 11?
**A**: Follow this [link](https://docs.oracle.com/en/java/javase/11/install/overview-jdk-installation.html#GUID-8677A77F-231A-40F7-98B9-1FD0B48C346A) for steps to download Java 11.
**Q**: How do I transfer my data to another Computer?
**A**: Go to the application's home directory and copy the `data/addressbook.json` file containing your data into the empty
data folder created by Dook on the other computer.
-**Q**: Oh no! I have accidentally closed Dook without using the `exit` command? Do I lose all my data?
+**Q**: Oh no! I have accidentally closed Dook without using the `exit` command? Do I lose all my data?
**A**: Not to worry! Dook automatically saves all data after every change, so no data will be lost!
-**Q**: Do I need Internet connection to use Dook?
+**Q**: Do I need Internet connection to use Dook?
**A**: Nope! Dook works fully offline and online!
--------------------------------------------------------------------------------------------------------------------
diff --git a/src/main/java/seedu/address/commons/util/FileUtil.java b/src/main/java/seedu/address/commons/util/FileUtil.java
index b1e2767cdd9..8cde4b94064 100644
--- a/src/main/java/seedu/address/commons/util/FileUtil.java
+++ b/src/main/java/seedu/address/commons/util/FileUtil.java
@@ -18,7 +18,7 @@ public static boolean isFileExists(Path file) {
}
/**
- * Returns true if {@code path} can be converted into a {@code Path} via {@link Paths#get(String)},
+ * Returns true if {@code path} can be converted into a {@code Path},
* otherwise returns false.
* @param path A string representing the file path. Cannot be null.
*/
diff --git a/src/main/java/seedu/address/logic/commands/BookCommand.java b/src/main/java/seedu/address/logic/commands/BookCommand.java
index 4d8017eb3df..e634a4f61ae 100644
--- a/src/main/java/seedu/address/logic/commands/BookCommand.java
+++ b/src/main/java/seedu/address/logic/commands/BookCommand.java
@@ -32,6 +32,7 @@ public class BookCommand extends Command {
+ PREFIX_START_TIME + "2023-12-31 19:00 "
+ PREFIX_END_TIME + "2023-12-31 23:00 "
+ PREFIX_NOTES + "Bring cake";
+ public static final String MESSAGE_NOTE_MISSING = "Error: Please fill in a non-empty note!";
private final Booking toAdd;
/**
diff --git a/src/main/java/seedu/address/logic/commands/UpdateCommand.java b/src/main/java/seedu/address/logic/commands/UpdateCommand.java
index 7be28a52479..52265f23499 100644
--- a/src/main/java/seedu/address/logic/commands/UpdateCommand.java
+++ b/src/main/java/seedu/address/logic/commands/UpdateCommand.java
@@ -80,7 +80,7 @@ public CommandResult execute(Model model) throws CommandException {
model.setBooking(bookingToUpdate, updatedBooking);
model.updateFilteredBookingList(PREDICATE_SHOW_ALL_BOOKINGS);
- return new CommandResult(String.format(MESSAGE_UPDATE_BOOKING_SUCCESS, Messages.format(updatedBooking)));
+ return new CommandResult(String.format(MESSAGE_UPDATE_BOOKING_SUCCESS, Messages.format(bookingToUpdate)));
}
/**
diff --git a/src/main/java/seedu/address/logic/parser/BookCommandParser.java b/src/main/java/seedu/address/logic/parser/BookCommandParser.java
index afd90b6f0fe..2b0cb22d46b 100644
--- a/src/main/java/seedu/address/logic/parser/BookCommandParser.java
+++ b/src/main/java/seedu/address/logic/parser/BookCommandParser.java
@@ -36,6 +36,11 @@ public BookCommand parse(String args) throws ParseException {
argMultimap.verifyNoDuplicatePrefixesFor(PREFIX_DESCRIPTION, PREFIX_START_TIME, PREFIX_END_TIME, PREFIX_NOTES);
+ // If note field is empty
+ if (argMultimap.getValue(PREFIX_NOTES).isEmpty()) {
+ throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, BookCommand.MESSAGE_NOTE_MISSING));
+ }
+
Description description = ParserUtil.parseBookingName(argMultimap.getValue(PREFIX_DESCRIPTION).get());
StartTime start = ParserUtil.parseStartTime(argMultimap.getValue(PREFIX_START_TIME).get());
EndTime end = ParserUtil.parseEndTime(argMultimap.getValue(PREFIX_END_TIME).get());
diff --git a/src/main/java/seedu/address/model/booking/EndTime.java b/src/main/java/seedu/address/model/booking/EndTime.java
index 316bc924d5e..c9a747cba01 100644
--- a/src/main/java/seedu/address/model/booking/EndTime.java
+++ b/src/main/java/seedu/address/model/booking/EndTime.java
@@ -5,6 +5,7 @@
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
+
/**
* Represents a Booking's end time in the address book.
* Guarantees: immutable; is valid as declared in {@link #isValidEndTime(String)}
@@ -13,7 +14,7 @@ public class EndTime {
public static final String MESSAGE_CONSTRAINTS = "End times must be in the format of YYYY-MM-DD HH:MM "
+ "(ISO_LOCAL_DATE_TIME).";
- private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-M-d HH:mm");
+ private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
public final String endTimeString;
public final LocalDateTime endTime;
diff --git a/src/main/java/seedu/address/model/booking/StartTime.java b/src/main/java/seedu/address/model/booking/StartTime.java
index 9cf27066d43..e03a37b8942 100644
--- a/src/main/java/seedu/address/model/booking/StartTime.java
+++ b/src/main/java/seedu/address/model/booking/StartTime.java
@@ -5,6 +5,7 @@
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
+
/**
* Represents a Booking's start time in the address book.
* Guarantees: immutable; is valid as declared in {@link #isValidStartTime(String)}
@@ -13,7 +14,7 @@ public class StartTime {
public static final String MESSAGE_CONSTRAINTS = "Start times must be in the format of YYYY-MM-DD HH:MM "
+ "(ISO_LOCAL_DATE_TIME).";
- private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-M-d HH:mm");
+ private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
public final String startTimeString;
public final LocalDateTime startTime;
diff --git a/src/test/java/seedu/address/logic/commands/UpdateCommandTest.java b/src/test/java/seedu/address/logic/commands/UpdateCommandTest.java
index 53be0f25380..a9a8bb2010b 100644
--- a/src/test/java/seedu/address/logic/commands/UpdateCommandTest.java
+++ b/src/test/java/seedu/address/logic/commands/UpdateCommandTest.java
@@ -38,17 +38,18 @@ public class UpdateCommandTest {
@Test
public void execute_allFieldsSpecifiedUnfilteredList_success() {
+ Booking originalBooking = model.getFilteredBookingList().get(0);
Booking updatedBooking = new BookingBuilder().build();
UpdateBookingDescriptor descriptor = new UpdateBookingDescriptorBuilder(updatedBooking).build();
UpdateCommand updateCommand = new UpdateCommand(INDEX_FIRST_BOOKING, descriptor);
String expectedMessage = String.format(UpdateCommand.MESSAGE_UPDATE_BOOKING_SUCCESS,
- Messages.format(updatedBooking));
+ Messages.format(originalBooking));
Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()),
- new ProfData(model.getProfData()),
- new UserPrefs());
- expectedModel.setBooking(model.getFilteredBookingList().get(0), updatedBooking);
+ new ProfData(model.getProfData()),
+ new UserPrefs());
+ expectedModel.setBooking(originalBooking, updatedBooking);
assertCommandSuccess(updateCommand, model, expectedMessage, expectedModel);
}
@@ -69,16 +70,17 @@ public void execute_someFieldsSpecifiedUnfilteredList_success() {
UpdateCommand updateCommand = new UpdateCommand(indexLastBooking, descriptor);
String expectedMessage = String.format(UpdateCommand.MESSAGE_UPDATE_BOOKING_SUCCESS,
- Messages.format(updatedBooking));
+ Messages.format(lastBooking));
Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()),
- new ProfData(model.getProfData()),
- new UserPrefs());
+ new ProfData(model.getProfData()),
+ new UserPrefs());
expectedModel.setBooking(lastBooking, updatedBooking);
assertCommandSuccess(updateCommand, model, expectedMessage, expectedModel);
}
+
@Test
public void execute_noFieldSpecifiedUnfilteredList_success() {
UpdateCommand updateCommand = new UpdateCommand(INDEX_FIRST_BOOKING, new UpdateBookingDescriptor());
@@ -102,19 +104,21 @@ public void execute_filteredList_success() {
Booking updatedBooking =
new BookingBuilder(bookingInFilteredList).withDescription(VALID_BOOKING_DESCRIPTION).build();
UpdateCommand updateCommand = new UpdateCommand(INDEX_FIRST_BOOKING,
- new UpdateBookingDescriptorBuilder().withDescription(VALID_BOOKING_DESCRIPTION).build());
+ new UpdateBookingDescriptorBuilder()
+ .withDescription(VALID_BOOKING_DESCRIPTION).build());
String expectedMessage = String.format(UpdateCommand.MESSAGE_UPDATE_BOOKING_SUCCESS,
- Messages.format(updatedBooking));
+ Messages.format(bookingInFilteredList));
Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()),
- new ProfData(model.getProfData()),
- new UserPrefs());
- expectedModel.setBooking(model.getFilteredBookingList().get(0), updatedBooking);
+ new ProfData(model.getProfData()),
+ new UserPrefs());
+ expectedModel.setBooking(bookingInFilteredList, updatedBooking);
assertCommandSuccess(updateCommand, model, expectedMessage, expectedModel);
}
+
@Test
public void execute_duplicateBookingUnfilteredList_failure() {
Booking firstBooking = model.getFilteredBookingList().get(INDEX_FIRST_BOOKING.getZeroBased());
diff --git a/src/test/java/seedu/address/testutil/BookingBuilder.java b/src/test/java/seedu/address/testutil/BookingBuilder.java
index faf02f6e8ee..74e159b5c96 100644
--- a/src/test/java/seedu/address/testutil/BookingBuilder.java
+++ b/src/test/java/seedu/address/testutil/BookingBuilder.java
@@ -13,8 +13,8 @@
public class BookingBuilder {
public static final String DEFAULT_DESCRIPTION = "Default booking description";
- public static final String DEFAULT_START_TIME = "2023-12-31 19:00";
- public static final String DEFAULT_END_TIME = "2023-12-31 21:00";
+ public static final String DEFAULT_START_TIME = "2023-12-22 19:00";
+ public static final String DEFAULT_END_TIME = "2023-12-22 21:00";
public static final String DEFAULT_NOTE = "Hello World!";
private Description description;
diff --git a/src/test/java/seedu/address/testutil/TypicalBookings.java b/src/test/java/seedu/address/testutil/TypicalBookings.java
index f6990adadda..dd6a4be0851 100644
--- a/src/test/java/seedu/address/testutil/TypicalBookings.java
+++ b/src/test/java/seedu/address/testutil/TypicalBookings.java
@@ -20,26 +20,26 @@ public class TypicalBookings {
public static final Booking CAREER_ADVISORY = new BookingBuilder()
.withDescription("Career advisory consult")
- .withStartTime("2024-1-31 11:00")
- .withEndTime("2024-1-31 12:00")
+ .withStartTime("2024-01-12 11:00")
+ .withEndTime("2024-01-12 12:00")
.build();
public static final Booking CS2103T_CONSULT = new BookingBuilder()
.withDescription("CS2103T consult")
- .withStartTime("2024-3-31 14:00")
- .withEndTime("2024-3-31 16:00")
+ .withStartTime("2024-03-09 14:00")
+ .withEndTime("2024-03-09 16:00")
.build();
public static final Booking CS2101_CONSULT = new BookingBuilder()
.withDescription("CS2101 consult")
- .withStartTime("2024-3-24 14:00")
- .withEndTime("2024-3-24 16:00")
+ .withStartTime("2024-03-24 14:00")
+ .withEndTime("2024-03-24 16:00")
.build();
public static final Booking CS2109S_CONSULT = new BookingBuilder()
.withDescription("CS2109 consult")
- .withStartTime("2024-2-22 11:00")
- .withEndTime("2024-2-22 13:00")
+ .withStartTime("2024-05-22 11:00")
+ .withEndTime("2024-05-22 13:00")
.build();
public static final Booking GENERIC_BOOKING = new BookingBuilder()