Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rex Dri
Rex Dri
Commits
797fc4e6
Commit
797fc4e6
authored
May 10, 2020
by
Imane Misrar
Browse files
feat(university.py) : add isDestinationOpen key for denormalized_infos
Relates to
#148
parent
7fa26980
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/backend_app/models/university.py
View file @
797fc4e6
...
@@ -75,9 +75,19 @@ class UniversityViewSet(EssentialModuleViewSet):
...
@@ -75,9 +75,19 @@ class UniversityViewSet(EssentialModuleViewSet):
def
update_denormalized_univ_field
():
def
update_denormalized_univ_field
():
logger
.
info
(
"Computing the denormalized offers/semester/major in university"
)
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
()
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
# handling of offers
for
offer
in
university
.
offers
.
all
():
for
offer
in
university
.
offers
.
all
():
semester
=
"{}{}"
.
format
(
offer
.
semester
,
offer
.
year
)
semester
=
"{}{}"
.
format
(
offer
.
semester
,
offer
.
year
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment