Skip to content

Commit

Permalink
Merge pull request #82 from abwilli/master
Browse files Browse the repository at this point in the history
Bug fix in Tags Json files
  • Loading branch information
abwilli authored Apr 3, 2019
2 parents 1628969 + f2b75ee commit bbb38c7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/main/java/seedu/address/model/tag/SkillsTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,21 @@ public class SkillsTag {
public SkillsTag(String tagName, String type) {
requireNonNull(tagName);
checkArgument(isValidTagName(tagName), MESSAGE_CONSTRAINTS);
this.tagName = tagName;
this.tagType = type;
if (type.equals("skill")) {
//skill tag
this.tagColor = "pink";
this.tagName = "s:" + tagName;

} else if (type.equals("pos")) {
//position tag
this.tagColor = "yellow";
this.tagName = "p:" + tagName;

} else {
//endorsement tag
this.tagColor = "teal";
this.tagName = "e:" + tagName;
}
}

Expand Down
13 changes: 11 additions & 2 deletions src/main/java/seedu/address/storage/JsonAdaptedTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,16 @@ class JsonAdaptedTag {

@JsonCreator
public JsonAdaptedTag(String tagName) {
this.tagName = tagName;
this.tagType = "pos";
String parsed = tagName.substring(2);
String prefix = tagName.substring(0,1);
this.tagName = parsed;
if(prefix.equals("s")){
this.tagType = "skill";
}else if(prefix.equals("p")){
this.tagType = "pos";
}else{
this.tagType = "endorse";
}

}

Expand All @@ -47,6 +55,7 @@ public SkillsTag toModelType() throws IllegalValueException {
if (!SkillsTag.isValidTagName(tagName)) {
throw new IllegalValueException(SkillsTag.MESSAGE_CONSTRAINTS);
}

return new SkillsTag(tagName, tagType);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/ui/PersonCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public PersonCard(Person person, int displayedIndex) {
*/
private void formatTags(Person person) {
person.getTags().forEach(tag -> {
Label tLabel = new Label(tag.tagName);
Label tLabel = new Label(tag.tagName.substring(2));
tLabel.getStyleClass().add(tag.tagColor);
tags.getChildren().add(tLabel);

Expand Down

0 comments on commit bbb38c7

Please sign in to comment.