From 7fb634be33a72fe8893b2340c1d366daec5405c4 Mon Sep 17 00:00:00 2001 From: Jie Xiang Date: Wed, 1 Nov 2023 00:22:16 +0800 Subject: [PATCH 1/5] Add sort meeting time command --- .../commands/SortMeetingTimeCommand.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/main/java/seedu/address/logic/commands/SortMeetingTimeCommand.java diff --git a/src/main/java/seedu/address/logic/commands/SortMeetingTimeCommand.java b/src/main/java/seedu/address/logic/commands/SortMeetingTimeCommand.java new file mode 100644 index 00000000000..948f48b9699 --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/SortMeetingTimeCommand.java @@ -0,0 +1,21 @@ +package seedu.address.logic.commands; + +import static java.util.Objects.requireNonNull; + +import seedu.address.model.Model; + +/** + * Lists persons in the address book sorted by their meeting times. + */ +public class SortMeetingTimeCommand extends Command { + + public static final String COMMAND_WORD = "sortmeeting"; + + public static final String MESSAGE_SUCCESS = "Sorted all meeting times chronologically"; + @Override + public CommandResult execute(Model model) { + requireNonNull(model); + model.sortFilteredPersonList(); + return new CommandResult(MESSAGE_SUCCESS); + } +} From 55bed28cff138834311780b7bcd1bdda91d12e22 Mon Sep 17 00:00:00 2001 From: Jie Xiang Date: Wed, 1 Nov 2023 00:24:41 +0800 Subject: [PATCH 2/5] Implement sort meeting time feature --- .../commands/SortMeetingTimeCommand.java | 5 ++++ .../logic/parser/AddressBookParser.java | 4 +++ src/main/java/seedu/address/model/Model.java | 2 ++ .../seedu/address/model/ModelManager.java | 21 ++++++++++++++- .../person/PersonMeetingTimeComparator.java | 26 +++++++++++++++++++ 5 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 src/main/java/seedu/address/model/person/PersonMeetingTimeComparator.java diff --git a/src/main/java/seedu/address/logic/commands/SortMeetingTimeCommand.java b/src/main/java/seedu/address/logic/commands/SortMeetingTimeCommand.java index 948f48b9699..1ae99550e59 100644 --- a/src/main/java/seedu/address/logic/commands/SortMeetingTimeCommand.java +++ b/src/main/java/seedu/address/logic/commands/SortMeetingTimeCommand.java @@ -2,7 +2,10 @@ import static java.util.Objects.requireNonNull; +import java.util.function.Predicate; + import seedu.address.model.Model; +import seedu.address.model.person.Person; /** * Lists persons in the address book sorted by their meeting times. @@ -12,6 +15,8 @@ public class SortMeetingTimeCommand extends Command { public static final String COMMAND_WORD = "sortmeeting"; public static final String MESSAGE_SUCCESS = "Sorted all meeting times chronologically"; + + public static final Predicate PREDICATE_HAS_MEETING_TIME = person -> person.getMeetingTime().isPresent(); @Override public CommandResult execute(Model model) { requireNonNull(model); diff --git a/src/main/java/seedu/address/logic/parser/AddressBookParser.java b/src/main/java/seedu/address/logic/parser/AddressBookParser.java index 8121dc888f3..697381272a5 100644 --- a/src/main/java/seedu/address/logic/parser/AddressBookParser.java +++ b/src/main/java/seedu/address/logic/parser/AddressBookParser.java @@ -22,6 +22,7 @@ import seedu.address.logic.commands.ListClientCommand; import seedu.address.logic.commands.ListCommand; import seedu.address.logic.commands.ListLeadCommand; +import seedu.address.logic.commands.SortMeetingTimeCommand; import seedu.address.logic.commands.ViewCommand; import seedu.address.logic.parser.exceptions.ParseException; @@ -101,6 +102,9 @@ public Command parseCommand(String userInput) throws ParseException { case ConvertLeadToClientCommand.COMMAND_WORD: return new ConvertLeadToClientCommandParser().parse(arguments); + case SortMeetingTimeCommand.COMMAND_WORD: + return new SortMeetingTimeCommand(); + default: logger.finer("This user input caused a ParseException: " + userInput); throw new ParseException(MESSAGE_UNKNOWN_COMMAND); diff --git a/src/main/java/seedu/address/model/Model.java b/src/main/java/seedu/address/model/Model.java index e97daf91eb9..80943c4757d 100644 --- a/src/main/java/seedu/address/model/Model.java +++ b/src/main/java/seedu/address/model/Model.java @@ -102,4 +102,6 @@ public interface Model { * Updates the filter of the filtered person list to just the specified person {@code predicate}. */ void view(Person clientToView); + + void sortFilteredPersonList(); } diff --git a/src/main/java/seedu/address/model/ModelManager.java b/src/main/java/seedu/address/model/ModelManager.java index 35789924b67..3e2b5cc8359 100644 --- a/src/main/java/seedu/address/model/ModelManager.java +++ b/src/main/java/seedu/address/model/ModelManager.java @@ -2,6 +2,7 @@ import static java.util.Objects.requireNonNull; import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; +import static seedu.address.logic.commands.SortMeetingTimeCommand.PREDICATE_HAS_MEETING_TIME; import java.nio.file.Path; import java.util.function.Predicate; @@ -9,11 +10,13 @@ import javafx.collections.ObservableList; import javafx.collections.transformation.FilteredList; +import javafx.collections.transformation.SortedList; import seedu.address.commons.core.GuiSettings; import seedu.address.commons.core.LogsCenter; import seedu.address.model.person.Client; import seedu.address.model.person.Lead; import seedu.address.model.person.Person; +import seedu.address.model.person.PersonMeetingTimeComparator; /** * Represents the in-memory model of the address book data. @@ -24,6 +27,7 @@ public class ModelManager implements Model { private final AddressBook addressBook; private final UserPrefs userPrefs; private final FilteredList filteredPersons; + private final SortedList sortedFilteredPersons; /** * Initializes a ModelManager with the given addressBook and userPrefs. @@ -36,6 +40,9 @@ public ModelManager(ReadOnlyAddressBook addressBook, ReadOnlyUserPrefs userPrefs this.addressBook = new AddressBook(addressBook); this.userPrefs = new UserPrefs(userPrefs); filteredPersons = new FilteredList<>(this.addressBook.getPersonList()); + + // default sortedFilteredPersons is identical to filteredPersons due to null comparator + sortedFilteredPersons = new SortedList<>(filteredPersons, null); } public ModelManager() { @@ -137,15 +144,27 @@ public void setPerson(Person target, Person editedPerson) { */ @Override public ObservableList getFilteredPersonList() { - return filteredPersons; + return sortedFilteredPersons; } @Override public void updateFilteredPersonList(Predicate predicate) { requireNonNull(predicate); + + // We need to set comparator to null first since PersonMeetingTimeComparator + // throws an exception when sorting Persons without a meeting time, + // thus passing a null comparator means the list will not be sorted. + sortedFilteredPersons.setComparator(null); + filteredPersons.setPredicate(predicate); } + @Override + public void sortFilteredPersonList() { + filteredPersons.setPredicate(PREDICATE_HAS_MEETING_TIME); + sortedFilteredPersons.setComparator(new PersonMeetingTimeComparator()); + } + @Override public boolean equals(Object other) { if (other == this) { diff --git a/src/main/java/seedu/address/model/person/PersonMeetingTimeComparator.java b/src/main/java/seedu/address/model/person/PersonMeetingTimeComparator.java new file mode 100644 index 00000000000..4260614ab40 --- /dev/null +++ b/src/main/java/seedu/address/model/person/PersonMeetingTimeComparator.java @@ -0,0 +1,26 @@ +package seedu.address.model.person; + +import java.util.Comparator; +import java.util.NoSuchElementException; + +/** + * Implements the comparator to sort Persons based on their meeting times. + */ +public class PersonMeetingTimeComparator implements Comparator { + + /** + * Compares the meeting times of two Person objects. + * Both Person objects should have a valid meeting time that is not null. + * + * @param person1 the first Person object to be compared. + * @param person2 the second Person object to be compared. + * @return The relative order of the Person objects. + */ + @Override + public int compare(Person person1, Person person2) throws NoSuchElementException { + MeetingTime meetingTime1 = person1.getMeetingTime().orElseThrow(); + MeetingTime meetingTime2 = person2.getMeetingTime().orElseThrow(); + + return meetingTime1.value.compareTo(meetingTime2.value); + } +} From ed934205fe406a0db912dd93b3e8f287816b6ab0 Mon Sep 17 00:00:00 2001 From: Jie Xiang Date: Wed, 1 Nov 2023 15:00:36 +0800 Subject: [PATCH 3/5] Update test cases --- .../typicalPersonsAddressBook.json | 8 ++-- .../logic/commands/AddClientCommandTest.java | 5 +++ .../logic/commands/AddCommandTest.java | 5 +++ .../logic/commands/AddLeadCommandTest.java | 5 +++ .../ConvertClientToLeadCommandTest.java | 5 +++ .../ConvertLeadToClientCommandTest.java | 13 +++++++ .../commands/SortMeetingTimeCommandTest.java | 30 +++++++++++++++ .../logic/parser/AddressBookParserTest.java | 23 +++++++++++ .../PersonMeetingTimeComparatorTest.java | 38 +++++++++++++++++++ .../address/testutil/TypicalPersons.java | 11 ++++-- 10 files changed, 135 insertions(+), 8 deletions(-) create mode 100644 src/test/java/seedu/address/logic/commands/SortMeetingTimeCommandTest.java create mode 100644 src/test/java/seedu/address/model/person/PersonMeetingTimeComparatorTest.java diff --git a/src/test/data/JsonSerializableAddressBookTest/typicalPersonsAddressBook.json b/src/test/data/JsonSerializableAddressBookTest/typicalPersonsAddressBook.json index 6d7ec18fb4e..6c5c53b1e37 100644 --- a/src/test/data/JsonSerializableAddressBookTest/typicalPersonsAddressBook.json +++ b/src/test/data/JsonSerializableAddressBookTest/typicalPersonsAddressBook.json @@ -16,7 +16,7 @@ "type": "client", "address" : "311, Clementi Ave 2, #02-25", "keyMilestone": null, - "meetingTime" : "12/12/2020 12:00", + "meetingTime" : "13/12/2020 12:00", "tags" : [ "owesMoney", "friends" ] }, { "name" : "Carl Kurz", @@ -25,7 +25,7 @@ "type": "client", "keyMilestone": null, "address" : "wall street", - "meetingTime" : null, + "meetingTime" : "12/12/2020 14:00", "tags" : [] }, { "name" : "Daniel Meier", @@ -43,7 +43,7 @@ "type": "lead", "keyMilestone": "01/12/2023", "address" : "michegan ave", - "meetingTime" : null, + "meetingTime" : "12/12/2020 12:00", "tags" : [] }, { "name" : "Fiona Kunz", @@ -61,7 +61,7 @@ "type": "lead", "keyMilestone": "01/12/2023", "address" : "4th street", - "meetingTime" : null, + "meetingTime" : "13/12/2020 08:00", "tags" : [] } ] } diff --git a/src/test/java/seedu/address/logic/commands/AddClientCommandTest.java b/src/test/java/seedu/address/logic/commands/AddClientCommandTest.java index e00a41583b0..6f42d1fe5d2 100644 --- a/src/test/java/seedu/address/logic/commands/AddClientCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/AddClientCommandTest.java @@ -170,6 +170,11 @@ public void updateFilteredPersonList(Predicate predicate) { throw new AssertionError("This method should not be called."); } + @Override + public void sortFilteredPersonList() { + throw new AssertionError("This method should not be called."); + } + @Override public void view(Person personToView) { throw new AssertionError("This method should not be called."); diff --git a/src/test/java/seedu/address/logic/commands/AddCommandTest.java b/src/test/java/seedu/address/logic/commands/AddCommandTest.java index 754fff4b07d..87867242a06 100644 --- a/src/test/java/seedu/address/logic/commands/AddCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/AddCommandTest.java @@ -203,6 +203,11 @@ public ObservableList getFilteredPersonList() { public void updateFilteredPersonList(Predicate predicate) { throw new AssertionError("This method should not be called."); } + + @Override + public void sortFilteredPersonList() { + throw new AssertionError("This method should not be called."); + } @Override public void view(Person personToView) { throw new AssertionError("This method should not be called."); diff --git a/src/test/java/seedu/address/logic/commands/AddLeadCommandTest.java b/src/test/java/seedu/address/logic/commands/AddLeadCommandTest.java index a7774e6542d..ad1596c8d74 100644 --- a/src/test/java/seedu/address/logic/commands/AddLeadCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/AddLeadCommandTest.java @@ -169,6 +169,11 @@ public ObservableList getFilteredPersonList() { public void updateFilteredPersonList(Predicate predicate) { throw new AssertionError("This method should not be called."); } + + @Override + public void sortFilteredPersonList() { + throw new AssertionError("This method should not be called."); + } @Override public void view(Person personToView) { throw new AssertionError("This method should not be called."); diff --git a/src/test/java/seedu/address/logic/commands/ConvertClientToLeadCommandTest.java b/src/test/java/seedu/address/logic/commands/ConvertClientToLeadCommandTest.java index 846d37edc08..a7d931ac0a9 100644 --- a/src/test/java/seedu/address/logic/commands/ConvertClientToLeadCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/ConvertClientToLeadCommandTest.java @@ -167,6 +167,11 @@ public ObservableList getFilteredPersonList() { public void updateFilteredPersonList(Predicate predicate) { throw new AssertionError("This method should not be called."); } + + @Override + public void sortFilteredPersonList() { + throw new AssertionError("This method should not be called."); + } } /** diff --git a/src/test/java/seedu/address/logic/commands/ConvertLeadToClientCommandTest.java b/src/test/java/seedu/address/logic/commands/ConvertLeadToClientCommandTest.java index b2829bf6f71..4dbef11fc91 100644 --- a/src/test/java/seedu/address/logic/commands/ConvertLeadToClientCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/ConvertLeadToClientCommandTest.java @@ -25,6 +25,7 @@ import seedu.address.model.person.Client; import seedu.address.model.person.Lead; import seedu.address.model.person.Person; +import seedu.address.model.person.PersonMeetingTimeComparator; import seedu.address.testutil.PersonBuilder; public class ConvertLeadToClientCommandTest { @@ -226,6 +227,18 @@ public void updateFilteredPersonList(Predicate person) { ); } + @Override + public void sortFilteredPersonList() { + Predicate meetingTimePredicate = person -> person.getMeetingTime().isPresent(); + + filteredPersons.setAll( + leadsAdded.stream() + .filter(meetingTimePredicate) + .sorted(new PersonMeetingTimeComparator()) + .collect(Collectors.toList()) + ); + } + @Override public void setPerson(Person target, Person converted) { leadsAdded.remove(target); diff --git a/src/test/java/seedu/address/logic/commands/SortMeetingTimeCommandTest.java b/src/test/java/seedu/address/logic/commands/SortMeetingTimeCommandTest.java new file mode 100644 index 00000000000..9a8be7a7472 --- /dev/null +++ b/src/test/java/seedu/address/logic/commands/SortMeetingTimeCommandTest.java @@ -0,0 +1,30 @@ +package seedu.address.logic.commands; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess; +import static seedu.address.logic.commands.SortMeetingTimeCommand.MESSAGE_SUCCESS; +import static seedu.address.testutil.TypicalPersons.BENSON; +import static seedu.address.testutil.TypicalPersons.CARL; +import static seedu.address.testutil.TypicalPersons.ELLE; +import static seedu.address.testutil.TypicalPersons.GEORGE; +import static seedu.address.testutil.TypicalPersons.getTypicalAddressBook; + +import java.util.Arrays; + +import org.junit.jupiter.api.Test; + +import seedu.address.model.Model; +import seedu.address.model.ModelManager; +import seedu.address.model.UserPrefs; + +public class SortMeetingTimeCommandTest { + private Model model = new ModelManager(getTypicalAddressBook(), new UserPrefs()); + private Model expectedModel = new ModelManager(getTypicalAddressBook(), new UserPrefs()); + + @Test + public void execute_sortPersonList_correctOrder() { + expectedModel.sortFilteredPersonList(); + assertCommandSuccess(new SortMeetingTimeCommand(), model, MESSAGE_SUCCESS, expectedModel); + assertEquals(Arrays.asList(ELLE, CARL, GEORGE, BENSON), model.getFilteredPersonList()); + } +} diff --git a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java index ca36dc729dd..f7071654657 100644 --- a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java +++ b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java @@ -19,6 +19,8 @@ import seedu.address.logic.commands.AddClientCommand; import seedu.address.logic.commands.AddLeadCommand; import seedu.address.logic.commands.ClearCommand; +import seedu.address.logic.commands.ConvertClientToLeadCommand; +import seedu.address.logic.commands.ConvertLeadToClientCommand; import seedu.address.logic.commands.DeleteCommand; import seedu.address.logic.commands.EditCommand; import seedu.address.logic.commands.EditCommand.EditLeadDescriptor; @@ -30,6 +32,7 @@ import seedu.address.logic.commands.ListClientCommand; import seedu.address.logic.commands.ListCommand; import seedu.address.logic.commands.ListLeadCommand; +import seedu.address.logic.commands.SortMeetingTimeCommand; import seedu.address.logic.commands.ViewCommand; import seedu.address.logic.parser.exceptions.ParseException; import seedu.address.model.person.Client; @@ -142,4 +145,24 @@ public void parseCommand_listClient() throws Exception { public void parseCommand_listLead() throws Exception { assertTrue(parser.parseCommand(ListLeadCommand.COMMAND_WORD) instanceof ListLeadCommand); } + + @Test + public void parseCommand_sortMeetingTime() throws Exception { + assertTrue(parser.parseCommand(SortMeetingTimeCommand.COMMAND_WORD) instanceof SortMeetingTimeCommand); + } + + @Test + public void parseCommand_convertLeadToClient() throws Exception { + ConvertLeadToClientCommand command = (ConvertLeadToClientCommand) parser.parseCommand( + ConvertLeadToClientCommand.COMMAND_WORD + " " + 3); + assertEquals(new ConvertLeadToClientCommand(Index.fromOneBased(3)), command); + } + + @Test + public void parseCommand_convertClientToLead() throws Exception { + ConvertClientToLeadCommand command = (ConvertClientToLeadCommand) parser.parseCommand( + ConvertClientToLeadCommand.COMMAND_WORD + " " + 3); + assertEquals(new ConvertClientToLeadCommand(Index.fromOneBased(3)), command); + } + } diff --git a/src/test/java/seedu/address/model/person/PersonMeetingTimeComparatorTest.java b/src/test/java/seedu/address/model/person/PersonMeetingTimeComparatorTest.java new file mode 100644 index 00000000000..45b5b068e8f --- /dev/null +++ b/src/test/java/seedu/address/model/person/PersonMeetingTimeComparatorTest.java @@ -0,0 +1,38 @@ +package seedu.address.model.person; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import java.util.NoSuchElementException; + +import org.junit.jupiter.api.Test; + +import seedu.address.testutil.TypicalPersons; + +public class PersonMeetingTimeComparatorTest { + + private final PersonMeetingTimeComparator comparator = new PersonMeetingTimeComparator(); + @Test + public void compare() { + Person personWithoutMeeting = TypicalPersons.ALICE; + Person personWithEarlierMeeting = TypicalPersons.ELLE; + Person personWithLaterMeeting = TypicalPersons.CARL; + + // first person has earlier meeting time -> returns -1 + assertEquals(comparator.compare(personWithEarlierMeeting, personWithLaterMeeting), -1); + + // both persons have same meeting time -> returns 0 + assertEquals(comparator.compare(personWithEarlierMeeting, personWithEarlierMeeting), 0); + + // second person has earlier meeting time -> returns 1 + assertEquals(comparator.compare(personWithLaterMeeting, personWithEarlierMeeting), 1); + + // one person has no meeting time -> throws + assertThrows(NoSuchElementException.class, () -> + comparator.compare(personWithoutMeeting, personWithEarlierMeeting)); + + // both persons have no meeting time -> throws + assertThrows(NoSuchElementException.class, () -> + comparator.compare(personWithoutMeeting, personWithoutMeeting)); + } +} diff --git a/src/test/java/seedu/address/testutil/TypicalPersons.java b/src/test/java/seedu/address/testutil/TypicalPersons.java index 87861a64f82..2d66cc5c162 100644 --- a/src/test/java/seedu/address/testutil/TypicalPersons.java +++ b/src/test/java/seedu/address/testutil/TypicalPersons.java @@ -35,22 +35,25 @@ public class TypicalPersons { public static final Client BENSON = new PersonBuilder().withName("Benson Meier") .withAddress("311, Clementi Ave 2, #02-25") .withEmail("johnd@example.com").withPhone("98765432") - .withMeetingTime("12/12/2020 12:00") + .withMeetingTime("13/12/2020 12:00") .withTags("owesMoney", "friends").buildClient(); public static final Client BENSON_NO_MEETING_TIME = new PersonBuilder().withName("Benson Meier") .withAddress("311, Clementi Ave 2, #02-25") .withEmail("johnd@example.com").withPhone("98765432") .withTags("owesMoney", "friends").buildClient(); public static final Client CARL = new PersonBuilder().withName("Carl Kurz").withPhone("95352563") - .withEmail("heinz@example.com").withAddress("wall street").buildClient(); + .withMeetingTime("12/12/2020 14:00").withEmail("heinz@example.com") + .withAddress("wall street").buildClient(); public static final Client DANIEL = new PersonBuilder().withName("Daniel Meier").withPhone("87652533") .withEmail("cornelia@example.com").withAddress("10th street").withTags("friends").buildClient(); public static final Lead ELLE = new PersonBuilder().withName("Elle Meyer").withPhone("9482224") - .withEmail("werner@example.com").withAddress("michegan ave").withKeyMilestone("01/12/2023").buildLead(); + .withEmail("werner@example.com").withAddress("michegan ave").withMeetingTime("12/12/2020 12:00") + .withKeyMilestone("01/12/2023").buildLead(); public static final Lead FIONA = new PersonBuilder().withName("Fiona Kunz").withPhone("9482427") .withEmail("lydia@example.com").withAddress("little tokyo").withKeyMilestone("01/12/2023").buildLead(); public static final Lead GEORGE = new PersonBuilder().withName("George Best").withPhone("9482442") - .withEmail("anna@example.com").withAddress("4th street").withKeyMilestone("01/12/2023").buildLead(); + .withEmail("anna@example.com").withAddress("4th street").withMeetingTime("13/12/2020 08:00") + .withKeyMilestone("01/12/2023").buildLead(); // Manually added public static final Client HOON = new PersonBuilder().withName("Hoon Meier").withPhone("8482424") From 1992a9b5ef5bd3318e8513f5104279a25b519374 Mon Sep 17 00:00:00 2001 From: Jie Xiang Date: Thu, 2 Nov 2023 00:34:24 +0800 Subject: [PATCH 4/5] Modify sample data to have varied meeting times --- .../seedu/address/model/util/SampleDataUtil.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/seedu/address/model/util/SampleDataUtil.java b/src/main/java/seedu/address/model/util/SampleDataUtil.java index 539da85fb42..9ca49e6a0d8 100644 --- a/src/main/java/seedu/address/model/util/SampleDataUtil.java +++ b/src/main/java/seedu/address/model/util/SampleDataUtil.java @@ -25,28 +25,28 @@ public class SampleDataUtil { public static Person[] getSamplePersons() { return new Person[] { new Client(new Name("Alex Yeoh"), new Phone("87438807"), new Email("alexyeoh@example.com"), - new Address("Blk 30 Geylang Street 29, #06-40"), Optional.of(new MeetingTime("10/10/2023 14:30")), + new Address("Blk 30 Geylang Street 29, #06-40"), Optional.of(new MeetingTime("12/10/2023 14:30")), getTagSet("friends")), new Client(new Name("Bernice Yu"), new Phone("99272758"), new Email("berniceyu@example.com"), new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"), - Optional.of(new MeetingTime("10/10/2023 14:30")), + Optional.empty(), getTagSet("colleagues", "friends")), new Client(new Name("Charlotte Oliveiro"), new Phone("93210283"), new Email("charlotte@example.com"), new Address("Blk 11 Ang Mo Kio Street 74, #11-04"), - Optional.of(new MeetingTime("10/10/2023 14:30")), + Optional.of(new MeetingTime("11/10/2023 13:30")), getTagSet("neighbours")), new Lead(new Name("David Li"), new Phone("91031282"), new Email("lidavid@example.com"), new Address("Blk 436 Serangoon Gardens Street 26, #16-43"), - new KeyMilestone("01/12/2023"), Optional.of(new MeetingTime("10/10/2023 14:30")), + new KeyMilestone("01/12/2023"), Optional.of(new MeetingTime("11/10/2023 10:30")), getTagSet("family")), new Lead(new Name("Irfan Ibrahim"), new Phone("92492021"), new Email("irfan@example.com"), new Address("Blk 47 Tampines Street 20, #17-35"), new KeyMilestone("01/12/2023"), - Optional.of(new MeetingTime("10/10/2023 14:30")), + Optional.empty(), getTagSet("classmates")), new Lead(new Name("Roy Balakrishnan"), new Phone("92624417"), new Email("royb@example.com"), new Address("Blk 45 Aljunied Street 85, #11-31"), - new KeyMilestone("01/12/2023"), Optional.of(new MeetingTime("10/10/2023 14:30")), + new KeyMilestone("01/12/2023"), Optional.of(new MeetingTime("12/10/2023 16:30")), getTagSet("colleagues")) }; } From a06a569c2579b470ef460aeceffa0fadd8a539d9 Mon Sep 17 00:00:00 2001 From: Jie Xiang Date: Thu, 2 Nov 2023 00:46:21 +0800 Subject: [PATCH 5/5] Clarify meeting time constraint message --- src/main/java/seedu/address/model/person/MeetingTime.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/seedu/address/model/person/MeetingTime.java b/src/main/java/seedu/address/model/person/MeetingTime.java index 5857861d9c6..2ccb8f8724d 100644 --- a/src/main/java/seedu/address/model/person/MeetingTime.java +++ b/src/main/java/seedu/address/model/person/MeetingTime.java @@ -13,7 +13,8 @@ public class MeetingTime { // Replace uuuu in format to yyyy to not confuse users public static final String MESSAGE_CONSTRAINTS = "Meeting time should be in the format of " - + DATE_TIME_FORMAT.replace("u", "y"); + + DATE_TIME_FORMAT.replace("u", "y") + + " and have a valid date and time"; public final LocalDateTime value;