Skip to content

Commit

Permalink
Remove extra brackets in success message
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjohntan committed Nov 6, 2024
1 parent 62f385c commit 3ea9106
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class CategorizeTagCommand extends Command {
+ "Parameters: " + PREFIX_TAG + "TAG (existing tag label) CATEGORY\n"
+ "Example: " + COMMAND_WORD + " " + PREFIX_TAG + "CS1101S acads";

public static final String MESSAGE_CAT_TAG_SUCCESS = "Category of tag %1$s has been changed successfully.";
public static final String MESSAGE_CAT_TAG_SUCCESS = "Category of tag(s) %1$s has been changed successfully.";
public static final String MESSAGE_TAG_NOT_EXIST = "Tag not found: %1$s";
public static final String MESSAGE_INVALID_CATEGORY = "Invalid category: %1$s";
public static final String MESSAGE_DUPLICATE_CATEGORY = "Current category of %s is already %s";
Expand Down Expand Up @@ -57,13 +57,19 @@ public CommandResult execute(Model model) throws CommandException {
model.refreshCampusConnect();
}

return new CommandResult(String.format(MESSAGE_CAT_TAG_SUCCESS, targetTags));
String formattedTags = formatTags(targetTags);
return new CommandResult(String.format(MESSAGE_CAT_TAG_SUCCESS, formattedTags));
}

private boolean isDuplicateCategory(TagCategory cat) {
return updatedCategory.equals(cat);
}

private String formatTags(List<Tag> tags) {
String result = tags.toString();
return result.substring(1, result.length() - 1);
}

@Override
public boolean equals(Object other) {
if (other == this) {
Expand Down

0 comments on commit 3ea9106

Please sign in to comment.