codeforpdx / recordexpungPDX

A project to automate the expungement of qualifying criminal records in Oregon. This project is done in conjunction with Qiu-Qiu Law.
https://recordsponge.com
MIT License
51 stars 89 forks source link

Do not show "Charges are ineligible until balance is paid" if charge is already ineligible #1253

Closed KentShikama closed 4 years ago

KentShikama commented 4 years ago

Screen Shot 2020-06-16 at 6 31 29 AM

Ark20 commented 4 years ago

@KentShikama I'm not super clear on the backend but want to fix this one. How would I check the charge eligibility in the case file ? I was thinking of adding a second condition to my ternary that checks if eligible

KentShikama commented 4 years ago

Since the banner is applied on the case, the logic more precisely is that if all charges on the case are ineligible, then don't show the banner. Everything comes as part of the record summary object from the backend. See the response object for the /api/search endpoint request at Tools -> Web Developer -> Network.

Ark20 commented 4 years ago

Thanks @KentShikama! With that logic I can still see the banner if say one charge is ineligible but others aren't. @hmarcks used the language "Eligible charges become eligible when balance is paid" can we make the banner say that or "Eligible charges are ineligible until balance is paid"

Screen Shot 2020-06-17 at 1 28 39 AM
Ark20 commented 4 years ago

The updated logic


    let allIneligible = 0
    for (let i = 0; i < charges.length; i++){ 
      let typeEligibility = charges[i].expungement_result.type_eligibility.status
      if (typeEligibility == "Ineligible") {
        ineligibleCharges++
      }
    }
    if (ineligibleCharges == charges.length) {
        allIneligible=1
      }