USGS-WiM / whispers

Wildlife Health Information Sharing Partnership event reporting system(WHISPers) v2
Other
2 stars 1 forks source link

Event details not visible on front end after added event org #1217

Closed JChipault closed 3 years ago

JChipault commented 3 years ago

I know, I know... logging this right before a long weekend just adds to my reputation of always putting in bugs on Fridays... sorry... but I hit this weird one just now....

Describe the bug I was on the event details page for 201146. The event was marked as complete when I first arrived at it. It had no event organization listed (null on the front end). I toggled the event to "incomplete". I added an event org (ID 1875). The event org did not show up on the page after I added it so I refreshed my browser (firefox) and then I got this: image

I connected with Neil to see what he could make of this. He got same screen when he went to look at the event details page for 201146. He checked the backend tables and he can see the event there (with event org 1875). He realized that 1875 did not have an admin level one so he added that in case that was what was causing the issue... but event details still not displaying.

You can run a search for Missouri events since 1/1/21 and see the dot for 201146 on the home page.

Neil also had same issue of not seeing event details in multiple browsers.

Of note (perhaps): event org is a required field and that business rule is enforced during create event; however, we've known for a while that that business rule was not being enforced on the event details page (someone can edit an event and remove all event orgs, which was where this event stood when I first opened it today). So perhaps me trying to add an event org to an event that had no event org made the business rule checks go haywire? I know I've done this move before without having the event disappear on me, but perhaps something in the business rule checks has changed since last time I added an event org to an event without any event org?

aaronstephenson commented 3 years ago

Hi @JChipault, it looks like there is a bug in the serializer in the get_organizations section. You can see the error in the browser's dev tools: image

It appears that Organization 1875 has a null country_id value, which is allowed by the table definition but something I must have forgotten about when I wrote this section of code. I will have a fix done shortly.

As for the business rules, those haven't been touched in ages. If you want the event org to be required on event updates, feel free to create an issue for it and mention the priority, I could do it yet this FY or next.

aaronstephenson commented 3 years ago

Fixed in 2.1.5 (a1d8bc4) and pushed to both test and prod.

JChipault commented 3 years ago

Thanks, Aaron! I should have put a country code in when I created that org.

Regarding the more general topic of business rules, there's a handful that aren't being enforced across all forms on the front end, so at some point we'll likely bundle those together and let y'all know where we see the discrepancies. We've been sitting on these issues though because they are minor, so no worries (e.g., I know there should be an event org so I just add one in when I do a quality check of the data). We'll keep an eye on the budget and maybe submit these as funding allows. Thanks!