WildAid / o-fish-web

Web application for the Officer's Fishery Information Sharing Hub (O-FISH). The web app allows agencies to gain insights from the aggregated information gathered during a routine vessel inspection (submitted via the web app).
Apache License 2.0
32 stars 41 forks source link

Violations on View Boarding page #239

Closed o-fish-wildaid closed 3 years ago

o-fish-wildaid commented 4 years ago

Right now violations don't show up on the View Boarding page - /#/boardings/view - they should appear as per https://mongodb.invisionapp.com/share/VJXLVXNPGW4#/screens/420742269_Boarding_Record

mcastre commented 4 years ago

@o-fish-wildaid @Sheeri I would like to try this issue.

Sheeri commented 4 years ago

Hi @mcastre - as per our Contribution Guidelines - https://wildaid.github.io/contribute/index.html - we prefer to assign issues to folks to work serially - that is, only one issue per person at a time. You're already assigned issue #240. We do this is in order to be fair to everyone participating, in case this is an issue someone else really wants and can work on it before you can.

If you'd like, we can unassign #240 and assign this one to you, or you can work on #240 and let us know when you submit the PR, and we can assign this one to you if nobody else has asked first.

Thanks so much for being so eager to help the project!

mcastre commented 4 years ago

@Sheeri ah ok its no problem! ill just work on #240

pattimcletchie commented 4 years ago

@o-fish-wildaid I'd like to give this a try -- I may need some help but I am in the digital ocean hacktoberfest zoom with @Sheeri now.

Sheeri commented 4 years ago

Hello @pattimcletchie, thanks for offering to work on this! I have assigned it to you.

pattimcletchie commented 4 years ago

@o-fish-wildaid @am-MongoDB @Sheeri I am having an issue getting the map to work on <ViolationsSection> on the boarding-view.component.js -- Cannot read property 'map' of undefined I feel like if I knew the codebase better I'd be able to track down this bug. Any thoughts?

Sheeri commented 4 years ago

Which page does this correspond to? is it /#/boardings/null or /#/boardings/view/RECORD_ID or something else?

pattimcletchie commented 4 years ago

Hi @Sheeri, sorry for the delay (work got in my way). The page in question is /#/boardings/view/RECORD_ID. Here is a screenshot for reference just in case that is helpful.

Screen Shot 2020-10-22 at 8 04 27 PM
Sheeri commented 4 years ago

Hi @pattimcletchie - ugh, that's a frustrating issue. I hunted it down on the sandbox server, it had to do with other code not being up to date, which I've fixed on the sandbox server. Can you try now?

Sheeri commented 4 years ago

Hi @pattimcletchie - are you still planning on working on this for hacktoberfest?

pattimcletchie commented 4 years ago

@Sheeri yes, sorry! Work has been insane. I will work on this tonight.

pattimcletchie commented 4 years ago

@Sheeri I am getting the exact same error and I pulled down the latest. Not sure what is going on.

Sheeri commented 4 years ago

Hrm.... maybe try making a new sandbox user and agency? I wonder if there's some data weirdness going on. The view boarding page works for me :(

pattimcletchie commented 4 years ago

@Sheeri, shoot. I tried that and still no dice. I can load the boardings page without the <ViolationsSection> but when I import it and <ViolationsSection dataObject={boarding} /> to line 106 on the boarding-view.component.js I get that mapping error.

Sheeri commented 4 years ago

Some things to check:

in boarding-view.component.js at the top, is this line uncommented? import ViolationsSection from './violations/violations.section';

If you're still getting that, then this file needs debugging: - src/components/boardings/boarding-view/violations/violations.section.js

I can see right away that the violations section is weird looking, it looks like that's more of an editing page than a view page. Check out src/components/boardings/boarding-view/crew/crew.section.js as more of a template.

As for the actual error - when something is undefined, look to where it's assigned. In this case it looks like 'values' is the undefined thing that 'map' can't use.

'values' is defined at the beginning of the 'render()' portion as: const values = this.state.data;

and this.state.data is defined at the top as: data: props.dataObject.violations

You're passing <ViolationsSection dataObject={boarding} />, so what I'd do is at the beginning of the render section, do something like: console.log(this.state); and see what you get (you may need to comment out the map part of the page so the errors don't interfere with loading the page).

My bet is that 'violations' isn't an object in the boarding object. (and from my own knowledge of the schema, it's more likely to be something like inspection.summary.violations or something)

Hope that helps!

Sheeri commented 3 years ago

This has been fixed.