Skip to content

Commit

Permalink
Merge pull request #182 from HolmesJJ/fix-bugs
Browse files Browse the repository at this point in the history
Fix issue #161 #162 #165 #169
  • Loading branch information
zzybluebell authored Nov 4, 2021
2 parents 8011dbe + 5fd10c3 commit 39d1bd1
Show file tree
Hide file tree
Showing 30 changed files with 223 additions and 128 deletions.
7 changes: 5 additions & 2 deletions src/main/java/seedu/address/logic/commands/AddCommand.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package seedu.address.logic.commands;

import static seedu.address.logic.parser.CliSyntax.PREFIX_MEMBER;
import static seedu.address.logic.parser.CliSyntax.PREFIX_RESERVATION;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TRANSACTION;

import seedu.address.logic.commands.exceptions.CommandException;
Expand All @@ -12,10 +13,12 @@
public abstract class AddCommand extends Command {

public static final String COMMAND_WORD = "add";
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a member or a transaction to the ezFoodie.\n"
public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Adds a member or a transaction or a reservation to the ezFoodie.\n"
+ "With "
+ PREFIX_MEMBER + " (member details) or "
+ PREFIX_TRANSACTION + " (transaction details)";
+ PREFIX_TRANSACTION + " (transaction details) or "
+ PREFIX_RESERVATION + " (reservation details)";

@Override
public abstract CommandResult execute(Model model) throws CommandException;
Expand Down
25 changes: 14 additions & 11 deletions src/main/java/seedu/address/logic/commands/AddMemberCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,31 @@

import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;
import seedu.address.model.member.Id;
import seedu.address.model.member.Member;

/**
* Adds a member to the ezFoodie.
*/
public class AddMemberCommand extends AddCommand {

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a member to the ezFoodie. "
+ "Parameters: "
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a member to the ezFoodie.\n"
+ "Parameters:\n"
+ PREFIX_MEMBER + " "
+ PREFIX_NAME + " " + "NAME "
+ PREFIX_PHONE + " " + "PHONE "
+ PREFIX_EMAIL + " " + "EMAIL "
+ PREFIX_ADDRESS + " " + "ADDRESS\n"
+ "Example: " + COMMAND_WORD + " "
+ PREFIX_NAME + "NAME "
+ PREFIX_PHONE + "PHONE "
+ PREFIX_EMAIL + "EMAIL "
+ PREFIX_ADDRESS + "ADDRESS\n"
+ "Example:\n"
+ COMMAND_WORD + " "
+ PREFIX_MEMBER + " "
+ PREFIX_NAME + " " + "John Doe "
+ PREFIX_PHONE + " " + "98765432 "
+ PREFIX_EMAIL + " " + "[email protected] "
+ PREFIX_ADDRESS + " " + "311, Clementi Ave 2, #02-25";
+ PREFIX_NAME + "John Doe "
+ PREFIX_PHONE + "98765432 "
+ PREFIX_EMAIL + "[email protected] "
+ PREFIX_ADDRESS + "311, Clementi Ave 2, #02-25";

public static final String MESSAGE_SUCCESS = "New member added: %1$s";
public static final String MESSAGE_FULL = "Member ID has reached " + Id.MAX;
public static final String MESSAGE_DUPLICATE_MEMBER = "This member already exists in the ezFoodie";

private final Member toAdd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import seedu.address.model.member.Address;
import seedu.address.model.member.Credit;
import seedu.address.model.member.Email;
import seedu.address.model.member.Id;
import seedu.address.model.member.Member;
import seedu.address.model.member.Name;
import seedu.address.model.member.Phone;
Expand All @@ -35,27 +34,29 @@
public class AddReservationCommand extends AddCommand {

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds reservation to member "
+ "by member ID in the ezFoodie. "
+ "Parameters: "
+ "by member ID in the ezFoodie.\n"
+ "Parameters:\n"
+ PREFIX_RESERVATION + " "
+ PREFIX_DATE_TIME + " " + "DATE_TIME (" + DateTimeUtil.DATE_TIME_PATTERN + ") "
+ PREFIX_REMARK + " " + "REMARK "
+ PREFIX_ID + " " + "ID\n"
+ "Example: " + COMMAND_WORD + " "
+ PREFIX_DATE_TIME + "DATE_TIME (" + DateTimeUtil.DATE_TIME_PATTERN + ") "
+ PREFIX_REMARK + "REMARK "
+ PREFIX_ID + "ID\n"
+ "Example:\n"
+ COMMAND_WORD + " "
+ PREFIX_RESERVATION + " "
+ PREFIX_DATE_TIME + " " + "2021-12-01 13:00 "
+ PREFIX_REMARK + " " + "2 people "
+ PREFIX_ID + " " + "10001";
+ PREFIX_DATE_TIME + "2021-12-01 13:00 "
+ PREFIX_REMARK + "2 people "
+ PREFIX_ID + "10001";

public static final String MESSAGE_SUCCESS = "New reservation added: %1$s";
public static final String MESSAGE_FULL = "Reservation ID has reached " + seedu.address.model.reservation.Id.MAX;

private final Reservation reservationToAdd;
private final Id idToAdd;
private final seedu.address.model.member.Id idToAdd;

/**
* Creates an AddReservationCommand to add the specified {@code Member}
*/
public AddReservationCommand(Reservation reservation, Id id) {
public AddReservationCommand(Reservation reservation, seedu.address.model.member.Id id) {
requireAllNonNull(reservation, id);
reservationToAdd = reservation;
idToAdd = id;
Expand Down Expand Up @@ -83,7 +84,7 @@ public CommandResult execute(Model model) throws CommandException {
private static Member createUpdatedReservations(Member memberToEdit, Reservation reservation) {
assert memberToEdit != null;

Id id = memberToEdit.getId();
seedu.address.model.member.Id id = memberToEdit.getId();
Name name = memberToEdit.getName();
Phone phone = memberToEdit.getPhone();
Email email = memberToEdit.getEmail();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import seedu.address.model.member.Address;
import seedu.address.model.member.Credit;
import seedu.address.model.member.Email;
import seedu.address.model.member.Id;
import seedu.address.model.member.Member;
import seedu.address.model.member.Name;
import seedu.address.model.member.Phone;
Expand All @@ -32,25 +31,27 @@
*/
public class AddTransactionCommand extends AddCommand {

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a transaction to each member in the ezFoodie. "
+ "Parameters: "
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a transaction to each member in the ezFoodie.\n"
+ "Parameters:\n"
+ PREFIX_TRANSACTION + " "
+ PREFIX_BILLING + " " + "BILLING (STRICTLY 2 DECIMAL PLACES) "
+ PREFIX_ID + " " + "ID\n"
+ "Example: " + COMMAND_WORD + " "
+ PREFIX_BILLING + "BILLING (STRICTLY 2 DECIMAL PLACES) "
+ PREFIX_ID + "ID\n"
+ "Example:\n"
+ COMMAND_WORD + " "
+ PREFIX_TRANSACTION + " "
+ PREFIX_BILLING + " " + "23.00 "
+ PREFIX_ID + " " + "10001";
+ PREFIX_BILLING + "23.00 "
+ PREFIX_ID + "10001";

public static final String MESSAGE_SUCCESS = "New transaction added: %1$s";
public static final String MESSAGE_FULL = "Transaction ID has reached " + seedu.address.model.transaction.Id.MAX;

private final Transaction transactionToAdd;
private final Id idToAdd;
private final seedu.address.model.member.Id idToAdd;

/**
* Creates an AddTransactionCommand to add the specified {@code Member}
*/
public AddTransactionCommand(Transaction transaction, Id id) {
public AddTransactionCommand(Transaction transaction, seedu.address.model.member.Id id) {
requireAllNonNull(transaction, id);
transactionToAdd = transaction;
idToAdd = id;
Expand All @@ -77,7 +78,7 @@ public CommandResult execute(Model model) throws CommandException {
private static Member createUpdatedCreditAndPointsMember(Member memberToEdit, Transaction transaction) {
assert memberToEdit != null;

Id id = memberToEdit.getId();
seedu.address.model.member.Id id = memberToEdit.getId();
Name updatedName = memberToEdit.getName();
Phone updatedPhone = memberToEdit.getPhone();
Email updatedEmail = memberToEdit.getEmail();
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/seedu/address/logic/commands/DeleteCommand.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package seedu.address.logic.commands;

import static seedu.address.logic.parser.CliSyntax.PREFIX_MEMBER;
import static seedu.address.logic.parser.CliSyntax.PREFIX_RESERVATION;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TRANSACTION;

import seedu.address.logic.commands.exceptions.CommandException;
Expand All @@ -12,10 +13,12 @@
public abstract class DeleteCommand extends Command {

public static final String COMMAND_WORD = "del";
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Deletes a member or a transaction from the ezFoodie.\n"
public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Deletes a member or a transaction or a reservation from the ezFoodie.\n"
+ "With "
+ PREFIX_MEMBER + " (member details) or "
+ PREFIX_TRANSACTION + " (transaction details)";
+ PREFIX_TRANSACTION + " (transaction details) or "
+ PREFIX_RESERVATION + " (reservation details)";

@Override
public abstract CommandResult execute(Model model) throws CommandException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ public class DeleteMemberCommand extends DeleteCommand {
public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Deletes the member identified by the index number used in the displayed member list or member ID.\n"
+ "Parameters:\n"
+ "Delete by index number: " + PREFIX_MEMBER + " [" + PREFIX_INDEX + " INDEX]"
+ "Delete by index number: " + PREFIX_MEMBER + " " + PREFIX_INDEX + "INDEX"
+ " (INDEX must be a positive integer)\n"
+ "Delete by member ID: " + PREFIX_MEMBER + " [" + PREFIX_ID + " ID]\n"
+ "Delete by member ID: " + PREFIX_MEMBER + " " + PREFIX_ID + "ID\n"
+ "Example:\n"
+ "Delete by index number: " + COMMAND_WORD + " " + PREFIX_MEMBER + " " + PREFIX_INDEX + " 1\n"
+ "Delete by member ID: " + COMMAND_WORD + " " + PREFIX_MEMBER + " " + PREFIX_ID + " 10001";
+ "Delete by index number: " + COMMAND_WORD + " " + PREFIX_MEMBER + " " + PREFIX_INDEX + "1\n"
+ "Delete by member ID: " + COMMAND_WORD + " " + PREFIX_MEMBER + " " + PREFIX_ID + "10001";

public static final String MESSAGE_SUCCESS = "Deleted Member: %1$s";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public class DeleteReservationCommand extends DeleteCommand {
+ ": Deletes the reservation identified by the member ID and reservation ID.\n"
+ "Parameters:\n"
+ "Delete by member ID and reservation ID: "
+ PREFIX_RESERVATION + " " + PREFIX_ID + " member ID + reservation ID\n"
+ PREFIX_RESERVATION + " " + PREFIX_ID + "member ID + reservation ID\n"
+ "Example:\n"
+ "Delete by member ID and reservation ID: "
+ COMMAND_WORD + " " + PREFIX_RESERVATION + " " + PREFIX_ID + " 10001100001";
+ COMMAND_WORD + " " + PREFIX_RESERVATION + " " + PREFIX_ID + "10001100001";

public static final String MESSAGE_SUCCESS = "Deleted reservation: %1$s";

Expand Down Expand Up @@ -76,7 +76,7 @@ private static Member createUpdatedReservation(Member memberToEdit, Reservation
updatedReservations.remove(reservation);

return new Member(id, updatedName, updatedPhone, updatedEmail, updatedAddress, timestamp, credit, point,
transactions, reservations, updatedTags);
transactions, updatedReservations, updatedTags);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public class DeleteTransactionCommand extends DeleteCommand {
+ ": Deletes the transaction identified by the member ID and transaction ID.\n"
+ "Parameters:\n"
+ "Delete by member ID and transaction ID: "
+ PREFIX_TRANSACTION + " " + PREFIX_ID + " member ID + transaction ID\n"
+ PREFIX_TRANSACTION + " " + PREFIX_ID + "member ID + transaction ID\n"
+ "Example:\n"
+ "Delete by member ID and transaction ID: "
+ COMMAND_WORD + " " + PREFIX_TRANSACTION + " " + PREFIX_ID + " 10001100001";
+ COMMAND_WORD + " " + PREFIX_TRANSACTION + " " + PREFIX_ID + "10001100001";

public static final String MESSAGE_SUCCESS = "Deleted Transaction: %1$s";

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/seedu/address/logic/commands/EditCommand.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package seedu.address.logic.commands;

import static seedu.address.logic.parser.CliSyntax.PREFIX_MEMBER;
import static seedu.address.logic.parser.CliSyntax.PREFIX_PASS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_RESERVATION;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TRANSACTION;

import seedu.address.logic.commands.exceptions.CommandException;
Expand All @@ -13,11 +13,12 @@
public abstract class EditCommand extends Command {

public static final String COMMAND_WORD = "edit";
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits a member or a transaction in the ezFoodie.\n"
public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Edits a member or a transaction or a reservation in the ezFoodie.\n"
+ "With "
+ PREFIX_MEMBER + " (member details) or "
+ PREFIX_TRANSACTION + " (transaction details) or "
+ PREFIX_PASS + " (password details)";
+ PREFIX_RESERVATION + " (reservation details)";

@Override
public abstract CommandResult execute(Model model) throws CommandException;
Expand Down
32 changes: 16 additions & 16 deletions src/main/java/seedu/address/logic/commands/EditMemberCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,24 @@ public class EditMemberCommand extends EditCommand {
+ "by the index number used in the displayed member list or the member ID. "
+ "Existing values will be overwritten by the input values.\n"
+ "Parameters:\n"
+ "Edit by index number: " + PREFIX_MEMBER + " [" + PREFIX_INDEX + " INDEX] "
+ "Edit by index number: " + PREFIX_MEMBER + " " + PREFIX_INDEX + "INDEX "
+ "(INDEX must be a positive integer) "
+ "[" + PREFIX_NAME + " NAME] "
+ "[" + PREFIX_PHONE + " PHONE] "
+ "[" + PREFIX_EMAIL + " EMAIL] "
+ "[" + PREFIX_ADDRESS + " ADDRESS]\n"
+ "Edit by member ID: " + PREFIX_MEMBER + " [" + PREFIX_ID + " ID] "
+ "[" + PREFIX_NAME + " NAME] "
+ "[" + PREFIX_PHONE + " PHONE] "
+ "[" + PREFIX_EMAIL + " EMAIL] "
+ "[" + PREFIX_ADDRESS + " ADDRESS]\n"
+ "[" + PREFIX_NAME + "NAME] "
+ "[" + PREFIX_PHONE + "PHONE] "
+ "[" + PREFIX_EMAIL + "EMAIL] "
+ "[" + PREFIX_ADDRESS + "ADDRESS]\n"
+ "Edit by member ID: " + PREFIX_MEMBER + " " + PREFIX_ID + "ID "
+ "[" + PREFIX_NAME + "NAME] "
+ "[" + PREFIX_PHONE + "PHONE] "
+ "[" + PREFIX_EMAIL + "EMAIL] "
+ "[" + PREFIX_ADDRESS + "ADDRESS]\n"
+ "Example:\n"
+ "Edit by index number: " + COMMAND_WORD + " " + PREFIX_MEMBER + " " + PREFIX_INDEX + " 1 "
+ PREFIX_PHONE + " 91234567 "
+ PREFIX_EMAIL + " [email protected]\n"
+ "Edit by member ID: " + COMMAND_WORD + " " + PREFIX_MEMBER + " " + PREFIX_ID + " 10001 "
+ PREFIX_PHONE + " 91234567 "
+ PREFIX_EMAIL + " [email protected]";
+ "Edit by index number: " + COMMAND_WORD + " " + PREFIX_MEMBER + " " + PREFIX_INDEX + "1 "
+ PREFIX_PHONE + "91234567 "
+ PREFIX_EMAIL + "[email protected]\n"
+ "Edit by member ID: " + COMMAND_WORD + " " + PREFIX_MEMBER + " " + PREFIX_ID + "10001 "
+ PREFIX_PHONE + "91234567 "
+ PREFIX_EMAIL + "[email protected]";

public static final String MESSAGE_SUCCESS = "Edited Member: %1$s";
public static final String MESSAGE_NOT_EDITED = "At least one field to edit must be provided.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ public class EditReservationCommand extends EditCommand {
+ "Existing values will be overwritten by the input values.\n"
+ "Parameters:\n"
+ "Edit by member ID and reservation ID: "
+ PREFIX_RESERVATION + " " + PREFIX_ID + " member ID + reservation ID "
+ "[" + PREFIX_DATE_TIME + " DATE_TIME]"
+ "[" + PREFIX_REMARK + " REMARK]\n"
+ PREFIX_RESERVATION + " " + PREFIX_ID + "member ID + reservation ID "
+ "[" + PREFIX_DATE_TIME + "DATE_TIME] "
+ "[" + PREFIX_REMARK + "REMARK]\n"
+ "Example:\n"
+ "Edit by member ID and reservation ID: "
+ COMMAND_WORD + " " + PREFIX_RESERVATION + " " + PREFIX_ID + " 10001100001 "
+ PREFIX_DATE_TIME + " 2021-12-01 13:00"
+ PREFIX_REMARK + " 3 people";
+ COMMAND_WORD + " " + PREFIX_RESERVATION + " " + PREFIX_ID + "10001100001 "
+ PREFIX_DATE_TIME + "2021-12-01 13:00 "
+ PREFIX_REMARK + "3 people";

public static final String MESSAGE_SUCCESS = "Edited Member: %1$s";
public static final String MESSAGE_NOT_EDITED = "At least one field to edit must be provided.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public class EditTransactionCommand extends EditCommand {
+ "Existing values will be overwritten by the input values.\n"
+ "Parameters:\n"
+ "Edit by member ID and transaction ID: "
+ PREFIX_TRANSACTION + " " + PREFIX_ID + " member ID + transaction ID "
+ "[" + PREFIX_BILLING + " BILLING]\n"
+ PREFIX_TRANSACTION + " " + PREFIX_ID + "member ID + transaction ID "
+ "[" + PREFIX_BILLING + "BILLING]\n"
+ "Example:\n"
+ "Edit by member ID and transaction ID: "
+ COMMAND_WORD + " " + PREFIX_TRANSACTION + " " + PREFIX_ID + " 10001100001 "
+ PREFIX_BILLING + " 123.45";
+ COMMAND_WORD + " " + PREFIX_TRANSACTION + " " + PREFIX_ID + "10001100001 "
+ PREFIX_BILLING + "123.45";

public static final String MESSAGE_SUCCESS = "Edited Member: %1$s";
public static final String MESSAGE_NOT_EDITED = "At least one field to edit must be provided.";
Expand Down
Loading

0 comments on commit 39d1bd1

Please sign in to comment.