CrisisCleanup / crisiscleanup-2

[OLD] This version of the codebase was retired on March 27, 2020. Open Source Collaborative Disaster Recovery and Cleanup
https://www.crisiscleanup.org
Other
42 stars 24 forks source link

Hurricane Irma Duplicate Dropdown #324

Closed aarontitus closed 6 years ago

aarontitus commented 7 years ago

Several users are reporting that the latest incident (Hurricane Irma, Event ID 61) appears twice in the drop-down menu. While we cannot reproduce the error locally, users have submitted screenshots showing the error (confirmed in at least Chrome), as well as the following HTML:

<label>
<select id="incident-chooser">
<option value="61" selected >Hurricane Irma</option>
<option value="61" selected >Hurricane Irma</option>
<option value="60" >Hurricane Harvey</option>
<option value="59" >West Virginia Flood, Jul 2017</option>
<option value="58" >Illinois-Wisconsin Floods Jul 2017</option>

...so it is a confirmed error. It's apparently harmless, but confusing.

aarontitus commented 7 years ago

Update: at least one user reports that there are now 3 copies of Irma in the dropdown.

Kibble commented 6 years ago

Can this be an issue with the mapping between organizations and events? I'm not able to see the data that caused this bug but have noticed that if there is a duplicate organization to legacy event mapping, the incident shows up twice.

If someone with access could look at the data, we can determine if it is a data issue or not.

aarontitus commented 6 years ago

@Kibble That is a really smart place to start. I'm going to test that premise on staging right now and report back.

aarontitus commented 6 years ago

@Kibble That's the problem. Here is my process:

  1. On the staging website I logged in as Organization ID 130 (ITDRC). I confirmed that there were no duplicate incidents in the dropdown.

  2. In the staging database, I confirmed that Org ID 130 had no duplicate entries in the legacy_organization_events table:

    SELECT * FROM legacy_organization_events
    WHERE legacy_organization_id = 130
    ORDER BY legacy_event_id;

    Returns:

    id,org_id,event_id
    ...
    1806,130,58
    1824,130,59
    2188,130,60
    2218,130,61
  3. I inserted the following duplicates:

    INSERT INTO   legacy_organization_events(legacy_organization_id,legacy_event_id) VALUES   (130, 58);
    INSERT INTO   legacy_organization_events(legacy_organization_id,legacy_event_id) VALUES   (130, 59);
    INSERT INTO   legacy_organization_events(legacy_organization_id,legacy_event_id) VALUES   (130, 59);
    INSERT INTO   legacy_organization_events(legacy_organization_id,legacy_event_id) VALUES   (130, 60);
    INSERT INTO   legacy_organization_events(legacy_organization_id,legacy_event_id) VALUES   (130, 60);
    INSERT INTO   legacy_organization_events(legacy_organization_id,legacy_event_id) VALUES   (130, 60);
    INSERT INTO   legacy_organization_events(legacy_organization_id,legacy_event_id) VALUES   (130, 61);
    INSERT INTO   legacy_organization_events(legacy_organization_id,legacy_event_id) VALUES   (130, 61);
    INSERT INTO   legacy_organization_events(legacy_organization_id,legacy_event_id) VALUES   (130, 61);

    I then confirmed that they inserted correctly.

  4. I refreshed, and get this in the HTML markup:

                <select id="incident-chooser">
                  <option value="61"  selected >Hurricane Irma</option>
                  <option value="61"  selected >Hurricane Irma</option>
                  <option value="61"  selected >Hurricane Irma</option>
                  <option value="61"  selected >Hurricane Irma</option>
                  <option value="60" >Hurricane Harvey</option>
                  <option value="60" >Hurricane Harvey</option>
                  <option value="60" >Hurricane Harvey</option>
                  <option value="60" >Hurricane Harvey</option>
                  <option value="59" >West Virginia Flood, Jul 2017</option>
                  <option value="59" >West Virginia Flood, Jul 2017</option>
                  <option value="59" >West Virginia Flood, Jul 2017</option>
                  <option value="58" >Illinois-Wisconsin Floods Jul 2017</option>
                  <option value="58" >Illinois-Wisconsin Floods Jul 2017</option>
                  <option value="46" >S. GA Tornadoes Jan 2017</option>
                  <option value="45" >Hattiesburg-Petal Tornado</option>

    So for now, I think the solution is to add a SELECT DISTINCT(legacy_event_id) clause into the dropdown creation script.

aarontitus commented 6 years ago

@Kibble One note: @tsanders has been writing a major upgrade on a new platform (Vue.js/ Python) and I think we are depreciating this code. A temporary fix would be great, but I wanted to let you know that we'll be updating the README files shortly to indicate that we are depreciating the code. I don't want you to spin your wheels. Thanks so much, though, for identifying the issue.

Kibble commented 6 years ago

@aarontitus Thanks for the update! I was also on the group call with @pantherchild and you can add me to the list for updates as well if you'd like.

augray commented 6 years ago

@tsanders has been writing a major upgrade on a new platform (Vue.js/ Python)

@aarontitus : Are you saying all of Crisis Cleanup is being replaced by a python + Vue.js stack, or just some pieces? I'm interested in contributing to this project, but I'm having to learn ruby & rails first. However, I'm already a python guy. And I've been wanting to learn Vue.js for other reasons :-)

Sorry if this isn't the best place for this question- happy to move to another forum if you suggest.

aarontitus commented 6 years ago

@augray yes, as a matter of fact, that's exactly what I'm saying. Ask @tsanders for access. It's chiefly a private repository. We've got a ton of work to do on that codebase. Super excited for your help.

augray commented 6 years ago

I guess that explains why the build has been down for a while and a PR I made has been sitting for a while 😄 . Thanks! @tsanders : Would you mind giving me access? Also, it sounds like things are in a pretty nascent state, so perhaps we should find some time/way to discuss how I could most be of assistance.