Skip to content
This repository has been archived by the owner on Jan 11, 2021. It is now read-only.

Create and modify fields for Person #119

Merged

Conversation

LeeJoonJie
Copy link
Collaborator

@LeeJoonJie LeeJoonJie commented Oct 16, 2020

Created Experience, Salary and UrlLink classes for use in Person. Modified Address field to be optional for Person.
Closes #105
Closes #111
Closes #114
Closes #117
Closes #57
Closes #58

Create Experience class. The new experience field in Person represents the number of years of experience the person has in that job. It has to be a non-negative number to be valid. Updates were also made to the relevant tests.
Create ExperienceTest class
The UrlLink class is used to represent a Person's personal url page. It is an optional field for Person. Tests were also updated.
The updated isValidLink method uses the UrlValidator class from the apache commons library to validate the format of the link. The apache commons validator (v1.7) dependency was also added to the build.gradle file.
Test UrlLink in new class. Also, update old tests with the UrlLink field.
Previously, UrlLink field in Person cannot be reset/cleared after adding a valid url link. Now the command "edit can {index} link/" without any arguments will clear the url link. The urlLink field will be changed back to null in personaddressbook.json.
When adding candidate with "link/" empty link prefix, there is a null pointer exception. This was fixed by changing Optional.of method to Optional.ofNullable method that is able to accept null as parameter.
The Salary class is a data class used to represent expected salary of a Person. The new Salary field was added to Person and is optional.
Create SalaryTest class to test new Salary field. Also update old tests with the Salary.
Originally, the Address field for candidates was a compulsory field. It is not optional.
Previously, the usage message for Edit Job shows that all fields except Tag were compulsory. This is incorrect. All fields should be optional for Edit Job command (at least 1 field present). This has been changed to all fields optional.
Logic for the resetting of optional fields such as "link/" and "sal/" in Person has been shifted from ParserUtil.java to EditPersonCommand.java. This is so that other commands (apart from "edit can") will not be affected by it as this might cause bugs. These optional fields can only be reset in "edit can" commands so the logic should be localised in the EditPersonCommand class, not in the ParserUtil class used by multiple commands.
@codecov-io
Copy link

Codecov Report

Merging #119 into master will increase coverage by 0.56%.
The diff coverage is 81.40%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #119      +/-   ##
============================================
+ Coverage     75.26%   75.83%   +0.56%     
- Complexity      576      626      +50     
============================================
  Files            91       94       +3     
  Lines          1767     1924     +157     
  Branches        207      235      +28     
============================================
+ Hits           1330     1459     +129     
- Misses          390      407      +17     
- Partials         47       58      +11     
Impacted Files Coverage Δ Complexity Δ
...va/seedu/address/logic/commands/AddJobCommand.java 100.00% <ø> (ø) 8.00 <0.00> (ø)
...seedu/address/logic/commands/AddPersonCommand.java 100.00% <ø> (ø) 8.00 <0.00> (ø)
...a/seedu/address/logic/commands/EditJobCommand.java 96.20% <ø> (ø) 12.00 <0.00> (ø)
.../java/seedu/address/model/information/Address.java 90.00% <ø> (+10.00%) 7.00 <0.00> (+1.00)
.../java/seedu/address/model/util/SampleDataUtil.java 8.10% <0.00%> (-3.44%) 1.00 <0.00> (ø)
src/main/java/seedu/address/ui/PersonCard.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
.../java/seedu/address/model/information/UrlLink.java 76.92% <76.92%> (ø) 5.00 <5.00> (?)
...n/java/seedu/address/model/information/Person.java 92.85% <83.33%> (-4.71%) 27.00 <7.00> (+6.00) ⬇️
...va/seedu/address/model/information/Experience.java 84.61% <84.61%> (ø) 6.00 <6.00> (?)
...n/java/seedu/address/model/information/Salary.java 84.61% <84.61%> (ø) 5.00 <5.00> (?)
... and 10 more

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 93465e9...2065083. Read the comment docs.

Copy link
Collaborator

@vanGoghhh vanGoghhh left a comment

Choose a reason for hiding this comment

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

LGTM Good Job!

@vanGoghhh vanGoghhh merged commit 7fb312d into AY2021S1-CS2103T-T17-3:master Oct 16, 2020
@g-erm g-erm added this to the v1.3 milestone Oct 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.