Filter only on tested nodes

This commit is contained in:
durch
2025-06-25 10:59:39 +02:00
parent 29227f452d
commit 16a9b7fe6e
3 changed files with 16 additions and 2 deletions
+6 -1
View File
@@ -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
+6
View File
@@ -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 {
+4 -1
View File
@@ -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)
}