Projet

Général

Profil

0001-maelis-provide-dates-to-subscribe-and-unsubscribe-we.patch

Nicolas Roche, 13 janvier 2021 12:15

Télécharger (31,4 ko)

Voir les différences:

Subject: [PATCH] maelis: provide dates to subscribe and unsubscribe
 webservices (#50059)

 passerelle/apps/maelis/models.py           | 18 ++++----
 passerelle/apps/maelis/utils.py            | 12 ++++--
 passerelle/locale/fr/LC_MESSAGES/django.po |  2 +-
 tests/data/maelis/child_activities.json    | 48 ++++++++++++++++++++++
 tests/test_maelis.py                       |  7 +++-
 5 files changed, 74 insertions(+), 13 deletions(-)
passerelle/apps/maelis/models.py
419 419
            if subscribingStatus != 'subscribed' and subscribingStatus != 'not-subscribed':
420 420
                raise APIError('wrong value for subscribingStatus: %s' % subscribingStatus)
421 421
        if queryDate:
422 422
            try:
423 423
                start_date = parse_date(queryDate)
424 424
            except ValueError as exc:
425 425
                raise APIError('input is well formatted but not a valid date: %s' % exc)
426 426
            if not start_date:
427
                raise APIError("input isn't well formatted, YYYY-MM-DD expected")
428
        if not queryDate:
427
                raise APIError("input isn't well formatted, YYYY-MM-DD expected: %s" % queryDate)
428
        else:
429 429
            start_date = timezone.now().date()
430 430
        if start_date.strftime('%m-%d') >= '05-01':
431 431
            # start displaying next year activities on may
432 432
            school_year = start_date.year
433 433
        else:
434 434
            school_year = start_date.year - 1
435 435
        end_date = utils.get_datetime('%s-07-31' % (school_year + 1)).date()
436 436

  
437 437
        child_info = self.get_child_info(NameID, childID)
438 438
        r = self.call('ActivityService?wsdl', 'readActivityList',
439 439
                      schoolyear=school_year,
440 440
                      numPerson=childID,
441 441
                      dateStartCalend=start_date,
442 442
                      dateEndCalend=end_date)
443 443

  
444 444
        flatted_activities = utils.flatten_activities(
445
            serialize_object(r), [school_year, school_year + 1])
445
            serialize_object(r), start_date, end_date)
446 446
        utils.mark_subscribed_flatted_activities(flatted_activities, child_info)
447 447
        data = utils.flatted_activities_as_list(flatted_activities, subscribingStatus)
448 448
        return {'data': data}
449 449

  
450 450
    @endpoint(
451 451
        display_category=_('Activities'),
452 452
        perm='can_access',
453 453
        display_order=3,
......
504 504
        description=_('Subscribe'),
505 505
        parameters={
506 506
            'NameID': {'description': _('Publik ID')},
507 507
            'childID': {'description': _('Child ID')},
508 508
            'activityID': {'description': _('Activity ID')},
509 509
            'unitID': {'description': _('Unit ID')},
510 510
            'placeID': {'description': _('Place ID')},
511 511
            'weeklyPlanning': {'description': _('Week planning (7 chars)')},
512
            'start_date': {'description': _('Start date of the unit (YYYY-MM-DD)')},
513
            'end_date': {'description': _('End date of the unit (YYYY-MM-DD)')},
512 514
    })
513 515
    def subscribe(self, request, NameID, childID, activityID, unitID, placeID,
514
                  weeklyPlanning):
516
                  weeklyPlanning, start_date, end_date):
515 517
        self.get_child_info(NameID, childID)
516 518
        client = self.get_client('FamilyService?wsdl')
517 519
        trigram_type = client.get_type('ns1:activityUnitPlaceBean')
518 520
        trigram = trigram_type(
519 521
            idActivity=activityID,
520 522
            idUnit=unitID,
521 523
            idPlace=placeID)
522 524
        subscription_type = client.get_type('ns1:subscribeActivityRequestBean')
523 525
        subpscription = subscription_type(
524 526
            personNumber=childID,
525 527
            activityUnitPlace=trigram,
526
            weeklyPlanning=weeklyPlanning)
528
            weeklyPlanning=weeklyPlanning,
529
            dateStart=start_date,
530
            dateEnd=end_date)
527 531
        r = self.call('FamilyService?wsdl', 'subscribeActivity',
528 532
                      subscribeActivityRequestBean=subpscription)
529 533
        return {'data': serialize_object(r)}
