|
|
|
@ -343,6 +343,25 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|
|
|
|
result[item['id']] = item
|
|
|
|
|
data['indicators'] = result
|
|
|
|
|
|
|
|
|
|
def add_nature_subsciptions(self, data):
|
|
|
|
|
subscribe_natures = {}
|
|
|
|
|
for item in data['subscribeActivityList'] or []:
|
|
|
|
|
activity_type = item.get('typeActivity')
|
|
|
|
|
activity_nature = activity_type.get('natureSpec') if activity_type else None
|
|
|
|
|
if not activity_nature:
|
|
|
|
|
continue
|
|
|
|
|
for unit in item['subscribesUnit']:
|
|
|
|
|
start_year = utils.get_reference_year_from_date(unit.get('dateStart'))
|
|
|
|
|
end_year = utils.get_reference_year_from_date(unit.get('dateEnd'))
|
|
|
|
|
if not start_year or not end_year:
|
|
|
|
|
continue
|
|
|
|
|
for year in range(start_year, end_year + 1):
|
|
|
|
|
school_year = '%s-%s' % (year, year + 1)
|
|
|
|
|
if not subscribe_natures.get(school_year):
|
|
|
|
|
subscribe_natures[school_year] = set()
|
|
|
|
|
subscribe_natures[school_year].add(activity_nature['code'])
|
|
|
|
|
data['subscribe_natures'] = {x: sorted(list(y)) for x, y in subscribe_natures.items()}
|
|
|
|
|
|
|
|
|
|
def add_text_value_to_rl_indicator(self, data):
|
|
|
|
|
self.add_text_value('RLIndicator', data, ['code'])
|
|
|
|
|
|
|
|
|
@ -363,6 +382,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|
|
|
|
for indicator in data['indicatorList']:
|
|
|
|
|
self.add_text_value_to_child_indicator(indicator)
|
|
|
|
|
self.add_indicators_field('ChildIndicator', data)
|
|
|
|
|
self.add_nature_subsciptions(data)
|
|
|
|
|
|
|
|
|
|
def add_text_value_to_person(self, data):
|
|
|
|
|
self.add_text_value('Civility', data, ['civility'])
|
|
|
|
@ -382,6 +402,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|
|
|
|
for quotient in data['quotientList']:
|
|
|
|
|
self.add_text_value('Quotient', quotient, ['cdquo'])
|
|
|
|
|
self.add_indicators_field('RLIndicator', data)
|
|
|
|
|
self.add_nature_subsciptions(data)
|
|
|
|
|
|
|
|
|
|
def add_text_value_to_family(self, data):
|
|
|
|
|
self.add_text_value('Category', data, ['category'])
|
|
|
|
|