toulouse-maelis: display default template values in manager (#83054)
gitea/passerelle/pipeline/head This commit looks good
Details
gitea/passerelle/pipeline/head This commit looks good
Details
This commit is contained in:
parent
1b0c842d48
commit
34ac701200
|
@ -747,10 +747,8 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
if value is None:
|
||||
dico[key] = ''
|
||||
|
||||
def read_rl_list_raw(self, family_id, text_template=None, income_year=None):
|
||||
def read_rl_list_raw(self, family_id, text_template, income_year=None):
|
||||
result = self.get_family_raw(family_id, incomeYear=income_year)
|
||||
if not text_template:
|
||||
text_template = '{{ lastname }} {{ firstname }}'
|
||||
|
||||
for rlg in 'RL1', 'RL2':
|
||||
item = result.get(rlg)
|
||||
|
@ -762,10 +760,8 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
item['family_id'] = family_id
|
||||
yield item
|
||||
|
||||
def read_child_list_raw(self, family_id, text_template=None):
|
||||
def read_child_list_raw(self, family_id, text_template):
|
||||
result = self.get_family_raw(family_id)
|
||||
if not text_template:
|
||||
text_template = '{{ lastname }} {{ firstname }}'
|
||||
|
||||
for item in result['childList']:
|
||||
self.add_text_value_to_child(item)
|
||||
|
@ -1252,12 +1248,18 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
'family_id': {'description': 'Numéro de DUI'},
|
||||
'text_template': {
|
||||
'description': 'Gabarit utilisé pour la valeur text',
|
||||
'example_value': '{{ lastname }} {{ firstname }}',
|
||||
},
|
||||
'income_year': {'description': 'Année de revenu pour filtrer les quotients'},
|
||||
},
|
||||
)
|
||||
def read_rl_list(self, request, NameID=None, family_id=None, text_template=None, income_year=None):
|
||||
def read_rl_list(
|
||||
self,
|
||||
request,
|
||||
NameID=None,
|
||||
family_id=None,
|
||||
text_template='{{ lastname }} {{ firstname }}',
|
||||
income_year=None,
|
||||
):
|
||||
family_id = family_id or self.get_link(NameID).family_id
|
||||
return {'data': list(self.read_rl_list_raw(family_id, text_template))}
|
||||
|
||||
|
@ -1270,16 +1272,14 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
'family_id': {'description': 'Numéro de DUI'},
|
||||
'text_template': {
|
||||
'description': 'Gabarit utilisé pour la valeur text',
|
||||
'example_value': '{{ lastname }} {{ firstname }}',
|
||||
},
|
||||
},
|
||||
)
|
||||
def read_person_list(self, request, NameID=None, family_id=None, text_template=None):
|
||||
def read_person_list(
|
||||
self, request, NameID=None, family_id=None, text_template='{{ lastname }} {{ firstname }}'
|
||||
):
|
||||
family_id = family_id or self.get_link(NameID).family_id
|
||||
result = self.get_family_raw(family_id)
|
||||
if not text_template:
|
||||
text_template = '{{ lastname }} {{ firstname }}'
|
||||
|
||||
data = []
|
||||
for item in result['emergencyPersonList']:
|
||||
self.add_text_value_to_person(item)
|
||||
|
@ -1298,11 +1298,12 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
'family_id': {'description': 'Numéro de DUI'},
|
||||
'text_template': {
|
||||
'description': 'Gabarit utilisé pour la valeur text',
|
||||
'example_value': '{{ lastname }} {{ firstname }}',
|
||||
},
|
||||
},
|
||||
)
|
||||
def read_child_list(self, request, NameID=None, family_id=None, text_template=None):
|
||||
def read_child_list(
|
||||
self, request, NameID=None, family_id=None, text_template='{{ lastname }} {{ firstname }}'
|
||||
):
|
||||
family_id = family_id or self.get_link(NameID).family_id
|
||||
return {'data': list(self.read_child_list_raw(family_id, text_template))}
|
||||
|
||||
|
@ -1315,16 +1316,19 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
'family_id': {'description': 'Numéro de DUI'},
|
||||
'rl_text_template': {
|
||||
'description': 'Gabarit utilisé pour la valeur text',
|
||||
'example_value': '{{ lastname }} {{ firstname }}',
|
||||
},
|
||||
'child_text_template': {
|
||||
'description': 'Gabarit utilisé pour la valeur text',
|
||||
'example_value': '{{ lastname }} {{ firstname }}',
|
||||
},
|
||||
},
|
||||
)
|
||||
def read_rl_and_child_list(
|
||||
self, request, NameID=None, family_id=None, rl_text_template=None, child_text_template=None
|
||||
self,
|
||||
request,
|
||||
NameID=None,
|
||||
family_id=None,
|
||||
rl_text_template='{{ lastname }} {{ firstname }}',
|
||||
child_text_template='{{ lastname }} {{ firstname }}',
|
||||
):
|
||||
family_id = family_id or self.get_link(NameID).family_id
|
||||
return {
|
||||
|
@ -1342,16 +1346,19 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
'family_id': {'description': 'Numéro de DUI'},
|
||||
'text_template': {
|
||||
'description': 'Gabarit utilisé pour la valeur text',
|
||||
'example_value': '{{ personInfo.lastname }} {{ personInfo.firstname }}',
|
||||
},
|
||||
},
|
||||
)
|
||||
def read_child_person_list(self, request, child_id, NameID=None, family_id=None, text_template=None):
|
||||
def read_child_person_list(
|
||||
self,
|
||||
request,
|
||||
child_id,
|
||||
NameID=None,
|
||||
family_id=None,
|
||||
text_template='{{ personInfo.lastname }} {{ personInfo.firstname }}',
|
||||
):
|
||||
family_id = family_id or self.get_link(NameID).family_id
|
||||
result = self.get_child_raw(family_id, child_id)
|
||||
if not text_template:
|
||||
text_template = '{{ personInfo.lastname }} {{ personInfo.firstname }}'
|
||||
|
||||
data = []
|
||||
for item in result['authorizedPersonList']:
|
||||
self.add_text_value_to_child_person(item)
|
||||
|
@ -2866,14 +2873,12 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
type_ids=None,
|
||||
start_date=None,
|
||||
end_date=None,
|
||||
text_template=None,
|
||||
text_template='{{ activity.libelle2|default:activity.libelle1 }}',
|
||||
):
|
||||
family_id = family_id or self.get_link(NameID).family_id
|
||||
reference_year = None
|
||||
if start_date and end_date:
|
||||
start_date, end_date, reference_year = self.get_start_and_end_dates(start_date, end_date)
|
||||
if not text_template:
|
||||
text_template = '{{ activity.libelle2|default:activity.libelle1 }}'
|
||||
|
||||
response = self.get_person_activity_list_raw(
|
||||
family_id,
|
||||
|
@ -2903,7 +2908,6 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
'end_date': {'description': 'Fin de la période'},
|
||||
'text_template': {
|
||||
'description': 'Gabarit utilisé pour la valeur text (URL encoding)',
|
||||
'example_value': '{{ libelle }}',
|
||||
},
|
||||
},
|
||||
)
|
||||
|
@ -2916,14 +2920,12 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
family_id=None,
|
||||
start_date=None,
|
||||
end_date=None,
|
||||
text_template=None,
|
||||
text_template='{{ libelle }}',
|
||||
):
|
||||
family_id = family_id or self.get_link(NameID).family_id
|
||||
reference_year = None
|
||||
if start_date and end_date:
|
||||
start_date, end_date, reference_year = self.get_start_and_end_dates(start_date, end_date)
|
||||
if not text_template:
|
||||
text_template = '{{ libelle }}'
|
||||
|
||||
response = self.get_person_activity_list_raw(
|
||||
family_id,
|
||||
|
@ -2960,7 +2962,6 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
'end_date': {'description': 'Fin de la période'},
|
||||
'text_template': {
|
||||
'description': 'Gabarit utilisé pour la valeur text (URL encoding)',
|
||||
'example_value': '{{ libelle }}',
|
||||
},
|
||||
},
|
||||
)
|
||||
|
@ -2974,14 +2975,12 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
family_id=None,
|
||||
start_date=None,
|
||||
end_date=None,
|
||||
text_template=None,
|
||||
text_template='{{ place.lib2|default:place.lib1 }}',
|
||||
):
|
||||
family_id = family_id or self.get_link(NameID).family_id
|
||||
reference_year = None
|
||||
if start_date and end_date:
|
||||
start_date, end_date, reference_year = self.get_start_and_end_dates(start_date, end_date)
|
||||
if not text_template:
|
||||
text_template = '{{ place.lib2|default:place.lib1 }}'
|
||||
|
||||
response = self.get_person_activity_list_raw(
|
||||
family_id,
|
||||
|
|
|
@ -6538,7 +6538,6 @@ def test_get_person_activity_list(activity_service, con, app):
|
|||
'nature': '',
|
||||
'start_date': '2022-09-01',
|
||||
'end_date': '2023-08-31',
|
||||
'text_template': '',
|
||||
}
|
||||
resp = app.get(url, params=params)
|
||||
assert resp.json['err'] == 0
|
||||
|
@ -6620,7 +6619,7 @@ def test_get_person_activity_list(activity_service, con, app):
|
|||
('A10053187065', 'Semaine 2'),
|
||||
]
|
||||
|
||||
params['text_template'] = ''
|
||||
del params['text_template']
|
||||
params['type_ids'] = 'LOI_VAC,,'
|
||||
resp = app.get(url, params=params)
|
||||
assert resp.json['err'] == 0
|
||||
|
@ -6655,7 +6654,6 @@ def test_get_person_activity_list_not_linked_error(con, app):
|
|||
'nature': '',
|
||||
'start_date': '2022-09-01',
|
||||
'end_date': '2023-08-31',
|
||||
'text_template': '',
|
||||
}
|
||||
resp = app.get(url, params=params)
|
||||
assert resp.json['err'] == 1
|
||||
|
@ -6672,7 +6670,6 @@ def test_get_person_activity_list_date_error(con, app):
|
|||
'nature': '',
|
||||
'start_date': 'bad',
|
||||
'end_date': '2023-08-31',
|
||||
'text_template': '',
|
||||
}
|
||||
resp = app.get(url, params=params, status=400)
|
||||
assert resp.json['err'] == 1
|
||||
|
@ -6715,7 +6712,6 @@ def test_get_person_unit_list(activity_service, con, app):
|
|||
'activity_id': 'A10053187087',
|
||||
'start_date': '2022-09-01',
|
||||
'end_date': '2023-08-31',
|
||||
'text_template': '',
|
||||
}
|
||||
resp = app.get(url, params=params)
|
||||
assert resp.json['err'] == 0
|
||||
|
@ -6783,7 +6779,6 @@ def test_get_person_unit_list_not_linked_error(con, app):
|
|||
'activity_id': 'A10053187087',
|
||||
'start_date': '2022-09-01',
|
||||
'end_date': '2023-08-31',
|
||||
'text_template': '',
|
||||
}
|
||||
resp = app.get(url, params=params)
|
||||
assert resp.json['err'] == 1
|
||||
|
@ -6800,7 +6795,6 @@ def test_get_person_unit_list_date_error(con, app):
|
|||
'activity_id': 'A10053187087',
|
||||
'start_date': 'bad',
|
||||
'end_date': '2023-08-31',
|
||||
'text_template': '',
|
||||
}
|
||||
resp = app.get(url, params=params, status=400)
|
||||
assert resp.json['err'] == 1
|
||||
|
@ -6839,7 +6833,6 @@ def test_get_person_unit_list_no_activity_error(activity_service, con, app):
|
|||
'activity_id': 'plop',
|
||||
'start_date': '2022-09-01',
|
||||
'end_date': '2023-08-31',
|
||||
'text_template': '',
|
||||
}
|
||||
resp = app.get(url, params=params)
|
||||
assert resp.json['err'] == 1
|
||||
|
@ -6865,7 +6858,6 @@ def test_get_person_place_list(activity_service, con, app):
|
|||
'unit_id': 'A10053187241',
|
||||
'start_date': '2022-09-01',
|
||||
'end_date': '2023-08-31',
|
||||
'text_template': '',
|
||||
}
|
||||
resp = app.get(url, params=params)
|
||||
assert resp.json['err'] == 0
|
||||
|
@ -6922,7 +6914,6 @@ def test_get_person_place_list_not_linked_error(con, app):
|
|||
'unit_id': 'A10053187241',
|
||||
'start_date': '2022-09-01',
|
||||
'end_date': '2023-08-31',
|
||||
'text_template': '',
|
||||
}
|
||||
resp = app.get(url, params=params)
|
||||
assert resp.json['err'] == 1
|
||||
|
@ -6940,7 +6931,6 @@ def test_get_person_place_list_date_error(con, app):
|
|||
'unit_id': 'A10053187241',
|
||||
'start_date': 'bad',
|
||||
'end_date': '2023-08-31',
|
||||
'text_template': '',
|
||||
}
|
||||
resp = app.get(url, params=params, status=400)
|
||||
assert resp.json['err'] == 1
|
||||
|
@ -6980,7 +6970,6 @@ def test_get_person_place_list_no_unit_error(activity_service, con, app):
|
|||
'unit_id': 'plop',
|
||||
'start_date': '2022-09-01',
|
||||
'end_date': '2023-08-31',
|
||||
'text_template': '',
|
||||
}
|
||||
resp = app.get(url, params=params)
|
||||
assert resp.json['err'] == 1
|
||||
|
|
Loading…
Reference in New Issue