                                         SELECT "locations_sqllocation"."location_type_id"
                                         FROM "locations_sqllocation"
                                         WHERE "locations_sqllocation"."id" = ANY(user_location_ids_array)
-                                        ORDER BY "locations_sqllocation"."tree_id" ASC, "locations_sqllocation"."lft" ASC
                                     )
                                 )
                             )

                    "locations_sqllocation"."is_archived" = False
                    AND "locations_sqllocation"."id" = ("cte"."parent_id")
                )
                ORDER BY "locations_sqllocation"."tree_id" ASC, "locations_sqllocation"."lft" ASC
            )
        )


                            U0."id" = ANY(user_location_ids_array)
                            AND U1."expand_to_id" IS NOT NULL
                        )
                    )
                )

