Skip to content

Commit

Permalink
Person: Remove 'Tags: ' if there are no tags
Browse files Browse the repository at this point in the history
An additional phrase 'Tags:' is always present even if the user did
not input any tags.

This is not intuitive as the result message is displaying
unnecessary information.

Let's remove 'Tags:' from the result message if tags are not present.

(cherry picked from commit b930d99708bbda0385bbf428fc2916a3d4a98d11)
  • Loading branch information
jonahtanjz authored and damithc committed Dec 12, 2020
1 parent 18889bb commit fb67d1f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/seedu/address/model/person/Person.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,13 @@ public String toString() {
.append("; Email: ")
.append(getEmail())
.append("; Address: ")
.append(getAddress())
.append("; Tags: ");
getTags().forEach(builder::append);
.append(getAddress());

Set<Tag> tags = getTags();
if (!tags.isEmpty()) {
builder.append("; Tags: ");
tags.forEach(builder::append);
}
return builder.toString();
}

Expand Down

0 comments on commit fb67d1f

Please sign in to comment.