Skip to content
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

Links to filings datatable with committee_id do not work-Front-end Redirects Research #5707

Open
3 tasks
Tracked by #232
johnnyporkchops opened this issue Apr 19, 2023 · 4 comments · May be fixed by #5852
Open
3 tasks
Tracked by #232

Links to filings datatable with committee_id do not work-Front-end Redirects Research #5707

johnnyporkchops opened this issue Apr 19, 2023 · 4 comments · May be fixed by #5852

Comments

@johnnyporkchops
Copy link
Contributor

johnnyporkchops commented Apr 19, 2023

Summary

The link to an unverified committee doesn't seem to work anymore., https://www.fec.gov/data/filings/?data_type=processed&committee_id=C00780197, but links to unverified candidates seem to still work, https://www.fec.gov/data/filings/?data_type=processed&candidate_id=H8NC00023.

What happened?
https://www.fec.gov/data/filings/?data_type=processed&committee_id=C00780197 shows all filings with no filter

What should have happened?
https://www.fec.gov/data/filings/?data_type=processed&committee_id=C00780197 should show nine filings for the unverified committee.

Completion Criteria Possible tech steps

  • Research redirects solution either using a redirect in proxy or in javascript

Completion criteria

@johnnyporkchops
Copy link
Contributor Author

johnnyporkchops commented Apr 23, 2023

Three brainstorming ideas:

  1. We can put a hidden text field with id="committee_id" using the simple text field macro (don't necessarily need a hidden typeahead field) in the filings_filter.jinja which would allow committee_id to work in a URL (including unverified comms)

    Remaining issues with this solution:

    • FIXED with Fix coalesce error in ofec_filings_all_mv openFEC#5424 unverified committees still need to be fixed for q_filer typeahead (@fec-jli and @hcaofec have fix)
    • Frontend issue: How to display the tag checkboxes in the filter panel to make sense to the user
    • API issue: You cannot combine committee_id and q_filer in the same URL or API query to the filings endpoint. (Tested on OpenFEC.)
  2. Or we could put two fields here instead:

    • one typeahead-only field field labeled Commitee id (with id="commitee_id")
    • And the existing typeahead/free-text field labeled Committee name or id(with id="q_filer")

    Remaining issues with this solution:

    • Would still need to resolve the API issue of not being able to combine committee_id and q_filer in the same API query to the filings endpoint. (Tested on OpenFEC.)
  3. Or maybe we can just redirect( in proxy app), URLS with /filings/?committee_id... to filings/?q_filer... because arguably it is a legacy pattern. Or redirect with this JS, with a pushState or replaceState to convert committee_id to q_filer in URLS: (Tested and works well)

      const queryx = this.parseParams(this.getVars());
      if (queryx.committee_id &&  /\/filings/.test(window.location.href)){
  
         if (queryx.q_filer) {
           queryx.q_filer  = urls.ensureArray(queryx.q_filer)
           queryx.q_filer.push(...urls.ensureArray(queryx.committee_id))
        }
       else {
          queryx.q_filer = queryx.committee_id
       }
    delete queryx.committee_id
    const urlx = new URL(window.location.href.split('?')[0])
    let new_query = URI.buildQuery(queryx) 
    let new_url = `${urlx}?${new_query}`
    history.pushState(null, '', new_url);
    //OR TO USE `replaceState` INSTEAD 

NOTE: Also @fec-jli mentioned that, of the two parameters, q_filer is the more "expensive" option and we should only call it when doing a free-text search, otherwise call the API, with committee_id, but which endpoint? This changes everything mentioned above :-(

@fec-jli
Copy link
Contributor

fec-jli commented Apr 24, 2023

@JonellaCulmer
Copy link
Contributor

Had a convo with back-end and database about this issue and we came to the following three issues that need resolution:

  1. Front-end solution to resolve issue - need to understand front-end limitations before addressing 2 and 3.
  2. Bookmarks need to function
  3. Database generated table can potentially be updated to reflect q-filer

@cnlucas cnlucas modified the milestones: Sprint 22.2, Sprint 22.3 Jul 13, 2023
@cnlucas cnlucas changed the title Links to filings datatable with committee_id do not work Links to filings datatable with committee_id do not work-Front-end Redirects Research Jul 13, 2023
@cnlucas
Copy link
Member

cnlucas commented Jul 13, 2023

Follow-up Typeahead research ticket #5800

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ❄️ Icebox
Development

Successfully merging a pull request may close this issue.

8 participants