Skip to content

Commit

Permalink
fix: exlude morphed cds from expired cds
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-filicetti committed Dec 12, 2024
1 parent 41a05ed commit 1a195c1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cds/api/v1/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ def getExpiredCds(yearfrom=None, coursetypes=None):
course_tyeps_list = coursetypes.split(",")
query_course_types = Q(cds__tipo_corso_cod__in=course_tyeps_list)

cds_morphed = DidatticaCdsCollegamento.objects.values_list('cds_prec__cds_cod', flat=True)

regdids = (
DidatticaRegolamento.objects.filter(
# Ensure it's the record with the latest year
Expand All @@ -409,6 +411,8 @@ def getExpiredCds(yearfrom=None, coursetypes=None):
.exclude(stato_regdid_cod="R")
# exclude courses that have finished their regular life cycle
.exclude(aa_reg_did__lte=(settings.CURRENT_YEAR - F("cds__durata_anni")))
# exclude morphed courses
.exclude(cds__cds_cod__in=cds_morphed)
.values("aa_reg_did", "cds__cds_cod", "cds__durata_anni")
)

Expand Down

0 comments on commit 1a195c1

Please sign in to comment.