530 534

  
531 535

  
532 536
    @endpoint(
533 537
        display_category=_('Family'),
534 538
        perm='can_access',
535 539
        display_order=11,
536 540
        description=_('Unsubscribe'),
537 541
        parameters={
538 542
            'NameID': {'description': _('Publik ID')},
539 543
            'childID': {'description': _('Child ID')},
540 544
            'activityID': {'description': _('Activity ID')},
541
            'start_date': {'description': _('Start date of the activity (YYYY-MM-DD)')}
545
            'start_date': {'description': _('Start date of the unit (YYYY-MM-DD)')},
542 546
    })
543
    def unsubscribe(self, request, NameID, childID, activityID, start_date=None):
547
    def unsubscribe(self, request, NameID, childID, activityID, start_date):
544 548
        self.get_child_info(NameID, childID)
545 549
        r = self.call('FamilyService?wsdl', 'deletesubscribe',
546 550
                      numPerson=childID,
547 551
                      idActivite=activityID,
548 552
                      dateRefDelete=start_date)
549 553
        return {'data': serialize_object(r)}
550 554

  
551 555

  
passerelle/apps/maelis/utils.py
201 201
        new_event['datetime'] = '%s %s' % (date_string, component['time'])
202 202
        new_event['slot_id'] = "%s%s" % (composition['virtual_unit'], component_id)
203 203
        new_event['id'] = '%s-%s-%s' % (
204 204
            date_string, event['category_id'], new_event['slot_id'])
205 205
        new_event['text'] = component['text']
206 206
        yield new_event
207 207

  
208 208

  
209
def flatten_activities(activities, years):
209
def flatten_activities(activities, start_date, end_date):
210 210
    data = {}
211 211
    for activity in activities:
212 212
        if activity.get('openDayList'):
213 213
            del activity['openDayList']
214 214
        activity_id = activity['activityPortail']['idAct']
215 215
        activity_text = activity['activityPortail']['label']
216 216
        activity_obj = deepcopy(activity)
217 217
        del activity_obj['unitPortailList']
......
222 222
                "natureSpec" : {
223 223
                    "code" : "?",
224 224
                    "libelle" : "Inconnu"
225 225
                }
226 226
            }
227 227

  
228 228
        # compute weekly planning mask parameter to use for subscribing
229 229
        planning_masks = []
230
        for year in years:
230
        for year in range(start_date.year, end_date.year+1):
231 231
            for item in activity['activityPortail']['weeklyCalendarActivityList']:
232 232
                if item['yearCalendar'] == year:
233 233
                    planning_masks.append(item['weeklyCalendarStr'])
234 234
                    break
235 235
        if planning_masks:
236 236
            activity_weekly_planning_mask = ""
237 237
            for letters in zip(*planning_masks):
238 238
                if '1' in letters:
......
243 243
            activity_weekly_planning_mask = "0000000"
244 244

  
245 245
        units = {}
246 246
        for unit in activity['unitPortailList']:
247 247
            unit_id = unit['idUnit']
248 248
            unit_text = unit['label']
249 249
            unit_obj = deepcopy(unit)
250 250
            del unit_obj['placeList']
251
            # compute weekly planning parameter to use for subscribing
251

  
252
            # compute subscribing parameters
253
            unit_start_date = unit['dateStart'] or start_date
254
            unit_end_date = unit['dateEnd'] or end_date
252 255
            unit_calendar_letter = unit['calendarLetter']
253 256
            unit_weekly_planning = ""
254 257
            for letter in activity_weekly_planning_mask:
255 258
                if letter == '0':
256 259
                    unit_weekly_planning += unit_calendar_letter
257 260
                else:
258 261
                    unit_weekly_planning += '1'
259 262

  
......
267 270
                    'text': '%s / %s / %s' % (activity_text, unit_text, place_text),
268 271
                    'activity_id': activity_id,
269 272
                    'unit_id': unit_id,
270 273
                    'place_id': place_id,
271 274
                    'activity_text': activity_text,
272 275
                    'unit_text': unit_text,
273 276
                    'place_text': place_text,
274 277
                    'activity_weekly_planning_mask': activity_weekly_planning_mask,
278
                    'subscribe_start_date': unit_start_date,
279
                    'subscribe_end_date': unit_end_date,
275 280
                    'unit_calendar_letter': unit_calendar_letter,
276 281
                    'unit_weekly_planning': unit_weekly_planning,
277 282
                    'activity_object': activity_obj,
278 283
                    'unit_object': unit_obj,
279 284
                    'place_object': place,
280 285
                }
281 286
            units[unit_id] = places
282 287
        data[activity_id] = units
......
285 290

  
286 291
def mark_subscribed_flatted_activities(flatted_activities, child_info):
287 292
    for child_activity in child_info['subscribeActivityList']:
288 293
        activity = flatted_activities[child_activity['idActivity']]
289 294
        for child_unit in child_activity['subscribesUnit']:
