From 22c536b163b0d849d3cc088aa02f86d8dd11f99f Mon Sep 17 00:00:00 2001 From: MerlinLim Date: Sun, 18 Oct 2020 12:14:09 +0800 Subject: [PATCH 1/2] Minor bug fixes Fix AddCommand error messages --- .../address/logic/commands/meeting/AddCommand.java | 14 ++++++-------- .../logic/parser/meeting/AddCommandParser.java | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main/java/seedu/address/logic/commands/meeting/AddCommand.java b/src/main/java/seedu/address/logic/commands/meeting/AddCommand.java index a157e8f38ef..f8106fb616e 100644 --- a/src/main/java/seedu/address/logic/commands/meeting/AddCommand.java +++ b/src/main/java/seedu/address/logic/commands/meeting/AddCommand.java @@ -1,11 +1,7 @@ package seedu.address.logic.commands.meeting; import static java.util.Objects.requireNonNull; -import static seedu.address.logic.parser.meeting.CliSyntax.PREFIX_CONTACTS; -import static seedu.address.logic.parser.meeting.CliSyntax.PREFIX_DESCRIPTION; -import static seedu.address.logic.parser.meeting.CliSyntax.PREFIX_FROM; -import static seedu.address.logic.parser.meeting.CliSyntax.PREFIX_TITLE; -import static seedu.address.logic.parser.meeting.CliSyntax.PREFIX_TO; +import static seedu.address.logic.parser.meeting.CliSyntax.*; import seedu.address.logic.commands.CommandResult; import seedu.address.logic.commands.exceptions.CommandException; @@ -15,19 +11,21 @@ public class AddCommand extends Command { public static final String COMMAND_WORD = "add"; - public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a meeting to the meeting book." + public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a meeting to the meeting book. " + "Parameters: " + PREFIX_TITLE + "TITLE " + PREFIX_DESCRIPTION + "DESCRIPTION " + PREFIX_FROM + "FROM " + PREFIX_TO + "TO " - + PREFIX_CONTACTS + "CONTACTS" + + PREFIX_CONTACTS + "CONTACTS " + + PREFIX_LOCATION + "LOCATION " + "Example: " + COMMAND_WORD + " " + PREFIX_TITLE + "Discuss user requirements with biz associates " + PREFIX_DESCRIPTION + "Refer to the reviewed user stories during discussion " + PREFIX_FROM + "2020-12-31 12:00" + PREFIX_TO + "2020-12-31 14:00 " - + PREFIX_CONTACTS + "1 3 5 "; + + PREFIX_CONTACTS + "1 3 5 " + + PREFIX_LOCATION + "Room 1A"; public static final String MESSAGE_SUCCESS = "New meeting added: %1$s"; public static final String MESSAGE_DUPLICATE_MEETING = "This meeting already exists in the meeting book"; diff --git a/src/main/java/seedu/address/logic/parser/meeting/AddCommandParser.java b/src/main/java/seedu/address/logic/parser/meeting/AddCommandParser.java index 68684628839..a14ba2e87d1 100644 --- a/src/main/java/seedu/address/logic/parser/meeting/AddCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/meeting/AddCommandParser.java @@ -39,7 +39,7 @@ public AddCommand parse(String args) throws ParseException { ArgumentTokenizer.tokenize(args, PREFIX_TITLE, PREFIX_DESCRIPTION, PREFIX_TO, PREFIX_FROM, PREFIX_CONTACTS, PREFIX_LOCATION); - if (!arePrefixesPresent(argMultimap, PREFIX_TITLE, PREFIX_FROM) + if (!arePrefixesPresent(argMultimap, PREFIX_TITLE, PREFIX_FROM, PREFIX_TO) || !argMultimap.getPreamble().isEmpty()) { throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddCommand.MESSAGE_USAGE)); } @@ -48,8 +48,8 @@ public AddCommand parse(String args) throws ParseException { OptionalDescription description = ParserCommon.parseDescription(argMultimap.getValue(PREFIX_DESCRIPTION)); From from = ParserUtil.parseFrom(argMultimap.getValue(PREFIX_FROM).get()); To to = ParserUtil.parseTo(argMultimap.getValue(PREFIX_TO).get()); - Location location = ParserUtil.parseLocation(argMultimap.getValue(PREFIX_LOCATION)); Contacts contacts = ParserCommon.parseContacts(argMultimap.getValue(PREFIX_CONTACTS)); + Location location = ParserUtil.parseLocation(argMultimap.getValue(PREFIX_LOCATION)); Meeting meeting = new Meeting(title, description, from, to, contacts, location); return new AddCommand(meeting); From 9db3e745b36b7f664bd281449ab73d59d4450ff2 Mon Sep 17 00:00:00 2001 From: MerlinLim Date: Sun, 18 Oct 2020 12:18:11 +0800 Subject: [PATCH 2/2] Fix CheckStyle --- .../seedu/address/logic/commands/meeting/AddCommand.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/seedu/address/logic/commands/meeting/AddCommand.java b/src/main/java/seedu/address/logic/commands/meeting/AddCommand.java index f8106fb616e..224013f3d21 100644 --- a/src/main/java/seedu/address/logic/commands/meeting/AddCommand.java +++ b/src/main/java/seedu/address/logic/commands/meeting/AddCommand.java @@ -1,7 +1,12 @@ package seedu.address.logic.commands.meeting; import static java.util.Objects.requireNonNull; -import static seedu.address.logic.parser.meeting.CliSyntax.*; +import static seedu.address.logic.parser.meeting.CliSyntax.PREFIX_CONTACTS; +import static seedu.address.logic.parser.meeting.CliSyntax.PREFIX_DESCRIPTION; +import static seedu.address.logic.parser.meeting.CliSyntax.PREFIX_FROM; +import static seedu.address.logic.parser.meeting.CliSyntax.PREFIX_LOCATION; +import static seedu.address.logic.parser.meeting.CliSyntax.PREFIX_TITLE; +import static seedu.address.logic.parser.meeting.CliSyntax.PREFIX_TO; import seedu.address.logic.commands.CommandResult; import seedu.address.logic.commands.exceptions.CommandException;