mirror of
https://github.com/kevinveenbirkenbach/baserow-ifto.git
synced 2024-11-22 10:51:05 +01:00
Implemented multi table matrix
This commit is contained in:
parent
ad96811e0b
commit
63525c22fa
@ -99,14 +99,16 @@ class BaserowAPI:
|
|||||||
table_data = self.get_all_rows_from_table(table_id.strip())
|
table_data = self.get_all_rows_from_table(table_id.strip())
|
||||||
tables_data[table_id] = table_data
|
tables_data[table_id] = table_data
|
||||||
return tables_data
|
return tables_data
|
||||||
|
|
||||||
def build_matrix(self, tables_data, reference_map={}):
|
def build_multitable_matrix(self, tables_data):
|
||||||
|
for table_name, table_rows in tables_data.copy().items():
|
||||||
|
self.build_matrix(tables_data,table_name, table_rows)
|
||||||
|
|
||||||
|
def build_matrix(self, tables_data, table_name, table_rows, reference_map={}):
|
||||||
"""Build a matrix with linked rows filled recursively."""
|
"""Build a matrix with linked rows filled recursively."""
|
||||||
reference_map_child = reference_map.copy()
|
reference_map_child = reference_map.copy()
|
||||||
|
self.process_link_fields(table_name, tables_data, reference_map_child)
|
||||||
for table_name, table_rows in tables_data.copy().items():
|
self.fill_cells_with_related_content(table_name, table_rows, reference_map_child)
|
||||||
self.process_link_fields(table_name, tables_data, reference_map_child)
|
|
||||||
self.fill_cells_with_related_content(table_name, table_rows, reference_map_child)
|
|
||||||
|
|
||||||
return tables_data
|
return tables_data
|
||||||
|
|
||||||
@ -135,7 +137,7 @@ class BaserowAPI:
|
|||||||
self.print_verbose_message(f"Skipped {related_cell_identifier}. Already implemented")
|
self.print_verbose_message(f"Skipped {related_cell_identifier}. Already implemented")
|
||||||
break
|
break
|
||||||
|
|
||||||
reference_map_child[table_column_name]["embeded"].add(related_cell_identifier)
|
reference_map_child[table_column_name]["embeded"].append(related_cell_identifier)
|
||||||
|
|
||||||
|
|
||||||
def generate_related_cell_identifier(self, table_id, table_column_id, table_row_id):
|
def generate_related_cell_identifier(self, table_id, table_column_id, table_row_id):
|
||||||
|
@ -21,7 +21,7 @@ def main():
|
|||||||
handle_output(args.quiet, tables_data)
|
handle_output(args.quiet, tables_data)
|
||||||
|
|
||||||
if "matrix" in args.output:
|
if "matrix" in args.output:
|
||||||
matrix_data = api.build_matrix(tables_data)
|
matrix_data = api.build_multitable_matrix(tables_data)
|
||||||
handle_output(args.quiet, matrix_data)
|
handle_output(args.quiet, matrix_data)
|
||||||
|
|
||||||
if args.database_id:
|
if args.database_id:
|
||||||
|
Loading…
Reference in New Issue
Block a user