Skip to content

Commit

Permalink
Merge branch 'master' into branch-alpha-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
blackpanther9229 authored Nov 7, 2024
2 parents f9f305c + 153dd91 commit 0afb31b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
18 changes: 9 additions & 9 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,17 @@ Categorizes a tag under a defined category.
Format: `cattag t/TAG [t/MORE_TAGS]…​ CATEGORY`

* Sets the tag(s) in CampusConnect with the specified name `TAG` to fall under the specified `CATEGORY`.
* Currently available categories with their respective keywords and colors are:
*
* Currently available categories with their respective keywords and colours are:

| Category | Keyword (case sensitive) | Color |
|---------------|--------------------------|-------|
| **General** | `general` | Gray |
| **Academics** | `acads` | Gold |
| **Activities**| `activity` | Blue |
| **Networking**| `network` | Green |
| **Mentorship**| `mentor` | Pink |
Category | Keyword (case sensitive) | Colour
--------------|--------------------------|-
**General** | `general` | <span style="color:DarkGray"> Grey </span>
**Academics** | `acads` | <span style="color:Gold"> Gold </span>
**Activities**| `activity` | <span style="color:DodgerBlue"> Blue </span>
**Networking**| `network` | <span style="color:LimeGreen"> Green </span>
**Mentorship**| `mentor` | <span style="color:HotPink"> Pink </span>

* All tags are categorized `General` by default.
* Multiple tags can be categorized to the same category at a time.
* All tags specified must be valid existing tags.
* Attempts to set a tag to its current category will cause the whole command to be rejected.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class CategorizeTagCommand extends Command {
+ "Parameters: " + PREFIX_TAG + "TAG (at least one 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 @@ -58,17 +58,19 @@ public CommandResult execute(Model model) throws CommandException {
model.refreshCampusConnect();
}

String targetTagsResult = targetTags.stream()
.map(x -> x.toString())
.collect(Collectors.joining(", "));

return new CommandResult(String.format(MESSAGE_CAT_TAG_SUCCESS, targetTagsResult));
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 0afb31b

Please sign in to comment.