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

Fix id reference of visits #138

Merged
merged 5 commits into from
Oct 11, 2020
Merged

Fix id reference of visits #138

merged 5 commits into from
Oct 11, 2020

Conversation

hopinxian
Copy link

Implement a fix that ensures id of person and location that visit is referring to matches the intended person and location.

Fix #136

@hopinxian hopinxian added bug Something isn't working priority.High Needs to be completed soon Implementation Coding required labels Oct 10, 2020
@hopinxian hopinxian added this to the v1.2 milestone Oct 10, 2020
@hopinxian hopinxian self-assigned this Oct 10, 2020
@codecov-io
Copy link

codecov-io commented Oct 10, 2020

Codecov Report

Merging #138 into master will increase coverage by 0.04%.
The diff coverage is 91.66%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #138      +/-   ##
============================================
+ Coverage     74.83%   74.88%   +0.04%     
- Complexity      765      767       +2     
============================================
  Files           111      111              
  Lines          2281     2293      +12     
  Branches        269      272       +3     
============================================
+ Hits           1707     1717      +10     
  Misses          508      508              
- Partials         66       68       +2     
Impacted Files Coverage Δ Complexity Δ
.../seedu/address/logic/commands/AddVisitCommand.java 91.30% <89.47%> (-8.70%) 8.00 <5.00> (ø)
...du/address/logic/parser/AddVisitCommandParser.java 71.42% <100.00%> (-1.91%) 3.00 <0.00> (ø)
...rc/main/java/seedu/address/model/ModelManager.java 93.06% <100.00%> (+0.14%) 45.00 <2.00> (+2.00)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9cfeae2...a241f9f. Read the comment docs.

Copy link

@siangernlow siangernlow left a comment

Choose a reason for hiding this comment

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

Changes requested, certain tests need to be added as mentioned.

Also, are there tests to test if the issue of adding the wrong index has been solved? Having a test which tests if the same visit is added based on what the viewer sees should be added if it does not exist yet.

@@ -21,7 +27,7 @@
public class AddVisitCommandTest {
@Test
public void constructor_nullLocation_throwsNullPointerException() {
assertThrows(NullPointerException.class, () -> new AddVisitCommand(null));
assertThrows(NullPointerException.class, () -> new AddVisitCommand(null, null, null));

Choose a reason for hiding this comment

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

Now that there are three parameters for the constructors, perhaps it could be better if each parameter is tested for NullPointerException in a separate method.

Copy link
Author

Choose a reason for hiding this comment

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

Have added additional assertions.

@@ -21,7 +27,7 @@
public class AddVisitCommandTest {
@Test
public void constructor_nullLocation_throwsNullPointerException() {

Choose a reason for hiding this comment

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

Typo here. Shouldn't be nullLocation but instead the parameter that is null in this method.

Copy link
Author

Choose a reason for hiding this comment

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

Have changed the method name

requireAllNonNull(visit);
toAdd = visit;
public AddVisitCommand(Index personIndex, Index locationIndex, LocalDate date) {
requireAllNonNull(personIndex, locationIndex);

Choose a reason for hiding this comment

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

Shouldn't date be required to be non null as well?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the catch! I have updated it.

Additional tests to confirm the success of adding the correct visits
are added under filtered and unfiltered lists.
@hopinxian
Copy link
Author

Thanks for the review. I have improved the Pull Request according to your comments.

Copy link
Collaborator

@KohHanMing KohHanMing left a comment

Choose a reason for hiding this comment

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

Almost done! I think one test case just needs a little bit of tweaking.

@hopinxian hopinxian merged commit f40f50d into AY2021S1-CS2103T-T13-1:master Oct 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Implementation Coding required priority.High Needs to be completed soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fixing id reference of visits
4 participants