Skip to content

Commit

Permalink
Merge pull request #180 from HolmesJJ/fix-bugs
Browse files Browse the repository at this point in the history
Fix some small formats and bugs, remove the sample tag data
  • Loading branch information
HolmesJJ authored Nov 3, 2021
2 parents 2db5b48 + da1e8fe commit 8011dbe
Show file tree
Hide file tree
Showing 30 changed files with 367 additions and 182 deletions.
1 change: 1 addition & 0 deletions src/main/java/seedu/address/logic/LogicManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public CommandResult execute(String commandText) throws CommandException, ParseE

try {
storage.saveEzFoodie(model.getEzFoodie());
storage.saveAccount(model.getAccount());
} catch (IOException ioe) {
throw new CommandException(FILE_OPS_ERROR_MESSAGE + ioe, ioe);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import static seedu.address.logic.parser.CliSyntax.PREFIX_MEMBER;
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;

import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;
Expand All @@ -23,16 +22,13 @@ public class AddMemberCommand extends AddCommand {
+ PREFIX_NAME + " " + "NAME "
+ PREFIX_PHONE + " " + "PHONE "
+ PREFIX_EMAIL + " " + "EMAIL "
+ PREFIX_ADDRESS + " " + "ADDRESS "
+ "[" + PREFIX_TAG + " " + "TAG]...\n"
+ PREFIX_ADDRESS + " " + "ADDRESS\n"
+ "Example: " + COMMAND_WORD + " "
+ PREFIX_MEMBER + " "
+ PREFIX_NAME + " " + "John Doe "
+ PREFIX_PHONE + " " + "98765432 "
+ PREFIX_EMAIL + " " + "[email protected] "
+ PREFIX_ADDRESS + " " + "311, Clementi Ave 2, #02-25 "
+ PREFIX_TAG + " " + "friends "
+ PREFIX_TAG + " " + "owesMoney";
+ PREFIX_ADDRESS + " " + "311, Clementi Ave 2, #02-25";

public static final String MESSAGE_SUCCESS = "New member added: %1$s";
public static final String MESSAGE_DUPLICATE_MEMBER = "This member already exists in the ezFoodie";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package seedu.address.logic.commands;

import static java.util.Objects.requireNonNull;
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DATE_TIME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ID;
import static seedu.address.logic.parser.CliSyntax.PREFIX_REMARK;
Expand Down Expand Up @@ -55,7 +56,7 @@ public class AddReservationCommand extends AddCommand {
* Creates an AddReservationCommand to add the specified {@code Member}
*/
public AddReservationCommand(Reservation reservation, Id id) {
requireNonNull(id);
requireAllNonNull(reservation, id);
reservationToAdd = reservation;
idToAdd = id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
*/
public class DeleteMemberCommand extends DeleteCommand {

public static final String COMMAND_WORD = "del";

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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import seedu.address.model.member.Name;
import seedu.address.model.member.Phone;
import seedu.address.model.member.Point;
import seedu.address.model.reservation.Id;
import seedu.address.model.reservation.Reservation;
import seedu.address.model.tag.Tag;
import seedu.address.model.transaction.Transaction;
Expand All @@ -31,26 +30,25 @@
*/
public class DeleteReservationCommand extends DeleteCommand {

public static final String COMMAND_WORD = "del";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": 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";

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

private final seedu.address.model.member.Id memberId;
private final Id reservationId;
private final seedu.address.model.reservation.Id reservationId;

/**
* Creates an DeleteCommand to delete the specified {@code Member} by member ID and transaction ID
* Creates an DeleteCommand to delete the specified {@code Member} by member ID and reservation ID
*/
public DeleteReservationCommand(seedu.address.model.member.Id memberId, Id reservationId) {
public DeleteReservationCommand(
seedu.address.model.member.Id memberId, seedu.address.model.reservation.Id reservationId) {
requireAllNonNull(memberId, reservationId);
this.memberId = memberId;
this.reservationId = reservationId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@
*/
public class DeleteTransactionCommand extends DeleteCommand {

public static final String COMMAND_WORD = "del";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": 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";
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/seedu/address/logic/commands/EditCommand.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_PASS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TRANSACTION;

import seedu.address.logic.commands.exceptions.CommandException;
Expand All @@ -15,7 +16,8 @@ public abstract class EditCommand extends Command {
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits a member or a transaction in the ezFoodie.\n"
+ "With "
+ PREFIX_MEMBER + " (member details) or "
+ PREFIX_TRANSACTION + " (transaction details)";
+ PREFIX_TRANSACTION + " (transaction details) or "
+ PREFIX_PASS + " (password details)";

@Override
public abstract CommandResult execute(Model model) throws CommandException;
Expand Down
18 changes: 6 additions & 12 deletions src/main/java/seedu/address/logic/commands/EditMemberCommand.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package seedu.address.logic.commands;

import static java.util.Objects.requireNonNull;
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ID;
import static seedu.address.logic.parser.CliSyntax.PREFIX_INDEX;
import static seedu.address.logic.parser.CliSyntax.PREFIX_MEMBER;
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_MEMBERS;

import java.util.Collections;
Expand Down Expand Up @@ -40,8 +40,6 @@
*/
public class EditMemberCommand extends EditCommand {

public static final String COMMAND_WORD = "edit";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the details of the member identified "
+ "by the index number used in the displayed member list or the member ID. "
+ "Existing values will be overwritten by the input values.\n"
Expand All @@ -51,14 +49,12 @@ public class EditMemberCommand extends EditCommand {
+ "[" + PREFIX_NAME + " NAME] "
+ "[" + PREFIX_PHONE + " PHONE] "
+ "[" + PREFIX_EMAIL + " EMAIL] "
+ "[" + PREFIX_ADDRESS + " ADDRESS] "
+ "[" + PREFIX_TAG + " TAG]...\n"
+ "[" + 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] "
+ "[" + PREFIX_TAG + " TAG]...\n"
+ "[" + PREFIX_ADDRESS + " ADDRESS]\n"
+ "Example:\n"
+ "Edit by index number: " + COMMAND_WORD + " " + PREFIX_MEMBER + " " + PREFIX_INDEX + " 1 "
+ PREFIX_PHONE + " 91234567 "
Expand All @@ -80,8 +76,7 @@ public class EditMemberCommand extends EditCommand {
* @param editMemberDescriptor details to edit the member with
*/
public EditMemberCommand(Index index, EditMemberDescriptor editMemberDescriptor) {
requireNonNull(index);
requireNonNull(editMemberDescriptor);
requireAllNonNull(index, editMemberDescriptor);

this.index = index;
id = null;
Expand All @@ -93,8 +88,7 @@ public EditMemberCommand(Index index, EditMemberDescriptor editMemberDescriptor)
* @param editMemberDescriptor details to edit the member with
*/
public EditMemberCommand(Id id, EditMemberDescriptor editMemberDescriptor) {
requireNonNull(id);
requireNonNull(editMemberDescriptor);
requireAllNonNull(id, editMemberDescriptor);

this.id = id;
index = null;
Expand Down Expand Up @@ -178,7 +172,7 @@ public EditMemberDescriptor() {}

/**
* Copy constructor.
* A defensive copy of {@code tags} is used internally.
* A defensive copy of {@code toCopy} is used internally.
*/
public EditMemberDescriptor(EditMemberDescriptor toCopy) {
setName(toCopy.name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,12 @@
*/
public class EditReservationCommand extends EditCommand {

public static final String COMMAND_WORD = "edit";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the details of the reservation identified "
+ "by the member ID and reservation ID. "
+ "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_RESERVATION + " " + PREFIX_ID + " member ID + reservation ID "
+ "[" + PREFIX_DATE_TIME + " DATE_TIME]"
+ "[" + PREFIX_REMARK + " REMARK]\n"
+ "Example:\n"
Expand Down Expand Up @@ -133,7 +131,7 @@ public CommandResult execute(Model model) throws CommandException {
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof EditReservationCommand // instanceof handles nulls
// && memberId.equals(((EditReservationCommand) other).memberId)
&& memberId.equals(((EditReservationCommand) other).memberId)
&& reservationId.equals(((EditReservationCommand) other).reservationId)
&& editReservationDescriptor
.equals(((EditReservationCommand) other).editReservationDescriptor)); // state check
Expand All @@ -151,7 +149,7 @@ public EditReservationDescriptor() {}

/**
* Copy constructor.
* A defensive copy of {@code tags} is used internally.
* A defensive copy of {@code toCopy} is used internally.
*/
public EditReservationDescriptor(EditReservationDescriptor toCopy) {
setDateTime(toCopy.dateTime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@
*/
public class EditTransactionCommand extends EditCommand {

public static final String COMMAND_WORD = "edit";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the details of the transaction identified "
+ "by the member ID and transaction ID. "
+ "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_TRANSACTION + " " + PREFIX_ID + " member ID + transaction ID "
+ "[" + PREFIX_BILLING + " BILLING]\n"
+ "Example:\n"
+ "Edit by member ID and transaction ID: "
Expand Down Expand Up @@ -135,7 +133,7 @@ public CommandResult execute(Model model) throws CommandException {
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof EditTransactionCommand // instanceof handles nulls
// && memberId.equals(((EditTransactionCommand) other).memberId)
&& memberId.equals(((EditTransactionCommand) other).memberId)
&& transactionId.equals(((EditTransactionCommand) other).transactionId)
&& editTransactionDescriptor
.equals(((EditTransactionCommand) other).editTransactionDescriptor)); // state check
Expand All @@ -153,7 +151,7 @@ public EditTransactionDescriptor() {}

/**
* Copy constructor.
* A defensive copy of {@code tags} is used internally.
* A defensive copy of {@code toCopy} is used internally.
*/
public EditTransactionDescriptor(EditTransactionDescriptor toCopy) {
setTimestamp(toCopy.timestamp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import seedu.address.model.Model;

/**
* Format full help instructions for every command for display.
* Formats full help instructions for every command for display.
*/
public class HelpCommand extends Command {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class RedeemCommand extends Command {
+ PREFIX_REDEEM + " 100 "
+ PREFIX_INDEX + " 1\n";

public static final String MESSAGE_SUCCESS_REDEMPTION = "Redemption is done";
public static final String MESSAGE_SUCCESS_REDEMPTION = "Redeemed Member: %1$s";
public static final String MESSAGE_DUPLICATE_MEMBER = "This member already exists in the ezFoodie.";
public static final String MESSAGE_INVALID_POINTS_LESS_THAN_ZERO = "Redeemed point has already exceeded\n"
+ "Points can't redeemed less than 0\n"
Expand Down
Loading

0 comments on commit 8011dbe

Please sign in to comment.