toulouse-maelis: new activity types, many units (#73680)
gitea-wip/passerelle/pipeline/pr-main This commit looks good
Details
gitea-wip/passerelle/pipeline/pr-main This commit looks good
Details
This commit is contained in:
parent
63cb29a760
commit
cf84b475a4
|
@ -1710,6 +1710,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
if activity['activityType']['natureSpec']['code'] not in ['A', 'R']:
|
||||
continue
|
||||
activity_id = activity['idAct']
|
||||
many_units = len(schedule['unitScheduleList']) > 1
|
||||
for unit in schedule['unitScheduleList']:
|
||||
days = unit['dayInfoList']
|
||||
for day in days:
|
||||
|
@ -1730,13 +1731,15 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
booking['details']['activity_id'] = activity_id
|
||||
booking['details']['activity_type'] = activity['activityType']['code']
|
||||
booking['details']['activity_label'] = activity['activityType']['libelle']
|
||||
if many_units:
|
||||
booking['details']['activity_label'] += ' (%s)' % unit['unit']['libelle']
|
||||
booking['details']['child_id'] = child_id
|
||||
booking['details']['day_str'] = day['day'].strftime(utils.json_date_format)
|
||||
booking['details']['unit_id'] = unit['unit']['idUnit']
|
||||
bookings.append(booking)
|
||||
|
||||
# sort bookings
|
||||
activity_types = ['ACCMAT', 'RESTSCOL']
|
||||
activity_types = ['ACCMAT', 'RESTSCOL', 'ACCPERI', 'ACCSOIR']
|
||||
bookings = [
|
||||
(
|
||||
b['details']['day'],
|
||||
|
|
|
@ -0,0 +1,134 @@
|
|||
<soap:Envelope
|
||||
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<ns2:getPersonScheduleListResponse
|
||||
xmlns:ns2="activity.ws.maelis.sigec.com"
|
||||
xmlns:ns3="bean.persistence.activity.ws.maelis.sigec.com">
|
||||
<resultBean>
|
||||
<personScheduleList>
|
||||
<person>
|
||||
<numPerson>613880</numPerson>
|
||||
<lastname>DOE</lastname>
|
||||
<firstname>JANNIS</firstname>
|
||||
</person>
|
||||
<activityScheduleList>
|
||||
<activity>
|
||||
<idAct>A10049327682</idAct>
|
||||
<libelle>RESTAURATION SCOLAIRE 22/23</libelle>
|
||||
<activityType>
|
||||
<code>RESTSCOL</code>
|
||||
<libelle>Restauration scolaire</libelle>
|
||||
<natureSpec>
|
||||
<code>R</code>
|
||||
<libelle>Restauration Scolaire</libelle>
|
||||
</natureSpec>
|
||||
</activityType>
|
||||
</activity>
|
||||
<unitScheduleList>
|
||||
<unit>
|
||||
<idUnit>A10049327683</idUnit>
|
||||
<libelle>RESTAURATION SCOLAIRE 22/23</libelle>
|
||||
</unit>
|
||||
<dayInfoList>
|
||||
<day>2023-01-02T00:00:00+01:00</day>
|
||||
<scheduledPresence>0</scheduledPresence>
|
||||
<realPresence>0</realPresence>
|
||||
<ns3:status>READ_ONLY</ns3:status>
|
||||
</dayInfoList>
|
||||
</unitScheduleList>
|
||||
<unitScheduleList>
|
||||
<unit>
|
||||
<idUnit>A10049327684</idUnit>
|
||||
<libelle>PAI PANIER 22/23</libelle>
|
||||
</unit>
|
||||
<dayInfoList>
|
||||
<day>2023-01-02T00:00:00+01:00</day>
|
||||
<scheduledPresence>0</scheduledPresence>
|
||||
<realPresence>0</realPresence>
|
||||
<ns3:status>READ_ONLY</ns3:status>
|
||||
</dayInfoList>
|
||||
</unitScheduleList>
|
||||
</activityScheduleList>
|
||||
<activityScheduleList>
|
||||
<activity>
|
||||
<idAct>A10049327689</idAct>
|
||||
<libelle>CLAE MATIN 22/23</libelle>
|
||||
<activityType>
|
||||
<code>ACCMAT</code>
|
||||
<libelle>Accueil du matin</libelle>
|
||||
<natureSpec>
|
||||
<code>A</code>
|
||||
<libelle>Accueil P\xc3\xa9riscolaire</libelle>
|
||||
</natureSpec>
|
||||
</activityType>
|
||||
</activity>
|
||||
<unitScheduleList>
|
||||
<unit>
|
||||
<idUnit>A10049327690</idUnit>
|
||||
<libelle>CLAE MATIN 22/23</libelle>
|
||||
</unit>
|
||||
<dayInfoList>
|
||||
<day>2023-01-02T00:00:00+01:00</day>
|
||||
<scheduledPresence>0</scheduledPresence>
|
||||
<realPresence>0</realPresence>
|
||||
<ns3:status>READ_ONLY</ns3:status>
|
||||
</dayInfoList>
|
||||
</unitScheduleList>
|
||||
</activityScheduleList>
|
||||
<activityScheduleList>
|
||||
<activity>
|
||||
<idAct>A10049327691</idAct>
|
||||
<libelle>CLAE SOIR 22/23</libelle>
|
||||
<activityType>
|
||||
<code>ACCSOIR</code>
|
||||
<libelle>Accueil du soir</libelle>
|
||||
<natureSpec>
|
||||
<code>A</code>
|
||||
<libelle>Accueil P\xc3\xa9riscolaire</libelle>
|
||||
</natureSpec>
|
||||
</activityType>
|
||||
</activity>
|
||||
<unitScheduleList>
|
||||
<unit>
|
||||
<idUnit>A10049327692</idUnit>
|
||||
<libelle>CLAE SOIR 22/23</libelle>
|
||||
</unit>
|
||||
<dayInfoList>
|
||||
<day>2023-01-02T00:00:00+01:00</day>
|
||||
<scheduledPresence>0</scheduledPresence>
|
||||
<realPresence>0</realPresence>
|
||||
<ns3:status>READ_ONLY</ns3:status>
|
||||
</dayInfoList>
|
||||
</unitScheduleList>
|
||||
</activityScheduleList>
|
||||
<activityScheduleList>
|
||||
<activity>
|
||||
<idAct>A10049327693</idAct>
|
||||
<libelle>CLAE MIDI 22/23</libelle>
|
||||
<activityType>
|
||||
<code>ACCPERI</code>
|
||||
<libelle>Accueil p\xc3\xa9riscolaire</libelle>
|
||||
<natureSpec>
|
||||
<code>A</code>
|
||||
<libelle>Accueil P\xc3\xa9riscolaire</libelle>
|
||||
</natureSpec>
|
||||
</activityType>
|
||||
</activity>
|
||||
<unitScheduleList>
|
||||
<unit>
|
||||
<idUnit>A10049327694</idUnit>
|
||||
<libelle>CLAE MIDI 22/23</libelle>
|
||||
</unit>
|
||||
<dayInfoList>
|
||||
<day>2023-01-02T00:00:00+01:00</day>
|
||||
<scheduledPresence>0</scheduledPresence>
|
||||
<realPresence>0</realPresence>
|
||||
<ns3:status>READ_ONLY</ns3:status>
|
||||
</dayInfoList>
|
||||
</unitScheduleList>
|
||||
</activityScheduleList>
|
||||
</personScheduleList>
|
||||
</resultBean>
|
||||
</ns2:getPersonScheduleListResponse>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -4184,6 +4184,139 @@ def test_read_child_agenda(activity_service, con, app):
|
|||
]
|
||||
|
||||
|
||||
def test_read_child_agenda_multi_units(activity_service, con, app):
|
||||
activity_service.add_soap_response(
|
||||
'getPersonScheduleList', get_xml_file('R_get_person_schedule_list_with_multi_units.xml')
|
||||
)
|
||||
url = get_endpoint('read-child-agenda')
|
||||
|
||||
resp = app.get(url + '?family_id=1312&child_id=613880&start_date=2023-01-01&end_date=2023-01-15')
|
||||
assert resp.json['err'] == 0
|
||||
Link.objects.create(resource=con, family_id='1312', name_id='local')
|
||||
|
||||
resp = app.get(url + '?NameID=local&child_id=613880&start_date=2023-01-01&end_date=2023-01-15')
|
||||
|
||||
assert resp.json['err'] == 0
|
||||
assert resp.json['extra_data'] == {
|
||||
'start_date': '2023-01-01',
|
||||
'end_date': '2023-01-15',
|
||||
'school_year': '2022/2023',
|
||||
}
|
||||
assert len(resp.json['data']) == 5
|
||||
assert resp.json['data'] == [
|
||||
{
|
||||
'details': {
|
||||
'absence': None,
|
||||
'action': None,
|
||||
'activity_id': 'A10049327689',
|
||||
'activity_label': 'Accueil du matin',
|
||||
'activity_type': 'ACCMAT',
|
||||
'child_id': '613880',
|
||||
'day': '2023-01-02T00:00:00+01:00',
|
||||
'day_str': '2023-01-02',
|
||||
'hasPlace': None,
|
||||
'realPresence': 0,
|
||||
'scheduledPresence': 0,
|
||||
'status': 'READ_ONLY',
|
||||
'status_color': 'white',
|
||||
'unit_id': 'A10049327690',
|
||||
},
|
||||
'disabled': True,
|
||||
'id': '613880:A10049327689:2023-01-02',
|
||||
'prefill': False,
|
||||
'text': 'Monday 2 January 2023',
|
||||
},
|
||||
{
|
||||
'details': {
|
||||
'absence': None,
|
||||
'action': None,
|
||||
'activity_id': 'A10049327682',
|
||||
'activity_label': 'Restauration scolaire (PAI PANIER 22/23)',
|
||||
'activity_type': 'RESTSCOL',
|
||||
'child_id': '613880',
|
||||
'day': '2023-01-02T00:00:00+01:00',
|
||||
'day_str': '2023-01-02',
|
||||
'hasPlace': None,
|
||||
'realPresence': 0,
|
||||
'scheduledPresence': 0,
|
||||
'status': 'READ_ONLY',
|
||||
'status_color': 'white',
|
||||
'unit_id': 'A10049327684',
|
||||
},
|
||||
'disabled': True,
|
||||
'id': '613880:A10049327682:2023-01-02',
|
||||
'prefill': False,
|
||||
'text': 'Monday 2 January 2023',
|
||||
},
|
||||
{
|
||||
'details': {
|
||||
'absence': None,
|
||||
'action': None,
|
||||
'activity_id': 'A10049327682',
|
||||
'activity_label': 'Restauration scolaire (RESTAURATION SCOLAIRE 22/23)',
|
||||
'activity_type': 'RESTSCOL',
|
||||
'child_id': '613880',
|
||||
'day': '2023-01-02T00:00:00+01:00',
|
||||
'day_str': '2023-01-02',
|
||||
'hasPlace': None,
|
||||
'realPresence': 0,
|
||||
'scheduledPresence': 0,
|
||||
'status': 'READ_ONLY',
|
||||
'status_color': 'white',
|
||||
'unit_id': 'A10049327683',
|
||||
},
|
||||
'disabled': True,
|
||||
'id': '613880:A10049327682:2023-01-02',
|
||||
'prefill': False,
|
||||
'text': 'Monday 2 January 2023',
|
||||
},
|
||||
{
|
||||
'details': {
|
||||
'absence': None,
|
||||
'action': None,
|
||||
'activity_id': 'A10049327693',
|
||||
'activity_label': 'Accueil p\\xc3\\xa9riscolaire',
|
||||
'activity_type': 'ACCPERI',
|
||||
'child_id': '613880',
|
||||
'day': '2023-01-02T00:00:00+01:00',
|
||||
'day_str': '2023-01-02',
|
||||
'hasPlace': None,
|
||||
'realPresence': 0,
|
||||
'scheduledPresence': 0,
|
||||
'status': 'READ_ONLY',
|
||||
'status_color': 'white',
|
||||
'unit_id': 'A10049327694',
|
||||
},
|
||||
'disabled': True,
|
||||
'id': '613880:A10049327693:2023-01-02',
|
||||
'prefill': False,
|
||||
'text': 'Monday 2 January 2023',
|
||||
},
|
||||
{
|
||||
'details': {
|
||||
'absence': None,
|
||||
'action': None,
|
||||
'activity_id': 'A10049327691',
|
||||
'activity_label': 'Accueil du soir',
|
||||
'activity_type': 'ACCSOIR',
|
||||
'child_id': '613880',
|
||||
'day': '2023-01-02T00:00:00+01:00',
|
||||
'day_str': '2023-01-02',
|
||||
'hasPlace': None,
|
||||
'realPresence': 0,
|
||||
'scheduledPresence': 0,
|
||||
'status': 'READ_ONLY',
|
||||
'status_color': 'white',
|
||||
'unit_id': 'A10049327692',
|
||||
},
|
||||
'disabled': True,
|
||||
'id': '613880:A10049327691:2023-01-02',
|
||||
'prefill': False,
|
||||
'text': 'Monday 2 January 2023',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
def test_read_child_agenda_not_linked_error(con, app):
|
||||
url = get_endpoint('read-child-agenda')
|
||||
|
||||
|
|
Loading…
Reference in New Issue