Skip to content

Commit 1194350

Browse files
New fixes
1 parent 4df13ef commit 1194350

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/openklant/components/contactgegevens/migrations/0005_alter_organisatie_adres_nummeraanduiding_id_and_more.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
logger = logging.getLogger(__name__)
1111

1212

13-
def _check_records(records, model_name):
13+
def _check_records(records):
1414
total_failed_records = 0
1515
for record in records:
1616
if record.adres_nummeraanduiding_id:
@@ -19,7 +19,7 @@ def _check_records(records, model_name):
1919
except ValidationError:
2020
logger.warning(
2121
"%s(pk=%s, uuid=%s) Field: 'adres_nummeraanduiding_id'. Invalid BAG ID: %s",
22-
model_name,
22+
type(record).__qualname__,
2323
record.pk,
2424
record.uuid,
2525
record.adres_nummeraanduiding_id,
@@ -32,13 +32,13 @@ def _check_records_field_length(apps, schema_editor):
3232
Organisatie = apps.get_model("contactgegevens", "Organisatie")
3333
Persoon = apps.get_model("contactgegevens", "Persoon")
3434

35-
for model_name, model in [("Organisatie", Organisatie), ("Persoon", Persoon)]:
35+
for model in [Organisatie, Persoon]:
3636
records = model.objects.all()
37-
if total_failed_records := _check_records(records, model_name):
37+
if total_failed_records := _check_records(records):
3838
raise IntegrityError(
3939
"The migration cannot proceed due to %s records that don't comply with the %s model's requirements. "
4040
"Possible data inconsistency or mapping error."
41-
% (total_failed_records, model_name)
41+
% (total_failed_records, model.__qualname__)
4242
)
4343

4444

src/openklant/components/klantinteracties/migrations/0027_alter_betrokkene_bezoekadres_nummeraanduiding_id_and_more.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
logger = logging.getLogger(__name__)
1111

1212

13-
def _check_records(records, model_name):
13+
def _check_records(records):
1414
total_failed_records = 0
1515
for record in records:
1616
record_failed = False
@@ -25,7 +25,7 @@ def _check_records(records, model_name):
2525
except ValidationError:
2626
logger.warning(
2727
"%s(pk=%s, uuid=%s) Field: '%s'. Invalid BAG ID: %s",
28-
model_name,
28+
type(record).__qualname__,
2929
record.pk,
3030
record.uuid,
3131
field_name,
@@ -42,13 +42,13 @@ def _check_records_field_length(apps, schema_editor):
4242
Betrokkene = apps.get_model("klantinteracties", "Betrokkene")
4343
Partij = apps.get_model("klantinteracties", "Partij")
4444

45-
for model_name, model in [("Betrokkene", Betrokkene), ("Partij", Partij)]:
45+
for model in [Betrokkene, Partij]:
4646
records = model.objects.all()
47-
if total_failed_records := _check_records(records, model_name):
47+
if total_failed_records := _check_records(records):
4848
raise IntegrityError(
4949
"The migration cannot proceed due to %s records that don't comply with the %s model's requirements. "
5050
"Possible data inconsistency or mapping error."
51-
% (total_failed_records, model_name)
51+
% (total_failed_records, model.__qualname__)
5252
)
5353

5454

src/openklant/utils/tests/test_validators.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ def test_validate_bag_id(self):
172172
bag_id,
173173
)
174174

175-
self.assertIsNone(validate_bag_id("1234567890000001"))
176-
self.assertIsNone(validate_bag_id("1111111111111111"))
175+
validate_bag_id("1234567890000001")
176+
validate_bag_id("1111111111111111")
177177

178178
def test_validate_country(self):
179179
invalid_codes = [

0 commit comments

Comments
 (0)