Browse Source

change get_date_formats

tsteuer 4 years ago
parent
commit
516a71e3a0
1 changed files with 7 additions and 18 deletions
  1. 7 18
      cdplib/db_migration/ParseMapping.py

+ 7 - 18
cdplib/db_migration/ParseMapping.py

@@ -156,7 +156,7 @@ class ParseMapping:
         are beeing added also add them in the unit test.
         are beeing added also add them in the unit test.
         '''
         '''
 
 
-        standard_value_mapping_names=["value_mapping"]
+        standard_value_mapping_names = ["value_mapping"]
 
 
         return self._get_property_from_mapping(standard_value_mapping_names)
         return self._get_property_from_mapping(standard_value_mapping_names)
 
 
@@ -165,22 +165,11 @@ class ParseMapping:
         Get date fromats from migration mapping json. If more peorerty names
         Get date fromats from migration mapping json. If more peorerty names
         are beeing added or value also add them in the unit test.
         are beeing added or value also add them in the unit test.
         '''
         '''
-        assert(all([self._source in d for d in self._mapping])),\
-            "Not all objects in the mapping json contain property tag " + self._source
-
-        standard_property_names=["type"]
-        standard_property_values=["%d%m%Y"]
-
-        date_formats = {}
-        for column_mapping in self._mapping:
-            for property_name in standard_property_names:
-                if property_name in column_mapping and column_mapping[property_name]:
-                    for value in standard_property_values:
-                        if column_mapping[property_name] == value:
-                            date_formats.update({column_mapping[self._source]: column_mapping[property_name]})
-
-        return date_formats
+        
+        standard_date_format_names = ["date_format"]
 
 
+        return self._get_property_from_mapping(standard_date_format_names)
+    
     def get_internal_names(self) -> dict:
     def get_internal_names(self) -> dict:
         '''
         '''
         '''
         '''
@@ -276,7 +265,7 @@ if __name__ == "__main__":
         print(column_numbers)
         print(column_numbers)
         value_mappings = parser.get_value_mappings()
         value_mappings = parser.get_value_mappings()
         print(value_mappings)
         print(value_mappings)
-        sys.exit()
-
+        date_formats = parser.get_date_formats()
+        print(date_formats)
 
 
         print("Done testing!")
         print("Done testing!")