nanterre: correct address integrity checks (#41073)

This commit is contained in:
Nicolas Roche 2020-03-26 17:44:26 +01:00
parent a57da948c9
commit cbb9380c80
1 changed files with 8 additions and 5 deletions

View File

@ -623,17 +623,20 @@ def integrity_check():
% (key, value))
for key, value in count_habite_rels.items():
if key.content['statut_legal'] == 'majeur' and value < 1:
yield ("l'adulte %s n'a pas d'adresse" % key)
if key.content['statut_legal'] == 'majeur' and value > 1:
yield ("l'adulte %s a plus d'une adresse: %s" % (key, value))
if key.content['statut_legal'] == 'mineur' and value > 2:
yield ("l'enfant %s a plus de deux adresses: %s" % (key, value))
if key.content['statut_legal'] == 'mineur' and value > 2:
yield ("l'enfant %s n'a pas d'adresse" % key)
id_having_address = [x[0].id for x in count_habite_rels.items()]
for key in Entity.objects.filter(schema__slug=INDIVIDU_ENT):
if key.id not in id_having_address:
if key.content['statut_legal'] == 'majeur':
yield ("l'adulte %s n'a pas d'adresse" % key)
if key.content['statut_legal'] == 'mineur':
yield ("l'enfant %s n'a pas d'adresse" % key)
def upper_dict(d):