Skip to content

Commit

Permalink
Merge pull request #4012 from GeotrekCE/fix_aggretator_mapping_conflicts
Browse files Browse the repository at this point in the history
馃悰 [BUG] Fix interferences on practice mapping in Aggregator (refs #3569)
  • Loading branch information
Chatewgne committed Mar 22, 2024
2 parents 8a867fe + f7e146d commit bcfd5c8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 24 deletions.
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ CHANGELOG
**Bug fixes**

- Fix bug deleted blades still displayed on detail view of signages (fix #4003)
- Fix interferences on `practice` mapping in Aggregator by changing calls order in GeotrekOutdoorParser (refs #3569)


2.103.1 (2024-03-15)
Expand Down
12 changes: 6 additions & 6 deletions geotrek/outdoor/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def get_id_from_mapping(self, mapping, value):
return dest_id
return None

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def start(self):
super().start()
self.init_outdoor_category('sector', Sector)
self.init_outdoor_category('practice', Practice, join_field='sector')
self.init_outdoor_category('scale', RatingScale, join_field='practice')
Expand Down Expand Up @@ -146,9 +146,9 @@ def filter_type(self, src, val):
return SiteType.objects.get(pk=type_id)
return None

def parse(self, filename=None, limit=None):
def start(self):
super().start()
self.init_outdoor_category('type', SiteType, join_field='practice')
super().parse(filename, limit)

def parse_row(self, row):
super().parse_row(row)
Expand Down Expand Up @@ -229,9 +229,9 @@ def filter_points_reference(self, src, val):
return str(val)
return None

def parse(self, filename=None, limit=None):
def start(self):
super().start()
self.init_outdoor_category('type', CourseType, join_field='practice')
super().parse(filename, limit)

def parse_row(self, row):
super().parse_row(row)
Expand Down
36 changes: 18 additions & 18 deletions geotrek/outdoor/tests/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ def test_geotrek_aggregator_parser_mapping(self, mocked_head, mocked_get):
('outdoor', 'label.json'),
('outdoor', 'source.json'),
('outdoor', 'organism.json'),
('outdoor', 'outdoor_sector.json'),
('outdoor', 'outdoor_practice.json'),
('outdoor', 'outdoor_ratingscale.json'),
('outdoor', 'outdoor_rating.json'),
('outdoor', 'theme.json'),
('outdoor', 'label.json'),
('outdoor', 'source.json'),
('outdoor', 'organism.json'),
('outdoor', 'outdoor_site_ids.json'),
('outdoor', 'outdoor_sector.json'),
('outdoor', 'outdoor_practice.json'),
('outdoor', 'outdoor_ratingscale.json'),
('outdoor', 'outdoor_rating.json'),
('outdoor', 'outdoor_sitetype.json'),
('outdoor', 'outdoor_site_ids.json'),
('outdoor', 'outdoor_site.json'),
('outdoor', 'outdoor_coursetype.json'),
('outdoor', 'outdoor_course_ids.json'),
('outdoor', 'outdoor_sector.json'),
('outdoor', 'outdoor_practice.json'),
('outdoor', 'outdoor_ratingscale.json'),
('outdoor', 'outdoor_rating.json'),
('outdoor', 'outdoor_coursetype.json'),
('outdoor', 'outdoor_course.json')]

# Mock GET
Expand Down Expand Up @@ -87,23 +87,23 @@ def test_create_sites_and_courses(self, mocked_head, mocked_get):
('outdoor', 'label.json'),
('outdoor', 'source.json'),
('outdoor', 'organism.json'),
('outdoor', 'outdoor_sector.json'),
('outdoor', 'outdoor_practice.json'),
('outdoor', 'outdoor_ratingscale.json'),
('outdoor', 'outdoor_rating.json'),
('outdoor', 'theme.json'),
('outdoor', 'label.json'),
('outdoor', 'source.json'),
('outdoor', 'organism.json'),
('outdoor', 'outdoor_site_ids.json'),
('outdoor', 'outdoor_sector.json'),
('outdoor', 'outdoor_practice.json'),
('outdoor', 'outdoor_ratingscale.json'),
('outdoor', 'outdoor_rating.json'),
('outdoor', 'outdoor_sitetype.json'),
('outdoor', 'outdoor_site_ids.json'),
('outdoor', 'outdoor_site.json'),
('outdoor', 'outdoor_coursetype.json'),
('outdoor', 'outdoor_course_ids.json'),
('outdoor', 'outdoor_sector.json'),
('outdoor', 'outdoor_practice.json'),
('outdoor', 'outdoor_ratingscale.json'),
('outdoor', 'outdoor_rating.json'),
('outdoor', 'outdoor_coursetype.json'),
('outdoor', 'outdoor_course.json')]

# Mock GET
Expand Down Expand Up @@ -238,23 +238,23 @@ def test_create_sites_and_courses_with_wrong_children(self, mocked_head, mocked_
('outdoor', 'label.json'),
('outdoor', 'source.json'),
('outdoor', 'organism.json'),
('outdoor', 'outdoor_sector.json'),
('outdoor', 'outdoor_practice.json'),
('outdoor', 'outdoor_ratingscale.json'),
('outdoor', 'outdoor_rating.json'),
('outdoor', 'theme.json'),
('outdoor', 'label.json'),
('outdoor', 'source.json'),
('outdoor', 'organism.json'),
('outdoor', 'outdoor_site_ids.json'),
('outdoor', 'outdoor_sector.json'),
('outdoor', 'outdoor_practice.json'),
('outdoor', 'outdoor_ratingscale.json'),
('outdoor', 'outdoor_rating.json'),
('outdoor', 'outdoor_sitetype.json'),
('outdoor', 'outdoor_site_ids.json'),
('outdoor', 'outdoor_site_wrong_children.json'),
('outdoor', 'outdoor_coursetype.json'),
('outdoor', 'outdoor_course_ids.json'),
('outdoor', 'outdoor_sector.json'),
('outdoor', 'outdoor_practice.json'),
('outdoor', 'outdoor_ratingscale.json'),
('outdoor', 'outdoor_rating.json'),
('outdoor', 'outdoor_coursetype.json'),
('outdoor', 'outdoor_course_wrong_children.json')]

# Mock GET
Expand Down

0 comments on commit bcfd5c8

Please sign in to comment.