-
Notifications
You must be signed in to change notification settings - Fork 40
Use name where licence number isn't present #330
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting your first PR to this repository. We appreciate your contribution! Our team will review your code within 3 business days. We <3 open source and are so glad you do, too!
| dataHelper.getCaptainName(licenseNumber || captainName): | ||
| dataHelper.getCrewName(licenseNumber || crewName), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dataHelper functions find data using name when licence number is absent.
o-fish-web/src/components/partials/boarding-data.helper.js
Lines 205 to 213 in 14fbb74
| getCaptainName(item) { | |
| let captainName; | |
| this.boardings.forEach((boarding) => { | |
| if (boarding.captain.license === item || boarding.captain.name === item) { | |
| captainName = boarding.captain.name; | |
| } | |
| }); | |
| return captainName; | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't get this to display information when there was a crew member with a name but no license. e.g. http://localhost:3000/#/crew/view/{%22crew.name%22:%22Stowaway%22} (where I had a crew member named 'Stowaway' with no license number.
60b1546 to
67190c8
Compare
| let name; | ||
| this.boardings.forEach((boarding) => { | ||
| if (boarding.crew && boarding.crew.length) { | ||
| for (let crew of boarding.crew) { | ||
| if (crew.license === license) { | ||
| if (crew.license === item || crew.name === item) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Earlier I missed out the crew name function. This is fixed now.
|
@Sheeri It should be working now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Thanks.
|
Congratulations! 🎉 🙌 🎆 ㊗️ This PR is great and has been merged into the code. Thanks so much for contributing! If you'd like, you can request to work on another issue. We really appreciate your effort! To claim your O-FISH badge, head on over to the MongoDB Community forums, login, and reply - making sure to link to this PR. |
Related Issue
Fixes #322
Approach
Check for
captain nameifcaptain licenceisn't present to identify the crew is a captain and send the respective name to search for data.Checklist:
Optional items: