Skip to content

Commit

Permalink
Merge pull request nus-cs2103-AY2021S1#74 from MerlinLim/meeting-bug-fix
Browse files Browse the repository at this point in the history
Minor bug fixes
  • Loading branch information
MerlinLim authored Oct 18, 2020
2 parents 4cb5e84 + 9db3e74 commit f622931
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
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;

Expand All @@ -15,19 +16,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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand All @@ -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);
Expand Down

0 comments on commit f622931

Please sign in to comment.