(cls, table, top=True)
Inserts a case_name column if necessary

        :param table: A TableConfiguration instance
        :param top: When True inserts the columns at the top, when false at the bottom
Inserts a case_name column if necessary
Inserts a case_name column if necessary
def __insert_case_name(cls, table, top=True):
        """
        Inserts a case_name column if necessary

        :param table: A TableConfiguration instance
        :param top: When True inserts the columns at the top, when false at the bottom
        """
        insert_fn = cls._get_insert_fn(table, top)

        def consider(column):
            return not isinstance(column, UserDefinedExportColumn)

        def is_case_name(column):
            return (
                column.item.path[-1].name == 'case_name'
                or (column.item.path[-1].name == '@case_id' and column.item.transform == CASE_NAME_TRANSFORM)
            )

        from corehq.apps.export.system_properties import get_case_name_column
        case_id_columns = {
            _path_nodes_to_string(column.item.path[:-1]): column
            for column in table.columns if consider(column) and column.item.path[-1].name == '@case_id'
        }
        case_name_columns = {
            _path_nodes_to_string(column.item.path[:-1]): column
            for column in table.columns if consider(column) and is_case_name(column)
        }
        for path, column in case_id_columns.items():
            if path not in case_name_columns:
                insert_fn(get_case_name_column(column.item))
def __insert_case_name ( cls , table , top = True ) : insert_fn = cls . _get_insert_fn ( table , top ) def consider ( column ) : return not isinstance ( column , UserDefinedExportColumn ) def is_case_name ( column ) : return ( column . item . path [ - 1 ] . name == 'case_name' or ( column . item . path [ - 1 ] . name == '@case_id' and column . item . transform == CASE_NAME_TRANSFORM ) ) from corehq . apps . export . system_properties import get_case_name_column case_id_columns = { _path_nodes_to_string ( column . item . path [ : - 1 ] ) : column for column in table . columns if consider ( column ) and column . item . path [ - 1 ] . name == '@case_id' } case_name_columns = { _path_nodes_to_string ( column . item . path [ : - 1 ] ) : column for column in table . columns if consider ( column ) and is_case_name ( column ) } for path , column in case_id_columns . items ( ) : if path not in case_name_columns : insert_fn ( get_case_name_column ( column . item ) )