toulouse-maelis: remove hard coded activity natures (#75752)
This commit is contained in:
parent
3dc2d69493
commit
1ec85fedce
|
@ -1848,7 +1848,11 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
||||||
activity = schedule['activity']
|
activity = schedule['activity']
|
||||||
if not activity['activityType']['natureSpec']:
|
if not activity['activityType']['natureSpec']:
|
||||||
continue
|
continue
|
||||||
if activity['activityType']['natureSpec']['code'] not in ['A', 'R', 'X']:
|
if (
|
||||||
|
activity['activityType']['natureSpec']['code'] not in self.get_perisco_nature_codes()
|
||||||
|
and activity['activityType']['natureSpec']['code']
|
||||||
|
not in self.get_extrasco_nature_codes()
|
||||||
|
):
|
||||||
continue
|
continue
|
||||||
activity_id = activity['idAct']
|
activity_id = activity['idAct']
|
||||||
many_units = len(schedule['unitScheduleList']) > 1
|
many_units = len(schedule['unitScheduleList']) > 1
|
||||||
|
@ -1864,7 +1868,8 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
||||||
'prefill': day['scheduledPresence'] > 0 or day['realPresence'] > 1,
|
'prefill': day['scheduledPresence'] > 0 or day['realPresence'] > 1,
|
||||||
'disabled': (
|
'disabled': (
|
||||||
day['status'] != 'WRITABLE'
|
day['status'] != 'WRITABLE'
|
||||||
or activity['activityType']['natureSpec']['code'] in ['X']
|
or activity['activityType']['natureSpec']['code']
|
||||||
|
in self.get_extrasco_nature_codes()
|
||||||
),
|
),
|
||||||
'details': day,
|
'details': day,
|
||||||
}
|
}
|
||||||
|
@ -1874,7 +1879,10 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
||||||
booking['details']['status_color'] = color
|
booking['details']['status_color'] = color
|
||||||
booking['details']['activity_id'] = activity_id
|
booking['details']['activity_id'] = activity_id
|
||||||
booking['details']['activity_type'] = activity['activityType']['code']
|
booking['details']['activity_type'] = activity['activityType']['code']
|
||||||
if activity['activityType']['natureSpec']['code'] in ['A', 'R']:
|
if (
|
||||||
|
activity['activityType']['natureSpec']['code']
|
||||||
|
in self.get_perisco_nature_codes()
|
||||||
|
):
|
||||||
booking['details']['activity_label'] = activity['activityType']['libelle']
|
booking['details']['activity_label'] = activity['activityType']['libelle']
|
||||||
else:
|
else:
|
||||||
booking['details']['activity_label'] = (
|
booking['details']['activity_label'] = (
|
||||||
|
@ -2274,8 +2282,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
||||||
def read_activity_list(self, request, ref_date, nature_ids=None):
|
def read_activity_list(self, request, ref_date, nature_ids=None):
|
||||||
reference_year = utils.get_reference_year_from_date(ref_date)
|
reference_year = utils.get_reference_year_from_date(ref_date)
|
||||||
if not nature_ids:
|
if not nature_ids:
|
||||||
# actual loisir nature codes
|
nature_filter_codes = self.get_loisir_nature_codes()
|
||||||
nature_filter_codes = ['P', 'L', 'S'] + [str(i) for i in range(1, 10)]
|
|
||||||
else:
|
else:
|
||||||
nature_filter_codes = [x.strip() for x in nature_ids.split(',') if x.strip()]
|
nature_filter_codes = [x.strip() for x in nature_ids.split(',') if x.strip()]
|
||||||
labels = {
|
labels = {
|
||||||
|
|
Loading…
Reference in New Issue