290 295
            unit = activity[child_unit['idUnit']]
291 296
            place = unit[child_activity['place']]
292 297
            place['user_subscribing_status'] = 'subscribed'
298
            place['unsubscribe_start_date'] = child_unit['dateStart']
293 299

  
294 300

  
295 301
def flatted_activities_as_list(flatted_activities, filtering_status):
296 302
    data = []
297 303
    for activity in [a[1] for a in sorted(flatted_activities.items())]:
298 304
        for unit in [u[1] for u in sorted(activity.items())]:
299 305
            is_unit_subscribable = True
300 306
            is_unit_subscribed = False
passerelle/locale/fr/LC_MESSAGES/django.po
2153 2153
"Décompose les événements reliés à des parties de journées si positionné"
2154 2154

  
2155 2155
#: apps/maelis/models.py:504
2156 2156
msgid "Subscribe"
2157 2157
msgstr "Inscription"
2158 2158

  
2159 2159
#: apps/maelis/models.py:508 apps/maelis/models.py:540
2160 2160
msgid "Activity ID"
2161
msgstr "Identifiant de l'activités"
2161
msgstr "Identifiant de l'activité"
2162 2162

  
2163 2163
#: apps/maelis/models.py:509
2164 2164
msgid "Unit ID"
2165 2165
msgstr "Identifiant de l'unité"
2166 2166

  
2167 2167
#: apps/maelis/models.py:510
2168 2168
msgid "Place ID"
2169 2169
msgstr "Identifiant du lieu"
tests/data/maelis/child_activities.json
56 56
                "lib2": null,
57 57
                "nbPlace": 0,
58 58
                "nbPlaceBoy": 0,
59 59
                "nbPlaceGirl": 0,
60 60
                "schoolInfoList": [],
61 61
                "typeCtrlPlace": "N"
62 62
            },
63 63
            "place_text": "3 JEAN GIONO",
64
            "subscribe_end_date": "2021-07-06T00:00:00+02:00",
65
            "subscribe_start_date": "2020-09-01T00:00:00+02:00",
64 66
            "text": "1 2020-2021 GARDERIE MATIN / 1 2020-2021 GARDERIE MATIN / 3 JEAN GIONO",
65 67
            "unit_calendar_letter": "X",
66 68
            "unit_id": "A10003121694",
