toulouse-maelis: add service filter on read_nursery_list (#81538)
This commit is contained in:
parent
e1b3ab7646
commit
4bd7032998
|
@ -3853,10 +3853,17 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
parameters={
|
||||
'activity_type': {'description': "Type de l'activité.", 'example_value': 'CRECHCO'},
|
||||
'code_psu': {'description': 'Code PSU.', 'example_value': 'REGULAR'},
|
||||
'service_ids': {
|
||||
'description': 'Codes des services à filtrer, séparées par des virgules.',
|
||||
'example_value': 'A10054639474, A10054639473',
|
||||
},
|
||||
},
|
||||
)
|
||||
def read_nursery_list(self, request, activity_type=None, code_psu=None):
|
||||
def read_nursery_list(self, request, activity_type=None, code_psu=None, service_ids=None):
|
||||
nurseries = self.get_referential('Nursery')
|
||||
if service_ids:
|
||||
service_codes = [x.strip() for x in str(service_ids or '').split(',') if x.strip()]
|
||||
nurseries = [n for n in nurseries if n.get('idService') in service_codes]
|
||||
if activity_type:
|
||||
nurseries = [n for n in nurseries if n['activityType']['code'] == activity_type]
|
||||
if code_psu:
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<code>CRECHCO</code><libelle>Crèche collective</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000004</idActivity><libelle>CC BOULE DE GOMME</libelle>
|
||||
<idService>A10049329043</idService>
|
||||
<manager1>
|
||||
<lastname>SARRIMANE</lastname><firstname>Valerie</firstname><phone>05 61 62 08 49</phone><poste>ASSO</poste>
|
||||
</manager1>
|
||||
|
@ -29,6 +30,7 @@
|
|||
<code>CRECHCO</code><libelle>Crèche collective</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000005</idActivity><libelle>CC C.A.P.P.E.</libelle>
|
||||
<idService>A10049329043</idService>
|
||||
<manager1>
|
||||
<lastname>CALAZEL</lastname><firstname>Régine</firstname><phone>05 61 55 46 50</phone><poste>ASSO</poste>
|
||||
</manager1>
|
||||
|
@ -51,6 +53,7 @@
|
|||
<code>CRECHCO</code><libelle>Crèche collective</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000202</idActivity><libelle>Relais Petite Enfance PRADETTES</libelle>
|
||||
<idService>A10049329043</idService>
|
||||
<manager1>
|
||||
<lastname>BUSTAMENTE</lastname><firstname>Joëlle</firstname><phone>05 61 22 36 20</phone><poste>VT</poste>
|
||||
</manager1>
|
||||
|
@ -70,6 +73,7 @@
|
|||
<code>CRECHCO</code><libelle>Crèche collective</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000203</idActivity><libelle>Relais Petite Enfance REPUBLIQUE</libelle>
|
||||
<idService>A10049329043</idService>
|
||||
<manager1>
|
||||
<lastname>LEHMANN</lastname><firstname>Valérie</firstname><phone>05 34 55 78 06</phone><poste>VT</poste>
|
||||
</manager1>
|
||||
|
@ -92,6 +96,7 @@
|
|||
<code>CRECHCO</code><libelle>Crèche collective</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000204</idActivity><libelle>SECTEUR 1</libelle><obs2>Secteur 1</obs2>
|
||||
<idService>A10049329043</idService>
|
||||
<unitList>
|
||||
<idUnit>M10053180935</idUnit><libelle>SECTEUR 1 - Réguliers</libelle><typeAcc>REGULAR</typeAcc>
|
||||
</unitList>
|
||||
|
@ -110,6 +115,7 @@
|
|||
<code>CRECHCO</code><libelle>Crèche collective</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000205</idActivity><libelle>SECTEUR 2</libelle><obs2>Secteur 2</obs2>
|
||||
<idService>A10049329043</idService>
|
||||
<unitList>
|
||||
<idUnit>M10053180939</idUnit><libelle>SECTEUR 2 - Occasionnels</libelle><typeAcc>OCCASIONAL</typeAcc>
|
||||
</unitList>
|
||||
|
@ -125,6 +131,7 @@
|
|||
<code>CRECHCO</code><libelle>Crèche collective</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000206</idActivity><libelle>SECTEUR 3</libelle><obs2>Secteur 3</obs2>
|
||||
<idService>A10049329043</idService>
|
||||
<unitList>
|
||||
<idUnit>M10053180941</idUnit><libelle>SECTEUR 3 - Réguliers</libelle><typeAcc>REGULAR</typeAcc>
|
||||
</unitList>
|
||||
|
@ -165,6 +172,7 @@
|
|||
<code>CRECHFAM</code><libelle>Crèche familiale</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000051</idActivity><libelle>C. FAMILIALE GERMAINE CHAUMEL</libelle>
|
||||
<idService>A10049329048</idService>
|
||||
<manager1>
|
||||
<lastname>FRADET</lastname><firstname>FREDERIQUE</firstname><phone>05 34 40 70 59</phone><poste>VT</poste>
|
||||
</manager1>
|
||||
|
@ -187,6 +195,7 @@
|
|||
<code>CRECHFAM</code><libelle>Crèche familiale</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000054</idActivity><libelle>C. FAMILIALE LAMPÀGIA</libelle>
|
||||
<idService>A10049329048</idService>
|
||||
<manager1>
|
||||
<lastname>PELLIZZARI</lastname><firstname>SOPHIE</firstname><phone>05 31 22 98 65</phone><poste>VT</poste>
|
||||
</manager1>
|
||||
|
@ -207,6 +216,7 @@
|
|||
<libelle>Crèche collective</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000001</idActivity>
|
||||
<idService>A10049327627</idService>
|
||||
<libelle>CC AMIDONNIERS</libelle>
|
||||
<manager1>
|
||||
<lastname>THOMAS</lastname>
|
||||
|
|
|
@ -10230,10 +10230,18 @@ def test_read_nursery_list(con, app):
|
|||
{'idUnit': 'M10053212403', 'libelle': 'CC AMIDONNIERS - Occasionnels', 'typeAcc': 'OCCASIONAL'},
|
||||
],
|
||||
'idActivity': 'M10000000001',
|
||||
'idService': None,
|
||||
'idService': 'A10049327627',
|
||||
'activityType': {'code': 'CRECHCO', 'libelle': 'Crèche collective'},
|
||||
}
|
||||
|
||||
resp = app.get(url, params={'service_ids': 'A10049329048,A10049327627'})
|
||||
assert len(resp.json['data']) == 3
|
||||
assert all(x['idService'] in ['A10049329048', 'A10049327627'] for x in resp.json['data'])
|
||||
|
||||
resp = app.get(url, params={'service_ids': 'A10049329048'})
|
||||
assert len(resp.json['data']) == 2
|
||||
assert all(x['idService'] == 'A10049329048' for x in resp.json['data'])
|
||||
|
||||
|
||||
def test_get_nursery_geojson(con, app):
|
||||
url = get_endpoint('get-nursery-geojson')
|
||||
|
@ -10293,7 +10301,7 @@ def test_get_nursery_geojson(con, app):
|
|||
},
|
||||
],
|
||||
'idActivity': 'M10000000001',
|
||||
'idService': None,
|
||||
'idService': 'A10049327627',
|
||||
'activityType': {'code': 'CRECHCO', 'libelle': 'Crèche collective'},
|
||||
'activity_id': 'M10000000001',
|
||||
'place_id': 'M10053212401',
|
||||
|
|
Loading…
Reference in New Issue