diff --git a/src/entities/vault_account.rs b/src/entities/vault_account.rs index 4c219e6f3d7efc8f796125a958a82c28b232a6e5..80586cf9d141cd5ebec722d1e6e81ce57f8267bb 100644 --- a/src/entities/vault_account.rs +++ b/src/entities/vault_account.rs @@ -6,7 +6,6 @@ use sea_orm::entity::prelude::*; use sea_orm::prelude::async_trait::async_trait; use sea_orm::prelude::StringLen; use sea_orm::ActiveValue::Set; -use sea_orm::PaginatorTrait; use sea_orm::QueryFilter; use sea_orm::TryGetError; use sea_orm::{ @@ -14,6 +13,7 @@ use sea_orm::{ ModelTrait, QueryOrder, RelationDef, RelationTrait, TryFromU64, }; use sea_orm::{ActiveModelTrait, ConnectionTrait, PrimaryKeyTrait}; +use sea_orm::{Condition, PaginatorTrait}; use sea_orm::{DeriveActiveEnum, EntityTrait}; use std::cell::RefCell; use std::collections::HashMap; @@ -768,6 +768,9 @@ where Ok(Some(base_parent_account)) } +/// Fetches all the children accounts of current_account +/// +/// Due to a hard to reproduce issue (!48) had to adapt the filter on Parent to also match if the Parent value has those extra double quotes around the value async fn find_direct_children_accounts<C>( db: &C, current_account: &Model, @@ -776,7 +779,11 @@ where C: ConnectionTrait, { Entity::find() - .filter(Column::Parent.eq(current_account.address.clone())) + .filter( + Condition::any() + .add(Column::Parent.eq(current_account.address.clone())) + .add(Column::Parent.eq(format!("\"{}\"",current_account.address.to_string()))), + ) .order_by_asc(Column::Address) .all(db) .await