Przeglądaj źródła

Ajout des tests sur les dates d'installation selon statut

omassot 6 lat temu
rodzic
commit
57f93f857d
2 zmienionych plików z 25 dodań i 3 usunięć
  1. 12 1
      schemas/mn1_rec.py
  2. 13 2
      schemas/mn2_rec.py

+ 12 - 1
schemas/mn1_rec.py

@@ -531,7 +531,18 @@ class Mn1Checker(BaseChecker):
                     self.log_error("Le champs est obligatoire: {}".format(field), item=artere)
                 elif getattr(artere, field) == "":
                     self.log_error("Le champs doit être renseigné: {}".format(field), item=artere)
-    
+
+    def test_dates_install(self):
+        """ Dates d'installation
+        Vérifie que les dates d'installation sont renseignées pour les équipements en service """
+        for equipement in self.equipements:
+            if equipement.EQ_STATUT == "REC" and not equipement.EQ_DATE_IN:
+                self.log_error("Date d'installation (EQ_DATE_IN) manquante", item=equipement)
+                
+        for cable in self.cables:
+            if cable.CA_STATUT == "REC" and not cable.CA_DATE_IN:
+                self.log_error("Date d'installation (CA_DATE_IN) manquante", item=cable)
+                
     def test_dimensions_fourreaux(self):
         """ Dimensions logiques: fourreaux
         Vérifie que les nombres de fourreaux renseignés sont cohérents """

+ 13 - 2
schemas/mn2_rec.py

@@ -93,7 +93,7 @@ class Cable(QgsModel):
               'CA_NB_FO_D': {'empty': False, 'validator': is_positive_int}, 
               'CA_PRO': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE']}, 
               'CA_GEST': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE FIBRE']}, 
-              'CA_DATE_IN': {'empty': False, 'validator': is_modern_french_date}, 
+              'CA_DATE_IN': {'empty': True, 'validator': is_modern_french_date}, 
               'CA_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True}, 
               'CA_STATUT': {'type': 'string', 'empty': False, 'allowed': STATUTS}}
 
@@ -123,7 +123,7 @@ class Equipement(QgsModel):
               'EQ_PRO': {'type': 'string', 'empty': False, 'allowed': ['MANCHE NUMERIQUE', 'COLLECTIVITE', 'ORANGE', 'PRIVE', 'AUTRE', 'NUL']}, 
               'EQ_GEST': {'type': 'string', 'empty': False, 'allowed': ['MANCHE NUMERIQUE', 'MANCHE TELECOM', 'COLLECTIVITE', 'ORANGE', 'MANCHE FIBRE', 'PRIVE', 'AUTRE', 'NUL']}, 
               'EQ_HAUT': {'empty': True, 'validator': is_float}, 
-              'EQ_DATE_IN': {'empty': False, 'validator': is_modern_french_date}, 
+              'EQ_DATE_IN': {'empty': True, 'validator': is_modern_french_date}, 
               'EQ_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True}, 
               'EQ_STATUT': {'type': 'string', 'empty': False, 'allowed': STATUTS}}
         
@@ -674,6 +674,17 @@ class Mn2Checker(BaseChecker):
             except (TypeError, ValueError):
                 pass
 
+    def test_dates_install(self):
+        """ Dates d'installation
+        Vérifie que les dates d'installation sont renseignées pour les équipements en service """
+        for equipement in self.equipements:
+            if equipement.EQ_STATUT == "EN SERVICE" and not equipement.EQ_DATE_IN:
+                self.log_error("Date d'installation (EQ_DATE_IN) manquante", item=equipement)
+                
+        for cable in self.cables:
+            if cable.CA_STATUT == "EN SERVICE" and not cable.CA_DATE_IN:
+                self.log_error("Date d'installation (CA_DATE_IN) manquante", item=cable)
+                    
     def _za_for_pbo(self, pbo):
         # retourne la ZAPBO correspondant à la PBO en parametre, None si aucune
         if hasattr(pbo, 'zapbo') and pbo.zapbo: