Skip to content

Commit

Permalink
Finish openimis/django31
Browse files Browse the repository at this point in the history
Django 3.1
  • Loading branch information
dragos-dobre authored Oct 4, 2022
2 parents 04e4de9 + ee9a26c commit 52235e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions policy/services.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
from dataclasses import dataclass
from datetime import datetime as py_datetime
from datetime import datetime as py_datetime, date as py_date

import core
from claim.models import ClaimService, Claim, ClaimItem
Expand Down Expand Up @@ -256,7 +256,7 @@ def build_query(self, req):
res = res.filter(*core.filter_validity())
if req.active_or_last_expired_only:
# sort on status, so that any active policy (status = 2) pops up...
res = res.annotate(not_null_expiry_date=Coalesce('expiry_date', py_datetime.max)) \
res = res.annotate(not_null_expiry_date=Coalesce('expiry_date', py_date.max)) \
.annotate(not_null_validity_to=Coalesce('validity_to', py_datetime.max)) \
.order_by('product__code', 'status', '-not_null_expiry_date', '-not_null_validity_to', '-validity_from')
return res
Expand Down

0 comments on commit 52235e7

Please sign in to comment.