Filter only on tested nodes
This commit is contained in:
@@ -237,10 +237,15 @@ async fn compare_methods(
|
||||
.ok_or_else(|| to_axum_error(SimulationApiError::new("Simulation epoch not found")))?;
|
||||
|
||||
// Get simulation performance data
|
||||
let mut performance_data = get_performance_by_method(storage, sim_epoch.epoch_id, "new")
|
||||
let performance_data = get_performance_by_method(storage, sim_epoch.epoch_id, "new")
|
||||
.await
|
||||
.map_err(to_axum_error)?;
|
||||
|
||||
let mut performance_data: Vec<NodePerformanceData> = performance_data
|
||||
.into_iter()
|
||||
.filter(|p| p.total_samples() > 0)
|
||||
.collect();
|
||||
|
||||
// Populate production performance from node annotations cache
|
||||
let node_annotations = state
|
||||
.node_status_cache
|
||||
|
||||
@@ -76,6 +76,12 @@ pub struct NodePerformanceData {
|
||||
pub production_performance: Option<f64>,
|
||||
}
|
||||
|
||||
impl NodePerformanceData {
|
||||
pub fn total_samples(&self) -> u32 {
|
||||
self.positive_samples + self.negative_samples
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SimulatedNodePerformance> for NodePerformanceData {
|
||||
fn from(perf: SimulatedNodePerformance) -> Self {
|
||||
Self {
|
||||
|
||||
@@ -1789,7 +1789,10 @@ impl StorageManager {
|
||||
description: Option<&str>,
|
||||
) -> Result<(i64, bool), sqlx::Error> {
|
||||
// Check if simulation already exists
|
||||
if let Some(existing_id) = self.get_existing_simulation_epoch(epoch_id, calculation_method).await? {
|
||||
if let Some(existing_id) = self
|
||||
.get_existing_simulation_epoch(epoch_id, calculation_method)
|
||||
.await?
|
||||
{
|
||||
return Ok((existing_id, false)); // Return existing ID and false (not newly created)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user