Commit 797fc4e6 authored by Imane Misrar's avatar Imane Misrar
Browse files

feat(university.py) : add isDestinationOpen key for denormalized_infos

Relates to #148
parent 7fa26980
......@@ -75,9 +75,19 @@ class UniversityViewSet(EssentialModuleViewSet):
def update_denormalized_univ_field():
logger.info("Computing the denormalized offers/semester/major in university")
for university in University.objects.all().prefetch_related("offers", "exchanges"):
for university in University.objects.all().prefetch_related(
"offers", "exchanges", "corresponding_utc_partners"
):
denormalized_infos = dict()
# handling of corresponding_utc_partners
denormalized_infos["isDestinationOpen"] = (
university.corresponding_utc_partners.filter(
is_destination_open=True
).count()
> 0
)
# handling of offers
for offer in university.offers.all():
semester = "{}{}".format(offer.semester, offer.year)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment