Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add remark feature #63

Merged
merged 23 commits into from
Apr 2, 2024
Merged

Conversation

erv-teo
Copy link

@erv-teo erv-teo commented Mar 29, 2024

Closes #38

@erv-teo erv-teo added this to the v1.3 milestone Mar 29, 2024
@erv-teo erv-teo self-assigned this Mar 29, 2024
Copy link

codecov bot commented Mar 30, 2024

Codecov Report

Attention: Patch coverage is 89.53488% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 76.88%. Comparing base (011b226) to head (063f62a).
Report is 6 commits behind head on master.

Files Patch % Lines
...c/main/java/seedu/address/model/person/Person.java 44.44% 2 Missing and 3 partials ⚠️
...java/seedu/address/logic/commands/EditCommand.java 90.90% 0 Missing and 1 partial ⚠️
.../seedu/address/logic/parser/AddressBookParser.java 0.00% 1 Missing ⚠️
...c/main/java/seedu/address/model/person/Remark.java 91.66% 1 Missing ⚠️
src/main/java/seedu/address/ui/PersonCard.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master      #63      +/-   ##
============================================
+ Coverage     76.18%   76.88%   +0.70%     
- Complexity      474      496      +22     
============================================
  Files            75       78       +3     
  Lines          1503     1579      +76     
  Branches        154      164      +10     
============================================
+ Hits           1145     1214      +69     
- Misses          314      318       +4     
- Partials         44       47       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@iamtr iamtr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your work Ervin, it definitely did not seem easy.

Just have a few questions that I'd like to clarify before merging:

  1. Is Remark compulsory in your implementation? Because from what I understand, it is optional.
  2. There is a missing RemarkCommandParserTest for your implementation. You can refer to AddCommandParserTest and add some tests for this.

person.getTags().forEach(builder::append);
builder.append("\n Remarks: ")
.append(person.getRemark());
return builder.toString();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a nit, but do you wanna do this instead?

public static String format(Person person) {
        final StringBuilder builder = new StringBuilder();
        builder.append(person.getName())
                .append("\n IC: ")
                .append(person.getIc())
                .append("\n DOB: ")
                .append(person.getDob())
                .append("\n Ward: ")
                .append(person.getWard())
                .append("\n Admitted: ")
                .append(person.getAdmissionDate())
                .append("\n Remarks: ")
                .append(person.getRemark());
                .append("\n Tags: ");

        person.getTags().forEach(builder::append);
        return builder.toString();

*/
public class RemarkCommandTest {

private static final String REMARK_STUB = "Some remark";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may be wrong, but I feel like this would be more appropriately named SAMPLE_REMARK instead. Stub implies that it might be a module that is being substituted

Comment on lines 30 to 46
.withAdmissionDate("01/03/2024").withWard("A1").build();
.withAdmissionDate("01/03/2024").withWard("A1").withRemark("This is a remark.").build();
public static final Person BENSON = new PersonBuilder().withName("Benson Meier")
.withTags("Dementia", "FallRisk").withDob("20/02/2001")
.withIc("A2345678B").withAdmissionDate("01/02/2024").withWard("B1").build();
.withIc("A2345678B").withAdmissionDate("01/02/2024").withWard("B1").withRemark("This is a remark.").build();
public static final Person CARL = new PersonBuilder().withName("Carl Kurz").withDob("20/02/2002")
.withIc("A3456789B").withAdmissionDate("05/03/2024").withWard("C1").build();
.withIc("A3456789B").withAdmissionDate("05/03/2024").withWard("C1").withRemark("This is a remark.").build();
public static final Person DANIEL = new PersonBuilder().withName("Daniel Meier").withTags("HearingImpaired")
.withDob("20/02/2003").withIc("A5678901B").withAdmissionDate("10/03/2024")
.withWard("D1").build();
.withWard("D1").withRemark("This is a remark.").build();
public static final Person ELLE = new PersonBuilder().withName("Elle Meyer").withDob("20/02/2004")
.withIc("A4756976B").withAdmissionDate("05/02/2024").withWard("E1").build();
.withIc("A4756976B").withAdmissionDate("05/02/2024").withWard("E1").withRemark("This is a remark.").build();
public static final Person FIONA = new PersonBuilder().withName("Fiona Kunz").withDob("20/02/2006")
.withIc("A5739485B").withAdmissionDate("11/03/2024").withWard("F1").build();
.withIc("A5739485B").withAdmissionDate("11/03/2024").withWard("F1").withRemark("This is a remark.").build();
public static final Person GEORGE = new PersonBuilder().withName("George Best").withDob("20/05/2000")
.withIc("A0987654B").withAdmissionDate("16/03/2024").withWard("G1").build();
.withIc("A0987654B").withAdmissionDate("16/03/2024").withWard("G1").withRemark("This is a remark.").build();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Is a remark compulsory? Is it possible to make it optional, just like tags?
  2. Maybe we can use more relevant remarks for this part, such as "Patient has limited vision capabilities"

Comment on lines +17 to +19
/**
* Changes the remark of an existing person in the address book.
*/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this allow adding of remarks? More detail here would be good

Comment on lines 34 to 36
Dob dob, Ic ic, AdmissionDate admissionDate, Ward ward) {
requireAllNonNull(name, dob, ic, admissionDate, ward);
Dob dob, Ic ic, AdmissionDate admissionDate, Ward ward, Remark remark) {
requireAllNonNull(name, dob, ic, admissionDate, ward, remark, tags);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe remarks was optional, unless I am wrong. Should we exclude remarks from requireNonNull?

Comment on lines -32 to +37
new Ic("S1234567A"), new AdmissionDate("05/01/2022"), new Ward("WE")),
new Ic("S1234567A"), new AdmissionDate("05/01/2022"), new Ward("WE"), new Remark("")),
new Person(new Name("Roy Balakrishnan"), getTagSet("Dementia"), new Dob("01/01/1990"),
new Ic("S1234567A"), new AdmissionDate("06/01/2022"), new Ward("WF"))
new Ic("S1234567A"), new AdmissionDate("06/01/2022"), new Ward("WF"), new Remark(""))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One or two of sample person can have a sample remark too, instead of blank

Comment on lines 51 to 55
AdmissionDate admissionDate =
ParserUtil.parseAdmissionDate(argMultimap.getValue(PREFIX_ADMISSION_DATE).orElse(null));
Ward ward = ParserUtil.parseWard(argMultimap.getValue(PREFIX_WARD).orElse(null));


Person person = new Person(name, tagList, dob, ic, admissionDate, ward);
Remark remark = new Remark("");
Person person = new Person(name, tagList, dob, ic, admissionDate, ward, remark);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we having a parseRemark() method for this? Or remarks have to be added seperately.

Copy link

@iamtr iamtr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. You may wanna add RemarkTest.java too, but that might be optional.

@ryanlimdx @ejnan @swtan346 is there any feedback? If not, we'll merge it soon, so we can test for potential bugs.

@iamtr iamtr merged commit bc449a8 into AY2324S2-CS2103T-F10-1:master Apr 2, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

As a ward nurse, I can add remarks to each patient
2 participants