You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IntelliJ version: IntelliJ IDEA 2019.2 (Ultimate Edition)
Java version: java 12.0.2
Operating system version: macOS 10.14.6
other packages' versions
Issue
For context, our team is trying to build an organ-matching desktop application, which matches Patients to Donors. Currently, I am trying to add in a command to match a particular Patient to all the donors in the database. After matching the Patient to the Donor, a list with matching Donors and its success rate should be displayed.
Example output:
The issue comes when instead of displaying the Donors and its success rate of matching, it displays the Donors only, without the match result. There is no pattern as to when it displays the wrong output. For example, the first time I type in match ic/NRIC, it displays the Donors with the match results. But when I type in the same command, it displays the Donors without the match results. I have tried many combinations of commands but still cannot find a reason as to why this problem occurs.
How to replicate the bug
Launch the application
Type in the following commands to add testing data:
Here are some details about the implementation of this feature that may help.
When we type in match ic/S1234567R, the user input is parsed by the MatchCommandParser to create a MatchCommand. The MatchCommand executes the matching in the ModelManager and updates the filteredPersonList in ModelManager.
To display the match results, in PersonListPanel.java, there is a PersonListViewCell class with an updateItem method to decide what should be rendered:
/**
* Custom {@code ListCell} that displays the graphics of a {@code Person} using a {@code PersonCard}.
*/
class PersonListViewCell extends ListCell<Person> {
@Override
protected void updateItem(Person person, boolean empty) {
super.updateItem(person, empty);
if (empty || person == null) {
setGraphic(null);
setText(null);
} else {
if (person instanceof Doctor) {
setGraphic(new DoctorCard((Doctor) person, getIndex() + 1).getRoot());
} else if (person instanceof Donor) {
Donor donor = (Donor) person;
if (donor.isMatched()) {
setGraphic(new MatchCard(donor, getIndex() + 1).getRoot());
donor.setMatched(false);
} else {
setGraphic(new DonorCard(donor, getIndex() + 1).getRoot());
}
} else if (person instanceof Patient) {
setGraphic(new PatientCard((Patient) person, getIndex() + 1).getRoot());
} else {
setGraphic(new PersonCard(person, getIndex() + 1).getRoot());
}
}
}
}
The text was updated successfully, but these errors were encountered:
If you can reliably replicate the problem, have you tried putting a break point at the start of the relevant code segment and then stepping through the code in debug mode to find exactly what happens?
Please read up on how to write a good question
Environment
Describe your development environment
Issue
For context, our team is trying to build an organ-matching desktop application, which matches Patients to Donors. Currently, I am trying to add in a command to match a particular Patient to all the donors in the database. After matching the Patient to the Donor, a list with matching Donors and its success rate should be displayed.
Example output:
The issue comes when instead of displaying the Donors and its success rate of matching, it displays the Donors only, without the match result. There is no pattern as to when it displays the wrong output. For example, the first time I type in
match ic/NRIC
, it displays the Donors with the match results. But when I type in the same command, it displays the Donors without the match results. I have tried many combinations of commands but still cannot find a reason as to why this problem occurs.How to replicate the bug
match ic/S1234568R
. Repeat the typing of this command several times.Code/Log Trace
Here is my branch where this feature is added: https://github.com/AY1920S1-CS2103T-T13-1/main/tree/add-match-feature/
Here are some details about the implementation of this feature that may help.
match ic/S1234567R
, the user input is parsed by theMatchCommandParser
to create aMatchCommand
. TheMatchCommand
executes the matching in theModelManager
and updates the filteredPersonList in ModelManager.PersonListPanel.java
, there is aPersonListViewCell
class with anupdateItem
method to decide what should be rendered:The text was updated successfully, but these errors were encountered: