toulouse_axel: return reference year in family info endpoint (#41186)
This commit is contained in:
parent
5d4f07d4f1
commit
a0e40b6e7c
|
@ -514,11 +514,10 @@ class ToulouseAxel(BaseResource):
|
|||
|
||||
family_data = result.json_response['DATA']['PORTAIL']['DUI']
|
||||
|
||||
today = datetime.date.today()
|
||||
current_reference_year = utils.get_reference_year_from_date(today)
|
||||
next_reference_year = current_reference_year + 1
|
||||
if check_registrations:
|
||||
today = datetime.date.today()
|
||||
current_reference_year = utils.get_reference_year_from_date(today)
|
||||
next_reference_year = current_reference_year + 1
|
||||
|
||||
children_registred_for_current_year = self.are_children_registered(
|
||||
dui=dui,
|
||||
reference_year=current_reference_year)
|
||||
|
@ -532,6 +531,9 @@ class ToulouseAxel(BaseResource):
|
|||
|
||||
if with_management_dates:
|
||||
family_data['management_dates'] = self.get_management_dates()
|
||||
family_data['annee_reference'] = current_reference_year
|
||||
family_data['annee_reference_short'] = str(current_reference_year)[2:]
|
||||
family_data['annee_reference_label'] = '{}/{}'.format(current_reference_year, next_reference_year)
|
||||
|
||||
family_data['SITUATIONFAMILIALE_label'] = utils.get_label(utils.situation_familiale_mapping, family_data['SITUATIONFAMILIALE'])
|
||||
for key in ['RL1', 'RL2']:
|
||||
|
@ -1131,6 +1133,7 @@ class ToulouseAxel(BaseResource):
|
|||
start_date.strftime(utils.xml_date_format),
|
||||
end_date.strftime(utils.xml_date_format))
|
||||
activity['annee_reference'] = reference_year
|
||||
activity['annee_reference_short'] = str(reference_year)[2:]
|
||||
activity['annee_reference_label'] = '{}/{}'.format(reference_year, reference_year + 1)
|
||||
activity['booking'] = booking_days.get(activity['IDACTIVITE'], {})
|
||||
|
||||
|
|
|
@ -757,6 +757,9 @@ def test_family_info_endpoint(app, resource):
|
|||
'SITUATIONFAMILIALE_label',
|
||||
'TELFIXE',
|
||||
'management_dates',
|
||||
'annee_reference',
|
||||
'annee_reference_short',
|
||||
'annee_reference_label',
|
||||
])
|
||||
assert resp.json['data']['ENFANT'][0]['id'] == '4242'
|
||||
assert resp.json['data']['ENFANT'][0]['text'] == 'foo foo'
|
||||
|
@ -769,6 +772,9 @@ def test_family_info_endpoint(app, resource):
|
|||
assert resp.json['data']['ENFANT'][1]['id'] == '3535'
|
||||
assert resp.json['data']['ENFANT'][1]['text'] == 'foo foo'
|
||||
assert resp.json['data']['management_dates'] == {'foo': 'bar'}
|
||||
assert resp.json['data']['annee_reference'] == 2019
|
||||
assert resp.json['data']['annee_reference_short'] == '19'
|
||||
assert resp.json['data']['annee_reference_label'] == '2019/2020'
|
||||
|
||||
with mock.patch('passerelle.contrib.toulouse_axel.models.ToulouseAxel.are_children_registered') as registered:
|
||||
registered.side_effect = [{'4242': True}, {}]
|
||||
|
@ -2206,6 +2212,7 @@ def test_clae_booking_info_endpoint(app, resource, child_activities_data):
|
|||
'id': 'A19P1M1',
|
||||
'text': 'Temps du matin (inscription du 01/08/2019 au 31/07/2020)',
|
||||
'annee_reference': 2019,
|
||||
'annee_reference_short': '19',
|
||||
'annee_reference_label': '2019/2020',
|
||||
'COUTREVIENT': '99999',
|
||||
'DATEDEBUT': '2019-08-01',
|
||||
|
@ -2232,6 +2239,7 @@ def test_clae_booking_info_endpoint(app, resource, child_activities_data):
|
|||
'id': 'A19P1M2',
|
||||
'text': 'Temps du midi (inscription du 01/08/2019 au 31/07/2020)',
|
||||
'annee_reference': 2019,
|
||||
'annee_reference_short': '19',
|
||||
'annee_reference_label': '2019/2020',
|
||||
'COUTREVIENT': '99999',
|
||||
'DATEDEBUT': '2019-08-01',
|
||||
|
@ -2258,6 +2266,7 @@ def test_clae_booking_info_endpoint(app, resource, child_activities_data):
|
|||
'id': 'A19P1M3',
|
||||
'text': 'Temps du soir (inscription du 01/08/2019 au 31/07/2020)',
|
||||
'annee_reference': 2019,
|
||||
'annee_reference_short': '19',
|
||||
'annee_reference_label': '2019/2020',
|
||||
'COUTREVIENT': '99999',
|
||||
'DATEDEBUT': '2019-08-01',
|
||||
|
@ -2284,6 +2293,7 @@ def test_clae_booking_info_endpoint(app, resource, child_activities_data):
|
|||
'id': 'A19P1M4',
|
||||
'text': u'Temps mercredi après midi (inscription du 01/08/2019 au 31/07/2020)',
|
||||
'annee_reference': 2019,
|
||||
'annee_reference_short': '19',
|
||||
'annee_reference_label': '2019/2020',
|
||||
'COUTREVIENT': '99999',
|
||||
'DATEDEBUT': '2019-08-01',
|
||||
|
@ -2423,6 +2433,7 @@ def test_clae_booking_activities_info_endpoint(app, resource, child_activities_d
|
|||
'id': 'A19P1M1',
|
||||
'text': 'Temps du matin (inscription du 01/08/2019 au 31/07/2020)',
|
||||
'annee_reference': 2019,
|
||||
'annee_reference_short': '19',
|
||||
'annee_reference_label': '2019/2020',
|
||||
'COUTREVIENT': '99999',
|
||||
'DATEDEBUT': '2019-08-01',
|
||||
|
@ -2449,6 +2460,7 @@ def test_clae_booking_activities_info_endpoint(app, resource, child_activities_d
|
|||
'id': 'A19P1M2',
|
||||
'text': 'Temps du midi (inscription du 01/08/2019 au 31/07/2020)',
|
||||
'annee_reference': 2019,
|
||||
'annee_reference_short': '19',
|
||||
'annee_reference_label': '2019/2020',
|
||||
'COUTREVIENT': '99999',
|
||||
'DATEDEBUT': '2019-08-01',
|
||||
|
@ -2475,6 +2487,7 @@ def test_clae_booking_activities_info_endpoint(app, resource, child_activities_d
|
|||
'id': 'A19P1M3',
|
||||
'text': 'Temps du soir (inscription du 01/08/2019 au 31/07/2020)',
|
||||
'annee_reference': 2019,
|
||||
'annee_reference_short': '19',
|
||||
'annee_reference_label': '2019/2020',
|
||||
'COUTREVIENT': '99999',
|
||||
'DATEDEBUT': '2019-08-01',
|
||||
|
@ -2501,6 +2514,7 @@ def test_clae_booking_activities_info_endpoint(app, resource, child_activities_d
|
|||
'id': 'A19P1M4',
|
||||
'text': u'Temps mercredi après midi (inscription du 01/08/2019 au 31/07/2020)',
|
||||
'annee_reference': 2019,
|
||||
'annee_reference_short': '19',
|
||||
'annee_reference_label': '2019/2020',
|
||||
'COUTREVIENT': '99999',
|
||||
'DATEDEBUT': '2019-08-01',
|
||||
|
|
Loading…
Reference in New Issue