@@ -47,13 +47,11 @@ def convert(cls, source_version, target_version, edxl_json):
4747 # Convert directly if version are consecutive
4848 if abs (source_version_index - target_version_index ) == 1 :
4949 if source_version_index < target_version_index :
50- logger . info ( f"Upgrading message version from { source_version } " )
51- return cls .upgrade (source_version , source_version_index , edxl_json )
50+ target_version = version_order_list [ source_version_index + 1 ]
51+ return cls .upgrade (source_version , target_version , edxl_json )
5252 else :
53- logger .info (f"Downgrading message version from { source_version } " )
54- return cls .downgrade (
55- source_version , source_version_index , edxl_json
56- )
53+ target_version = version_order_list [source_version_index - 1 ]
54+ return cls .downgrade (source_version , target_version , edxl_json )
5755
5856 # Convert message to consecutive version
5957 version_delta = 1 if source_version_index < target_version_index else - 1
@@ -76,26 +74,28 @@ def convert(cls, source_version, target_version, edxl_json):
7674 cls .raise_conversion_not_implemented_error (source_version , target_version )
7775
7876 @classmethod
79- def upgrade (cls , source_version , source_version_index , edxl_json ):
77+ def upgrade (cls , source_version , target_version , edxl_json ):
78+ logger .info (
79+ f"Upgrading message version from { source_version } to { target_version } "
80+ )
8081 if source_version == "v1" :
8182 return cls .convert_v1_to_v2 (edxl_json )
8283 elif source_version == "v2" :
8384 return cls .convert_v2_to_v3 (edxl_json )
8485 else :
85- return cls .raise_conversion_impossible_error (
86- source_version , version_order_list [source_version_index + 1 ]
87- )
86+ return cls .raise_conversion_impossible_error (source_version , target_version )
8887
8988 @classmethod
90- def downgrade (cls , source_version , source_version_index , edxl_json ):
89+ def downgrade (cls , source_version , target_version , edxl_json ):
90+ logger .info (
91+ f"Downgrading message version from { source_version } to { target_version } "
92+ )
9193 if source_version == "v2" :
9294 return cls .convert_v2_to_v1 (edxl_json )
9395 elif source_version == "v3" :
9496 return cls .convert_v3_to_v2 (edxl_json )
9597 else :
96- return cls .raise_conversion_impossible_error (
97- source_version , version_order_list [source_version_index - 1 ]
98- )
98+ return cls .raise_conversion_impossible_error (source_version , target_version )
9999
100100 @classmethod
101101 def convert_v1_to_v2 (cls , edxl_json ):
@@ -127,12 +127,12 @@ def raise_conversion_impossible_error(cls, source_version, target_version):
127127
128128 @classmethod
129129 def copy_input_content (cls , input_json : Dict [str , Any ]) -> Dict [str , Any ]:
130- logger .info ("Copying input content" )
130+ logger .debug ("Copying input content" )
131131 return cls ._copy_input_content (input_json , cls .get_message_type ())
132132
133133 @classmethod
134134 def copy_input_use_case_content (cls , input_json : Dict [str , Any ]) -> Dict [str , Any ]:
135- logger .info ("Copying input use case content" )
135+ logger .debug ("Copying input use case content" )
136136 return cls ._copy_input_use_case_content (input_json , cls .get_message_type ())
137137
138138 @classmethod
@@ -141,7 +141,7 @@ def format_output_json(
141141 output_json : Dict [str , Any ],
142142 output_use_case_json : Dict [str , Any ],
143143 ) -> Dict [str , Any ]:
144- logger .info ("Formatting output JSON" )
144+ logger .debug ("Formatting output JSON" )
145145 return cls ._format_output_json (
146146 output_json , output_use_case_json , cls .get_message_type ()
147147 )
0 commit comments