diff --git a/app/apps/addresses/models.py b/app/apps/addresses/models.py index 30edc1f90..0f9c8ab84 100644 --- a/app/apps/addresses/models.py +++ b/app/apps/addresses/models.py @@ -83,17 +83,7 @@ def get_bag_address_data(self): bag_search_response = do_bag_search_by_bag_id(self.bag_id) bag_search_results = bag_search_response.get("response", {}).get("docs", []) if bag_search_results: - # A BAG search will return an array with 1 or more results. - # There could be a "Nevenadres" so check addresses for "Hoofdadres". - - found_address = None - for address in bag_search_results: - if address.get("type_adres") == "Hoofdadres": - found_address = address - break # Found first desired object so break the loop. - - found_bag_data = found_address or bag_search_results[0] - + found_bag_data = bag_search_results[0] self.postal_code = found_bag_data.get("postcode", "") self.street_name = found_bag_data.get("straatnaam", "") self.number = found_bag_data.get("huisnummer", "")