Skip to content

Commit

Permalink
naming
Browse files Browse the repository at this point in the history
  • Loading branch information
delcroip committed Oct 17, 2024
1 parent e869cc0 commit 89c533a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions policy/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,23 +137,23 @@ class Meta:
from claim.models import Claim
@receiver(post_save, sender=Claim)
@receiver(post_delete, sender=Claim)
def clean_inquire_cache(sender, instance, *args, **kwagrs):
cache.delete(f'elegibility_{instance.insuree.family_id or instance.insuree.id}_*')
def clean_enquire_cache_claim(sender, instance, *args, **kwagrs):
cache.delete(f'eligibility_{instance.insuree.family_id or instance.insuree.id}_*')


@receiver(post_save, sender=Product)
@receiver(post_delete, sender=Product)
def clean_all_inquire_cache(sender, instance, *args, **kwagrs):
cache.delete(f'elegibility_*')
def clean_all_enquire_cache_product(sender, instance, *args, **kwagrs):
cache.delete(f'eligibility_*')


@receiver(post_save, sender=Policy)
@receiver(post_delete, sender=Policy)
def clean_all_inquire_cache(sender, instance, *args, **kwagrs):
cache.delete(f'elegibility_{instance.family_id}_*')
def clean_all_enquire_cache_policy(sender, instance, *args, **kwagrs):
cache.delete(f'eligibility_{instance.family_id}_*')


@receiver(post_save, sender=Family)
@receiver(post_delete, sender=Family)
def clean_all_inquire_cache(sender, instance, *args, **kwagrs):
cache.delete(f'elegibility_{instance.id}_*')
def clean_all_enquire_cache_family(sender, instance, *args, **kwagrs):
cache.delete(f'eligibility_{instance.id}_*')
4 changes: 2 additions & 2 deletions policy/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ def get_total_filter(category):
)

# InsPol -> Policy -> Product -> dedrem
result = cache.get(f'elegibility_{insuree.family_id or insuree.id}_{insuree.id}')
result = cache.get(f'eligibility_{insuree.family_id or insuree.id}_{insuree.id}')
if not result:
result = InsureePolicy.objects \
.filter(
Expand Down Expand Up @@ -816,7 +816,7 @@ def get_total_filter(category):
).order_by(
'-expiry_date'
).first()
cache.set(f'elegibility_{insuree.family_id or insuree.id}_{insuree.id}', result, None)
cache.set(f'eligibility_{insuree.family_id or insuree.id}_{insuree.id}', result, None)

if result is None:
eligibility.total_admissions_left = 0
Expand Down

0 comments on commit 89c533a

Please sign in to comment.