Skip to content

Commit

Permalink
Fix bug in implementation of symbols for Gender
Browse files Browse the repository at this point in the history
  • Loading branch information
ajjajjajjajj committed Mar 23, 2023
1 parent de15dbe commit 8e5a85f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/main/java/seedu/address/model/person/Gender.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ public class Gender {

/* The input should be "male" or "female" */
public static final String VALIDATION_REGEX = ".*\\bmale\\b|.*\\bfemale\\b";
public static final String VALUE_MALE = "(M)";
public static final String VALUE_FEMALE = "(F)";
public static final String SYMBOL_MALE = "(M)";
public static final String SYMBOL_FEMALE = "(F)";

public final String value;
public final String symbol;

/**
* Constructs a {@code Gender}.
Expand All @@ -27,7 +28,8 @@ public class Gender {
public Gender(String gender) {
requireNonNull(gender);
checkArgument(isValidGender(gender), MESSAGE_CONSTRAINTS);
this.value = gender.equals("male") ? VALUE_MALE : VALUE_FEMALE;
this.value = gender;
this.symbol = gender.equals("male") ? SYMBOL_MALE : SYMBOL_FEMALE;
}

/**
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 @@ -63,7 +63,7 @@ public PersonCard(Person person, int displayedIndex) {
this.person = person;
id.setText(displayedIndex + ". ");
name.setText(person.getName().fullName);
gender.setText(person.getGender().value);
gender.setText(person.getGender().symbol);
phone.setText(person.getPhone().value);
address.setText(person.getAddress().value);
email.setText(person.getEmail().value);
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/view/TransactionListCard.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
<ColumnConstraints hgrow="SOMETIMES" maxWidth="240.0" minWidth="10.0" prefWidth="240.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label styleClass="cell_small_label" text="Owner" GridPane.columnIndex="0" GridPane.rowIndex="0" />
Expand Down

0 comments on commit 8e5a85f

Please sign in to comment.