Skip to content

Commit

Permalink
Change Assign Vendor Command formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
tingxuanp committed Oct 23, 2024
1 parent 851c062 commit 0cea17f
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class AssignVendorCommand extends Command {

public static final String MESSAGE_SUCCESS = "%1$s has been added as a vendor.";

public static final String MESSAGE_DUPLICATE_VENDOR = "This person is already a vendor.";
public static final String MESSAGE_DUPLICATE_VENDOR = "%1$s is already a vendor.";

private final Index targetIndex;

Expand All @@ -51,9 +51,9 @@ public CommandResult execute(Model model) throws CommandException {

Person personToAssign = lastShownList.get(targetIndex.getZeroBased());

// need to change to check if model has the vendor already existing
// need to change to check if model already has vendor
if (model.hasVendor(personToAssign)) {
throw new CommandException(MESSAGE_DUPLICATE_VENDOR);
throw new CommandException(String.format(MESSAGE_DUPLICATE_VENDOR, personToAssign.getName()));
}

model.assignVendor(personToAssign);
Expand Down

0 comments on commit 0cea17f

Please sign in to comment.