Skip to content

Commit 8112d9c

Browse files
authored
Merge pull request #3072 from uclouvain/hotfix/OS-1673
2 parents e177538 + f700a8a commit 8112d9c

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

tests/views/autocomplete/test_learning_unit_years.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,27 @@
4444
class AutocompleteTestCase(TestCase):
4545
def test_autocomplete_learning_unit_year_and_classes(self):
4646
self.client.force_login(UserFactory())
47-
LearningUnitYearFactory(acronym="FOOBAR1", academic_year__year=2022)
47+
LearningUnitYearFactory(acronym="FOOBAR1", academic_year__year=2022, specific_title="Informatique A")
4848
LearningUnitYearFactory(
4949
acronym="FOOBAR2",
5050
academic_year__year=2022,
5151
learning_container_year__container_type=LearningContainerYearType.EXTERNAL.name,
52+
specific_title="Informatique B"
5253
)
5354
url = resolve_url('admission:autocomplete:learning-unit-years-and-classes')
54-
data = {'forward': '{"annee": "2022"}', 'q': 'FO'}
5555
response = self.client.get(url, format="json")
5656
self.assertEqual(response.status_code, 200)
5757
self.assertEqual(len(response.json()['results']), 0)
5858

59+
data = {'forward': '{"annee": "2022"}', 'q': 'FO'}
60+
response = self.client.get(url, data=data, format="json")
61+
self.assertEqual(response.status_code, 200)
62+
results = response.json()['results']
63+
self.assertEqual(len(results), 1)
64+
self.assertEqual(results[0]['id'], "FOOBAR1")
65+
66+
# Search by title and exclude the learning unit year with mobility
67+
data = {'forward': '{"annee": "2022"}', 'q': 'Informatique'}
5968
response = self.client.get(url, data=data, format="json")
6069
self.assertEqual(response.status_code, 200)
6170
results = response.json()['results']

views/autocomplete/learning_unit_years.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,18 @@ def get_list(self):
5757
if not sigle or not annee:
5858
return []
5959

60-
cmd = LearningUnitAndPartimSearchCommand(annee_academique=annee, code=sigle, types_a_exclure=types_a_exclure)
60+
cmd = LearningUnitAndPartimSearchCommand(
61+
annee_academique=annee,
62+
terme_de_recherche=sigle,
63+
types_a_exclure=types_a_exclure,
64+
)
6165
result_unites_enseignement = message_bus_instance.invoke(cmd)
6266

63-
cmd = SearchDetailClassesEffectivesCommand(annee=annee, code=sigle, types_a_exclure=types_a_exclure)
67+
cmd = SearchDetailClassesEffectivesCommand(
68+
annee=annee,
69+
terme_de_recherche=sigle,
70+
types_a_exclure=types_a_exclure,
71+
)
6472
result_classes = message_bus_instance.invoke(cmd)
6573

6674
full_results = result_unites_enseignement + result_classes

0 commit comments

Comments
 (0)