ants_hub: allow multiple identifiant_predemande (#80592)
gitea/chrono/pipeline/head This commit looks good
Details
gitea/chrono/pipeline/head This commit looks good
Details
This commit is contained in:
parent
0f81147829
commit
5fbbe0e984
|
@ -230,16 +230,21 @@ class Place(models.Model):
|
|||
)
|
||||
.order_by('event__state_datetime')
|
||||
)
|
||||
for identifiant_predemande, start_datetime, cancellation_datetime in bookings:
|
||||
if not isinstance(identifiant_predemande, str):
|
||||
for identifiant_predemande_data, start_datetime, cancellation_datetime in bookings:
|
||||
if not isinstance(identifiant_predemande_data, str):
|
||||
continue
|
||||
rdv = {
|
||||
'id': identifiant_predemande,
|
||||
'date': start_datetime.isoformat(),
|
||||
}
|
||||
if cancellation_datetime is not None:
|
||||
rdv['annule'] = True
|
||||
yield rdv
|
||||
# split data on commas, and remove trailing whitespaces
|
||||
identifiant_predemandes = filter(
|
||||
None, (part.strip() for part in identifiant_predemande_data.split(','))
|
||||
)
|
||||
for identifiant_predemande in identifiant_predemandes:
|
||||
rdv = {
|
||||
'id': identifiant_predemande,
|
||||
'date': start_datetime.isoformat(),
|
||||
}
|
||||
if cancellation_datetime is not None:
|
||||
rdv['annule'] = True
|
||||
yield rdv
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('place')
|
||||
|
|
|
@ -126,7 +126,7 @@ def ants_setup(db, freezer):
|
|||
mairie_agenda,
|
||||
paris('2023-04-11 11:00'),
|
||||
meeting_type='mt-30',
|
||||
extra_data={'ants_identifiant_predemande': 'ABCDEFGH'},
|
||||
extra_data={'ants_identifiant_predemande': 'ABCDEFGH , IJKLMNOP'},
|
||||
)
|
||||
|
||||
add_meeting(
|
||||
|
@ -185,6 +185,7 @@ def test_export_to_push(ants_setup):
|
|||
'rdvs': [
|
||||
{'annule': True, 'date': '2023-04-10T07:00:00+00:00', 'id': '12345678'},
|
||||
{'date': '2023-04-11T09:00:00+00:00', 'id': 'ABCDEFGH'},
|
||||
{'date': '2023-04-11T09:00:00+00:00', 'id': 'IJKLMNOP'},
|
||||
],
|
||||
'plages': [
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue