fix: update list_operator app_nodes assignment to reflect actual length and vec of app nodes in inpsect operator
This commit is contained in:
		
							parent
							
								
									04fa52c2b1
								
							
						
					
					
						commit
						d8ca1c4968
					
				
							
								
								
									
										22
									
								
								src/data.rs
									
									
									
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										22
									
								
								src/data.rs
									
									
									
									
									
								
							| @ -1107,7 +1107,7 @@ impl BrainData { | ||||
|                 pubkey: op.key().to_string(), | ||||
|                 escrow: op.escrow / 1_000_000_000, | ||||
|                 email: op.email.clone(), | ||||
|                 app_nodes: 0, | ||||
|                 app_nodes: op.app_nodes.len() as u64, | ||||
|                 vm_nodes: op.vm_nodes.len() as u64, | ||||
|                 reports: self.total_operator_reports(op.key()) as u64, | ||||
|             }) | ||||
| @ -1121,18 +1121,23 @@ impl BrainData { | ||||
|                 .into_iter() | ||||
|                 .map(|n| n.into()) | ||||
|                 .collect(); | ||||
| 
 | ||||
|             let app_nodes = self | ||||
|                 .find_app_nodes_by_operator(wallet) | ||||
|                 .into_iter() | ||||
|                 .map(|n| n.into()) | ||||
|                 .collect(); | ||||
|             InspectOperatorResp { | ||||
|                 operator: Some(ListOperatorsResp { | ||||
|                     pubkey: op.key().to_string(), | ||||
|                     escrow: op.escrow, | ||||
|                     email: op.email.clone(), | ||||
|                     app_nodes: 0, | ||||
|                     app_nodes: op.app_nodes.len() as u64, | ||||
|                     vm_nodes: op.vm_nodes.len() as u64, | ||||
|                     reports: self.total_operator_reports(op.key()) as u64, | ||||
|                 }), | ||||
|                 vm_nodes, | ||||
|                 // TODO: fix app node list
 | ||||
|                 app_nodes: Vec::new(), | ||||
|                 app_nodes, | ||||
|             } | ||||
|         }) | ||||
|     } | ||||
| @ -1216,6 +1221,15 @@ impl BrainData { | ||||
|             }); | ||||
|     } | ||||
| 
 | ||||
|     pub fn find_app_nodes_by_operator(&self, operator_wallet: &str) -> Vec<AppNode> { | ||||
|         let nodes = self.app_nodes.read().unwrap(); | ||||
|         nodes | ||||
|             .iter() | ||||
|             .filter(|node| node.operator_wallet == operator_wallet) | ||||
|             .cloned() | ||||
|             .collect() | ||||
|     } | ||||
| 
 | ||||
|     pub fn find_app_nodes_by_filters(&self, filters: &AppNodeFilters) -> Vec<AppNode> { | ||||
|         let nodes = self.app_nodes.read().unwrap(); | ||||
|         nodes | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user