67 69
            "unit_object": {
68 70
                "birthDateEnd": null,
69 71
                "birthDateStart": null,
70 72
                "calendarLetter": "X",
71 73
                "consoTarifList": [
......
156 158
                "lib2": null,
157 159
                "nbPlace": 0,
158 160
                "nbPlaceBoy": 0,
159 161
                "nbPlaceGirl": 0,
160 162
                "schoolInfoList": [],
161 163
                "typeCtrlPlace": "N"
162 164
            },
163 165
            "place_text": "2 FRANCOIS FABIE",
166
            "subscribe_end_date": "2021-07-06T00:00:00+02:00",
167
            "subscribe_start_date": "2020-09-01T00:00:00+02:00",
164 168
            "text": "1 2020-2021 GARDERIE MATIN / 1 2020-2021 GARDERIE MATIN / 2 FRANCOIS FABIE",
165 169
            "unit_calendar_letter": "X",
166 170
            "unit_id": "A10003121694",
167 171
            "unit_object": {
168 172
                "birthDateEnd": null,
169 173
                "birthDateStart": null,
170 174
                "calendarLetter": "X",
171 175
                "consoTarifList": [
......
193 197
                "nbPlaceGirl": 0,
194 198
                "numOrder": 1,
195 199
                "subscribePublication": "E",
196 200
                "topCESU": "O",
197 201
                "typeCtrlPlace": "N"
198 202
            },
199 203
            "unit_text": "1 2020-2021 GARDERIE MATIN",
200 204
            "unit_weekly_planning": "XX1XX11",
205
            "unsubscribe_start_date": "2020-09-01T00:00:00+02:00",
201 206
            "user_subscribing_status": "subscribed"
202 207
        },
203 208
        {
204 209
            "activity_id": "A10003123490",
205 210
            "activity_object": {
206 211
                "activityPortail": {
207 212
                    "activityType": {
208 213
                        "code": "RESTSCOL",
......
271 276
                        "idSchool": "A10000003597",
272 277
                        "phone": null,
273 278
                        "schoolName": "2  FRANCOIS FABIE"
274 279
                    }
275 280
                ],
276 281
                "typeCtrlPlace": "N"
277 282
            },
278 283
            "place_text": "2 FRANCOIS FABIE",
284
            "subscribe_end_date": "2021-07-03T00:00:00+02:00",
285
            "subscribe_start_date": "2020-09-02T00:00:00+02:00",
279 286
            "text": "2 2020-2021  RESTAURATION SCOLAIRE / 2 2020-2021  RESTAURATION SCOLAIRE / 2 FRANCOIS FABIE",
280 287
            "unit_calendar_letter": "X",
281 288
            "unit_id": "A10003123492",
282 289
            "unit_object": {
283 290
                "birthDateEnd": null,
284 291
                "birthDateStart": null,
285 292
                "calendarLetter": "X",
286 293
                "consoTarifList": [
......
330 337
                "nbPlaceGirl": 0,
331 338
                "numOrder": 2,
332 339
                "subscribePublication": "E",
333 340
                "topCESU": "N",
334 341
                "typeCtrlPlace": "N"
335 342
            },
336 343
            "unit_text": "2 2020-2021  RESTAURATION SCOLAIRE",
337 344
            "unit_weekly_planning": "XX1XX11",
345
            "unsubscribe_start_date": "2020-09-02T00:00:00+02:00",
338 346
            "user_subscribing_status": "subscribed"
339 347
        },
340 348
        {
341 349
            "activity_id": "A10003123507",
342 350
            "activity_object": {
343 351
                "activityPortail": {
344 352
                    "activityType": {
345 353
                        "code": "ACCSOIR",
......
389 397
                "lib2": null,
390 398
                "nbPlace": 0,
391 399
                "nbPlaceBoy": 0,
392 400
                "nbPlaceGirl": 0,
393 401
                "schoolInfoList": [],
394 402
                "typeCtrlPlace": "N"
395 403
            },
396 404
            "place_text": "3 JEAN GIONO",
405
            "subscribe_end_date": "2021-07-03T00:00:00+02:00",
406
            "subscribe_start_date": "2020-09-02T00:00:00+02:00",
397 407
            "text": "3 2020-2021 GARDERIE SOIR / 3 2020-2021 GARDERIE SOIR / 3 JEAN GIONO",
398 408
            "unit_calendar_letter": "X",
399 409
            "unit_id": "A10003123509",
400 410
            "unit_object": {
401 411
                "birthDateEnd": null,
402 412
                "birthDateStart": null,
403 413
                "calendarLetter": "X",
404 414
                "consoTarifList": [
......
485 495
                "lib2": null,
486 496
                "nbPlace": 0,
487 497
                "nbPlaceBoy": 0,
488 498
                "nbPlaceGirl": 0,
489 499
                "schoolInfoList": [],
490 500
                "typeCtrlPlace": "N"
491 501
            },
492 502
            "place_text": "2 FRANCOIS FABIE",
503
            "subscribe_end_date": "2021-07-03T00:00:00+02:00",
504
            "subscribe_start_date": "2020-09-02T00:00:00+02:00",
493 505
            "text": "3 2020-2021 GARDERIE SOIR / 3 2020-2021 GARDERIE SOIR / 2 FRANCOIS FABIE",
494 506
            "unit_calendar_letter": "X",
495 507
            "unit_id": "A10003123509",
496 508
            "unit_object": {
497 509
                "birthDateEnd": null,
498 510
                "birthDateStart": null,
499 511
                "calendarLetter": "X",
500 512
                "consoTarifList": [
......
585 597
                "lib2": null,
586 598
                "nbPlace": 0,
587 599
                "nbPlaceBoy": 0,
588 600
                "nbPlaceGirl": 0,
589 601
                "schoolInfoList": [],
590 602
                "typeCtrlPlace": "N"
591 603
            },
592 604
            "place_text": "ALSH PAGNOL",
605
            "subscribe_end_date": "2021-03-05T00:00:00+02:00",
606
            "subscribe_start_date": "2021-02-28T00:00:00+02:00",
593 607
            "text": "2020-2021 ALSH VACANCES PAGNOL (CAPA) / HIVER 2EME SEMAINE / ALSH PAGNOL",
594 608
            "unit_calendar_letter": "c",
595 609
            "unit_id": "A10003131861",
596 610
            "unit_object": {
597 611
                "birthDateEnd": null,
598 612
                "birthDateStart": null,
599 613
                "calendarLetter": "c",
600 614
                "consoTarifList": [
......
696 710
                "lib2": null,
697 711
                "nbPlace": 0,
698 712
                "nbPlaceBoy": 0,
699 713
                "nbPlaceGirl": 0,
700 714
                "schoolInfoList": [],
701 715
                "typeCtrlPlace": "N"
702 716
            },
703 717
            "place_text": "ALSH MISTRAL",
718
            "subscribe_end_date": "2021-03-05T00:00:00+02:00",
719
            "subscribe_start_date": "2021-02-28T00:00:00+02:00",
704 720
            "text": "2020-2021 ALSH VACANCES PAGNOL (CAPA) / HIVER 2EME SEMAINE / ALSH MISTRAL",
705 721
            "unit_calendar_letter": "c",
706 722
            "unit_id": "A10003131861",
707 723
            "unit_object": {
708 724
                "birthDateEnd": null,
709 725
                "birthDateStart": null,
710 726
                "calendarLetter": "c",
711 727
                "consoTarifList": [
......
807 823
                "lib2": null,
808 824
                "nbPlace": 0,
809 825
                "nbPlaceBoy": 0,
810 826
                "nbPlaceGirl": 0,
811 827
                "schoolInfoList": [],
812 828
                "typeCtrlPlace": "N"
813 829
            },
814 830
            "place_text": "ALSH PAGNOL",
831
            "subscribe_end_date": "2020-10-30T00:00:00+02:00",
832
            "subscribe_start_date": "2020-10-26T00:00:00+02:00",
815 833
            "text": "2020-2021 ALSH VACANCES PAGNOL (CAPA) / TOUSSAINT 2EME SEMAINE / ALSH PAGNOL",
816 834
            "unit_calendar_letter": "D",
817 835
            "unit_id": "A10003131879",
818 836
            "unit_object": {
819 837
                "birthDateEnd": null,
820 838
                "birthDateStart": null,
821 839
                "calendarLetter": "D",
822 840
                "consoTarifList": [
......
918 936
                "lib2": null,
919 937
                "nbPlace": 0,
920 938
                "nbPlaceBoy": 0,
921 939
                "nbPlaceGirl": 0,
922 940
                "schoolInfoList": [],
923 941
                "typeCtrlPlace": "N"
924 942
            },
925 943
            "place_text": "ALSH MISTRAL",
944
            "subscribe_end_date": "2020-10-30T00:00:00+02:00",
945
            "subscribe_start_date": "2020-10-26T00:00:00+02:00",
926 946
            "text": "2020-2021 ALSH VACANCES PAGNOL (CAPA) / TOUSSAINT 2EME SEMAINE / ALSH MISTRAL",
927 947
            "unit_calendar_letter": "D",
928 948
            "unit_id": "A10003131879",
929 949
            "unit_object": {
930 950
                "birthDateEnd": null,
931 951
                "birthDateStart": null,
932 952
                "calendarLetter": "D",
933 953
                "consoTarifList": [
......
1029 1049
                "lib2": null,
1030 1050
                "nbPlace": 0,
1031 1051
                "nbPlaceBoy": 0,
1032 1052
                "nbPlaceGirl": 0,
1033 1053
                "schoolInfoList": [],
1034 1054
                "typeCtrlPlace": "N"
1035 1055
            },
1036 1056
            "place_text": "ALSH PAGNOL",
1057
            "subscribe_end_date": "2020-10-23T00:00:00+02:00",
1058
            "subscribe_start_date": "2020-10-19T00:00:00+02:00",
1037 1059
            "text": "2020-2021 ALSH VACANCES PAGNOL (CAPA) / TOUSSAINT 1 ERE SEMAINE / ALSH PAGNOL",
1038 1060
            "unit_calendar_letter": "C",
1039 1061
            "unit_id": "A10003131882",
1040 1062
            "unit_object": {
1041 1063
                "birthDateEnd": null,
1042 1064
                "birthDateStart": null,
1043 1065
                "calendarLetter": "C",
1044 1066
                "consoTarifList": [
......
1140 1162
                "lib2": null,
1141 1163
                "nbPlace": 0,
1142 1164
                "nbPlaceBoy": 0,
1143 1165
                "nbPlaceGirl": 0,
1144 1166
                "schoolInfoList": [],
1145 1167
                "typeCtrlPlace": "N"
1146 1168
            },
1147 1169
            "place_text": "ALSH MISTRAL",
1170
            "subscribe_end_date": "2020-10-23T00:00:00+02:00",
1171
            "subscribe_start_date": "2020-10-19T00:00:00+02:00",
1148 1172
            "text": "2020-2021 ALSH VACANCES PAGNOL (CAPA) / TOUSSAINT 1 ERE SEMAINE / ALSH MISTRAL",
1149 1173
            "unit_calendar_letter": "C",
1150 1174
            "unit_id": "A10003131882",
1151 1175
            "unit_object": {
1152 1176
                "birthDateEnd": null,
1153 1177
                "birthDateStart": null,
1154 1178
                "calendarLetter": "C",
1155 1179
                "consoTarifList": [
......
1251 1275
                "lib2": null,
1252 1276
                "nbPlace": 0,
1253 1277
                "nbPlaceBoy": 0,
1254 1278
                "nbPlaceGirl": 0,
1255 1279
                "schoolInfoList": [],
1256 1280
                "typeCtrlPlace": "N"
1257 1281
            },
1258 1282
            "place_text": "ALSH PAGNOL",
1283
            "subscribe_end_date": "2020-12-31T00:00:00+02:00",
1284
            "subscribe_start_date": "2020-12-28T00:00:00+02:00",
1259 1285
            "text": "2020-2021 ALSH VACANCES PAGNOL (CAPA) / NOEL 2EME SEMAINE / ALSH PAGNOL",
1260 1286
            "unit_calendar_letter": "B",
1261 1287
            "unit_id": "A10003131903",
1262 1288
            "unit_object": {
1263 1289
                "birthDateEnd": null,
1264 1290
                "birthDateStart": null,
1265 1291
                "calendarLetter": "B",
1266 1292
                "consoTarifList": [
......
1362 1388
                "lib2": null,
1363 1389
                "nbPlace": 0,
1364 1390
                "nbPlaceBoy": 0,
1365 1391
                "nbPlaceGirl": 0,
1366 1392
                "schoolInfoList": [],
1367 1393
                "typeCtrlPlace": "N"
1368 1394
            },
1369 1395
            "place_text": "ALSH MISTRAL",
1396
            "subscribe_end_date": "2020-12-31T00:00:00+02:00",
1397
            "subscribe_start_date": "2020-12-28T00:00:00+02:00",
1370 1398
            "text": "2020-2021 ALSH VACANCES PAGNOL (CAPA) / NOEL 2EME SEMAINE / ALSH MISTRAL",
1371 1399
            "unit_calendar_letter": "B",
1372 1400
            "unit_id": "A10003131903",
1373 1401
            "unit_object": {
1374 1402
                "birthDateEnd": null,
1375 1403
                "birthDateStart": null,
1376 1404
                "calendarLetter": "B",
1377 1405
                "consoTarifList": [
......
1473 1501
                "lib2": null,
1474 1502
                "nbPlace": 0,
1475 1503
                "nbPlaceBoy": 0,
1476 1504
                "nbPlaceGirl": 0,
1477 1505
                "schoolInfoList": [],
1478 1506
                "typeCtrlPlace": "N"
1479 1507
            },
1480 1508
            "place_text": "ALSH PAGNOL",
1509
            "subscribe_end_date": "2020-12-24T00:00:00+02:00",
1510
            "subscribe_start_date": "2020-12-21T00:00:00+02:00",
1481 1511
            "text": "2020-2021 ALSH VACANCES PAGNOL (CAPA) / NOEL 1ERE SEMAINE / ALSH PAGNOL",
1482 1512
            "unit_calendar_letter": "J",
1483 1513
            "unit_id": "A10003131909",
1484 1514
            "unit_object": {
1485 1515
                "birthDateEnd": null,
1486 1516
                "birthDateStart": null,
1487 1517
                "calendarLetter": "J",
1488 1518
                "consoTarifList": [
......
1584 1614
                "lib2": null,
1585 1615
                "nbPlace": 0,
1586 1616
                "nbPlaceBoy": 0,
1587 1617
                "nbPlaceGirl": 0,
1588 1618
                "schoolInfoList": [],
1589 1619
                "typeCtrlPlace": "N"
1590 1620
            },
1591 1621
            "place_text": "ALSH MISTRAL",
1622
            "subscribe_end_date": "2020-12-24T00:00:00+02:00",
1623
            "subscribe_start_date": "2020-12-21T00:00:00+02:00",
1592 1624
            "text": "2020-2021 ALSH VACANCES PAGNOL (CAPA) / NOEL 1ERE SEMAINE / ALSH MISTRAL",
1593 1625
            "unit_calendar_letter": "J",
1594 1626
            "unit_id": "A10003131909",
1595 1627
            "unit_object": {
1596 1628
                "birthDateEnd": null,
1597 1629
                "birthDateStart": null,
1598 1630
                "calendarLetter": "J",
1599 1631
                "consoTarifList": [
......
1695 1727
                "lib2": null,
1696 1728
                "nbPlace": 0,
1697 1729
                "nbPlaceBoy": 0,
1698 1730
                "nbPlaceGirl": 0,
1699 1731
                "schoolInfoList": [],
1700 1732
                "typeCtrlPlace": "N"
1701 1733
            },
1702 1734
            "place_text": "ALSH PAGNOL",
1735
            "subscribe_end_date": "2021-07-03T00:00:00+02:00",
1736
            "subscribe_start_date": "2020-09-02T00:00:00+02:00",
1703 1737
            "text": "2020-2021 CENTRE DE LOISIRS MERCREDI / JOURNEE / ALSH PAGNOL",
1704 1738
            "unit_calendar_letter": "A",
1705 1739
            "unit_id": "A10003132034",
1706 1740
            "unit_object": {
1707 1741
                "birthDateEnd": null,
1708 1742
                "birthDateStart": null,
1709 1743
                "calendarLetter": "A",
1710 1744
                "consoTarifList": [
......
1795 1829
                "lib2": null,
1796 1830
                "nbPlace": 0,
1797 1831
                "nbPlaceBoy": 0,
1798 1832
                "nbPlaceGirl": 0,
1799 1833
                "schoolInfoList": [],
1800 1834
                "typeCtrlPlace": "N"
1801 1835
            },
1802 1836
            "place_text": "ALSH PAGNOL",
1837
            "subscribe_end_date": "2021-07-03T00:00:00+02:00",
1838
            "subscribe_start_date": "2020-09-02T00:00:00+02:00",
1803 1839
            "text": "2020-2021 CENTRE DE LOISIRS MERCREDI / MATIN / ALSH PAGNOL",
1804 1840
            "unit_calendar_letter": "B",
1805 1841
            "unit_id": "A10003132036",
1806 1842
            "unit_object": {
1807 1843
                "birthDateEnd": null,
1808 1844
                "birthDateStart": null,
1809 1845
                "calendarLetter": "B",
1810 1846
                "consoTarifList": [
......
1895 1931
                "lib2": null,
1896 1932
                "nbPlace": 0,
1897 1933
                "nbPlaceBoy": 0,
1898 1934
                "nbPlaceGirl": 0,
1899 1935
                "schoolInfoList": [],
1900 1936
                "typeCtrlPlace": "N"
1901 1937
            },
1902 1938
            "place_text": "ALSH PAGNOL",
1939
            "subscribe_end_date": "2021-07-03T00:00:00+02:00",
1940
            "subscribe_start_date": "2020-09-02T00:00:00+02:00",
1903 1941
            "text": "2020-2021 CENTRE DE LOISIRS MERCREDI / MATIN ET REPAS / ALSH PAGNOL",
1904 1942
            "unit_calendar_letter": "C",
1905 1943
            "unit_id": "A10003132038",
1906 1944
            "unit_object": {
1907 1945
                "birthDateEnd": null,
1908 1946
                "birthDateStart": null,
1909 1947
                "calendarLetter": "C",
1910 1948
                "consoTarifList": [
......
1995 2033
                "lib2": null,
1996 2034
                "nbPlace": 0,
1997 2035
                "nbPlaceBoy": 0,
1998 2036
                "nbPlaceGirl": 0,
1999 2037
                "schoolInfoList": [],
2000 2038
                "typeCtrlPlace": "N"
2001 2039
            },
2002 2040
            "place_text": "ALSH PAGNOL",
2041
            "subscribe_end_date": "2021-07-03T00:00:00+02:00",
2042
            "subscribe_start_date": "2020-09-02T00:00:00+02:00",
2003 2043
            "text": "2020-2021 CENTRE DE LOISIRS MERCREDI / APRES MIDI / ALSH PAGNOL",
2004 2044
            "unit_calendar_letter": "D",
2005 2045
            "unit_id": "A10003132040",
2006 2046
            "unit_object": {
2007 2047
                "birthDateEnd": null,
2008 2048
                "birthDateStart": null,
2009 2049
                "calendarLetter": "D",
2010 2050
                "consoTarifList": [
......
2095 2135
                "lib2": null,
2096 2136
                "nbPlace": 0,
2097 2137
                "nbPlaceBoy": 0,
2098 2138
                "nbPlaceGirl": 0,
2099 2139
                "schoolInfoList": [],
2100 2140
                "typeCtrlPlace": "N"
2101 2141
            },
2102 2142
            "place_text": "ALSH PAGNOL",
2143
            "subscribe_end_date": "2021-07-31",
2144
            "subscribe_start_date": "2020-01-01T00:00:00+02:00",
2103 2145
            "text": "COURS DE DANSE / COURS DE DANSE / ALSH PAGNOL",
2104 2146
            "unit_calendar_letter": "X",
2105 2147
            "unit_id": "A10003132091",
2106 2148
            "unit_object": {
2107 2149
                "birthDateEnd": null,
2108 2150
                "birthDateStart": null,
2109 2151
                "calendarLetter": "X",
2110 2152
                "consoTarifList": [],
......
2179 2221
                "lib2": null,
2180 2222
                "nbPlace": 0,
2181 2223
                "nbPlaceBoy": 0,
2182 2224
                "nbPlaceGirl": 0,
2183 2225
                "schoolInfoList": [],
2184 2226
                "typeCtrlPlace": "N"
2185 2227
            },
2186 2228
            "place_text": "ALSH PAGNOL",
2229
            "subscribe_end_date": "2021-07-31",
2230
            "subscribe_start_date": "2020-01-01T00:00:00+02:00",
2187 2231
            "text": "LASERQUEST / LASERQUEST / ALSH PAGNOL",
2188 2232
            "unit_calendar_letter": "X",
2189 2233
            "unit_id": "A10003132152",
2190 2234
            "unit_object": {
2191 2235
                "birthDateEnd": null,
2192 2236
                "birthDateStart": null,
2193 2237
                "calendarLetter": "X",
2194 2238
                "consoTarifList": [],
......
2263 2307
                "lib2": null,
2264 2308
                "nbPlace": 0,
2265 2309
                "nbPlaceBoy": 0,
2266 2310
                "nbPlaceGirl": 0,
2267 2311
                "schoolInfoList": [],
2268 2312
                "typeCtrlPlace": "N"
2269 2313
            },
2270 2314
            "place_text": "ALSH PAGNOL",
2315
            "subscribe_end_date": "2021-07-31",
2316
            "subscribe_start_date": "2020-09-02T00:00:00+02:00",
2271 2317
            "text": "EQUITATION / EQUITATION / ALSH PAGNOL",
2272 2318
            "unit_calendar_letter": "X",
2273 2319
            "unit_id": "A10003132273",
2274 2320
            "unit_object": {
2275 2321
                "birthDateEnd": "2014-12-31T00:00:00+02:00",
2276 2322
                "birthDateStart": "1970-01-01T00:00:00+02:00",
2277 2323
                "calendarLetter": "X",
2278 2324
                "consoTarifList": [],
......
2347 2393
                "lib2": null,
2348 2394
                "nbPlace": 0,
2349 2395
                "nbPlaceBoy": 0,
2350 2396
                "nbPlaceGirl": 0,
2351 2397
                "schoolInfoList": [],
2352 2398
                "typeCtrlPlace": "N"
2353 2399
            },
2354 2400
            "place_text": "ALSH PAGNOL",
2401
            "subscribe_end_date": "2021-07-31",
2402
            "subscribe_start_date": "2020-01-01T00:00:00+02:00",
2355 2403
            "text": "SORTIE MUSEE / SORTIE MUSEE / ALSH PAGNOL",
2356 2404
            "unit_calendar_letter": "X",
2357 2405
            "unit_id": "A10003132295",
2358 2406
            "unit_object": {
2359 2407
                "birthDateEnd": null,
2360 2408
                "birthDateStart": null,
2361 2409
                "calendarLetter": "X",
2362 2410
                "consoTarifList": [],
tests/test_maelis.py
391 391
            status_code=200,
392 392
            headers={'Content-Type': 'text/xml'}),
393 393
        utils.FakedResponse(
394 394
            content=get_xml_file('subscribeActivityResult.xml'),
395 395
            status_code=200,
396 396
            headers={'Content-Type': 'text/xml'})
397 397
    )
398 398
    Link.objects.create(resource=connector, family_id='3264', name_id='local')
399
    resp = app.get('/maelis/test/subscribe/?NameID=local&childID=21293&activityID=A10003123507&unitID=A10003123507&placeID=A10000000211&weeklyPlanning=XX1XX11')
399
    resp = app.get('/maelis/test/subscribe/?NameID=local&childID=21293'
400
                   + '&activityID=A10003123507&unitID=A10003123507&placeID=A10000000211'
401
                   + '&weeklyPlanning=XX1XX11&start_date=2020-08-01&end_date=2021-07-31')
400 402
    assert not resp.json['err']
401 403
    assert resp.json['data']['state'] == {
402 404
        "idState" : "1",
403 405
        "isWaitState" : False,
404 406
        "libelle" : "Confirmé"
405 407
    }
406 408

  
407 409

  
......
416 418
            status_code=200,
417 419
            headers={'Content-Type': 'text/xml'}),
418 420
        utils.FakedResponse(
419 421
            content=get_xml_file('deletesubscribe.xml'),
420 422
            status_code=200,
421 423
            headers={'Content-Type': 'text/xml'})
422 424
    )
423 425
    Link.objects.create(resource=connector, family_id='3264', name_id='local')
424
    resp = app.get('/maelis/test/unsubscribe/?NameID=local&childID=21293&activityID=A10003121692&start_date=2020-09-01')
426
    resp = app.get('/maelis/test/unsubscribe/?NameID=local&childID=21293'
427
                   + '&activityID=A10003121692&start_date=2020-08-01')
425 428
    assert not resp.json['err']
426 429
    assert resp.json['data'] is None
427
-