Skip to content

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

Merged
merged 1 commit into from
Oct 20, 2020

Conversation

ayushjainrksh
Copy link
Contributor

@ayushjainrksh ayushjainrksh commented Oct 19, 2020

Related Issue

Fixes #322

Approach

Check for captain name if captain licence isn't present to identify the crew is a captain and send the respective name to search for data.

Checklist:

  • I have read the contributor's guide.
  • I linked an issue in the previous section
  • I have commented on the linked issue
  • I was assigned the linked issue (not required)
  • I have tested the change to the best of my ability against the sandbox or a local build.

Optional items:

  • My change adds new text and requires a change to translations.
  • My change requires a change to the documentation.
  • I have submitted a PR to the documentation repo.
  • I was not able to test... (explain below, e.g. you did not have permissions to test a specific feature)
  • This change depends O-FISH Realm repository changes (explain below)

Copy link

@github-actions github-actions bot left a 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!

Comment on lines +78 to +79
dataHelper.getCaptainName(licenseNumber || captainName):
dataHelper.getCrewName(licenseNumber || crewName),
Copy link
Contributor Author

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.

getCaptainName(item) {
let captainName;
this.boardings.forEach((boarding) => {
if (boarding.captain.license === item || boarding.captain.name === item) {
captainName = boarding.captain.name;
}
});
return captainName;
}

Copy link
Collaborator

@Sheeri Sheeri left a 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.

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) {
Copy link
Contributor Author

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.

@ayushjainrksh
Copy link
Contributor Author

@Sheeri It should be working now.

Copy link
Collaborator

@Sheeri Sheeri left a 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.

@Sheeri Sheeri merged commit dd7c7b8 into WildAid:main Oct 20, 2020
@Sheeri
Copy link
Collaborator

Sheeri commented Oct 20, 2020

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.

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.

When Crew license # doesn't exist, Crew member page 'name' is "N/A"
2 participants