Skip to content

Commit 7d4cc57

Browse files
author
oleksandr.volha
committed
add mapping method
1 parent 4eb653c commit 7d4cc57

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

uncoder-core/app/translator/core/functions.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,16 @@ def set_functions_manager(self, manager: PlatformFunctionsManager) -> FunctionRe
9494
def render(self, function: Function, source_mapping: SourceMapping) -> str:
9595
raise NotImplementedError
9696

97-
@staticmethod
98-
def map_field(field: Union[Alias, Field], source_mapping: SourceMapping) -> str:
97+
def map_field(self, field: Union[Alias, Field], source_mapping: SourceMapping) -> str:
9998
if isinstance(field, Alias):
10099
return field.name
101100

102-
generic_field_name = field.get_generic_field_name(source_mapping.source_id)
103-
mapped_field = source_mapping.fields_mapping.get_platform_field_name(generic_field_name=generic_field_name)
104-
if isinstance(mapped_field, list):
105-
mapped_field = mapped_field[0]
101+
if isinstance(field, Field):
102+
mappings = self.manager.platform_functions.platform_query_render.mappings
103+
mapped_fields = mappings.map_field(field, source_mapping)
104+
return mapped_fields[0]
106105

107-
return mapped_field if mapped_field else field.source_name
106+
raise NotSupportedFunctionException
108107

109108

110109
class PlatformFunctionsManager:

0 commit comments

Comments
 (0)