chrono: reorder plage periods before injection in horaire list
gitea/ants-hub/pipeline/head This commit looks good
Details
gitea/ants-hub/pipeline/head This commit looks good
Details
This commit is contained in:
parent
f93fb4f705
commit
674509af00
|
@ -223,7 +223,8 @@ class RendezVousDisponibleView(View):
|
|||
).delete()
|
||||
self.plage_deleted += count_by_model.get('data.Plage', 0)
|
||||
continue
|
||||
values = by_date_and_type_and_personnes.get(x)
|
||||
values = list(by_date_and_type_and_personnes.get(x))
|
||||
values.sort()
|
||||
durees = list({duree for heure_debut, heure_fin, duree in values})
|
||||
if len(durees) > 1:
|
||||
raise ValidationError(
|
||||
|
|
|
@ -805,3 +805,58 @@ def test_naive_time(django_app, db, freezer):
|
|||
datetime.datetime(2023, 3, 20, 8, 30, tzinfo=zoneinfo.ZoneInfo(key='Europe/Paris')),
|
||||
datetime.datetime(2023, 3, 20, 8, 45, tzinfo=zoneinfo.ZoneInfo(key='Europe/Paris')),
|
||||
]
|
||||
|
||||
|
||||
def test_plages_ordering(django_app, db, freezer):
|
||||
Raccordement.objects.create(name='plateforme', apikey='abcd')
|
||||
|
||||
django_app.set_authorization(('Basic', ('abcd', '')))
|
||||
django_app.post_json(
|
||||
'/api/chrono/rendez-vous-disponibles/',
|
||||
params={
|
||||
'collectivites': [
|
||||
{
|
||||
'id': 'col1',
|
||||
'nom': 'Saint-Didier',
|
||||
'url': 'https://saint-didier.fr/rdv/',
|
||||
'lieux': [
|
||||
{
|
||||
'id': 'lieu1',
|
||||
'nom': 'Mairie de Saint-Didier',
|
||||
'numero_rue': '2 rue du four',
|
||||
'code_postal': '99999',
|
||||
'ville': 'Saint-Didier',
|
||||
'longitude': 1.5,
|
||||
'latitude': 2.3,
|
||||
'plages': [
|
||||
{
|
||||
'date': '2023-03-20',
|
||||
'types_rdv': ['CNI', 'PASSPORT'],
|
||||
'heure_debut': '12:00+02:00',
|
||||
'heure_fin': '13:00+02:00',
|
||||
'duree': 15,
|
||||
'personnes': 1,
|
||||
},
|
||||
{
|
||||
'date': '2023-03-20',
|
||||
'types_rdv': ['CNI', 'PASSPORT'],
|
||||
'heure_debut': '08:00+02:00',
|
||||
'heure_fin': '09:00+02:00',
|
||||
'duree': 15,
|
||||
'personnes': 1,
|
||||
},
|
||||
{
|
||||
'date': '2023-03-20',
|
||||
'types_rdv': ['CNI', 'PASSPORT'],
|
||||
'heure_debut': '10:00+02:00',
|
||||
'heure_fin': '11:00+02:00',
|
||||
'duree': 15,
|
||||
'personnes': 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
},
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue