JustUtahCoders / utahexpungements.org

The frontend code for utahexpungements.org
MIT License
11 stars 19 forks source link

created isClassAMisdemeanor flag function #169

Closed HappyViki closed 4 years ago

HappyViki commented 4 years ago

I tried my best to create a function based off of the law. I'm pretty sure that we either need to be able to process multiple dockets at once or have a different counting system in place, other than true/false object.

Law:

(b) any combination of three or more convictions other than for drug possession offenses that include two class A misdemeanor convictions, each of which is contained in a separate criminal episode;

This is pseudo code I wrote that I based my final function on:

Flag = FALSE

Convictions = {
class_a_misdemeanor:0,
plain:0
}

Convictions per docket:
Skip if "drug possession offense" found
Return plain++ if felony or any other conviction found
Return class_a_misdemeanor++ if "class A misdemeanor conviction" found

Multiple dockets:
Return Flag(TRUE) if TOTAL Convictions(3+) AND Convictions.class_a_misdemeanor(2+)