Skip to content

Commit

Permalink
District court offenses were showing up on the superior court petitio…
Browse files Browse the repository at this point in the history
…ns because the filter condition was using the jurisdiction fo the CIPRS record rather than the jurisdiction of the record. I suspect this is an artifact of the time when we thought a CIPRS record had only one jurisdiction. We now know that it is possible for a CIPRS record to have both in the case of superseding indictments. The convictions petitions should go by the jurisdiction of the offense, rather than the CIPRS record
  • Loading branch information
georgehelman committed Feb 11, 2024
1 parent 14464e6 commit c5fc92e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions dear_petition/petition/types/adult_felonies.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
def get_offense_records(batch, jurisdiction=""):
qs = OffenseRecord.objects.filter(offense__ciprs_record__batch=batch)
if jurisdiction:
qs = qs.filter(offense__ciprs_record__jurisdiction=jurisdiction)
qs = qs.filter(offense__jurisdiction=jurisdiction)
dob = resolve_dob(qs)
if not dob:
return qs # We can't determine this petition type without the date of birth
Expand All @@ -25,9 +25,9 @@ def get_offense_records(batch, jurisdiction=""):

def build_query(dob):
action = Q(action=pc.CONVICTED)
verdict = Q(severity__iexact=pc.SEVERITIES.FELONY)
severity = Q(severity__iexact=pc.SEVERITIES.FELONY)
today = timezone.now().date()
waiting_period_start_date = today - relativedelta(years=10)
waiting_period = Q(offense__disposed_on__lt=waiting_period_start_date)
query = action & verdict & waiting_period
query = action & severity & waiting_period
return query
6 changes: 3 additions & 3 deletions dear_petition/petition/types/adult_misdemeanors.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
def get_offense_records(batch, jurisdiction=""):
qs = OffenseRecord.objects.filter(offense__ciprs_record__batch=batch)
if jurisdiction:
qs = qs.filter(offense__ciprs_record__jurisdiction=jurisdiction)
qs = qs.filter(offense__jurisdiction=jurisdiction)
dob = resolve_dob(qs)
if not dob:
return qs # We can't determine this petition type without the date of birth
Expand All @@ -25,9 +25,9 @@ def get_offense_records(batch, jurisdiction=""):

def build_query(dob):
action = Q(action=pc.CONVICTED)
verdict = Q(severity__iexact=pc.SEVERITIES.MISDEMEANOR)
severity = Q(severity__iexact=pc.SEVERITIES.MISDEMEANOR)
today = timezone.now().date()
waiting_period_start_date = today - relativedelta(years=5)
waiting_period = Q(offense__disposed_on__lt=waiting_period_start_date)
query = action & verdict & waiting_period
query = action & severity & waiting_period
return query

0 comments on commit c5fc92e

Please sign in to comment.