Skip to content

Commit

Permalink
Merge pull request #462 from deardurham/adult_convictions
Browse files Browse the repository at this point in the history
District court offenses were showing up on the superior court petitio…
  • Loading branch information
georgehelman authored Feb 19, 2024
2 parents 14464e6 + c5fc92e commit 7fa7cb9
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 7fa7cb9

Please sign in to comment.