fix(simulation): Sprint 30 server — atmosphere filter fix + corridor-status cmd
#762: Update habitable_planet_count filter to accept both "breathable" and "standard" atmosphere values via matches! macro. Previously only matched "breathable", causing all committed systems to report 0 habitable planets. #744: Add corridor-status subcommand to atlas CLI. Shows remaining unfinished systems grouped by geographic_sector and hop_distance, with plain text table output and totals. Cargo.lock updated for v0.1.29. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Generated
+1
-1
@@ -1236,7 +1236,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "settled-reach-server"
|
||||
version = "0.1.28"
|
||||
version = "0.1.29"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_ecs",
|
||||
|
||||
+67
-2
@@ -182,6 +182,8 @@ enum Commands {
|
||||
#[arg(long, default_value = "wiki/star-systems")]
|
||||
wiki: String,
|
||||
},
|
||||
/// Show remaining unfinished systems grouped by geographic sector and hop distance
|
||||
CorridorStatus,
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -1290,8 +1292,10 @@ fn cmd_commit_system(conn: &Connection, path: &str) {
|
||||
.bodies
|
||||
.iter()
|
||||
.filter(|b| {
|
||||
b.atmosphere.as_deref() == Some("breathable")
|
||||
&& (b.body_type == "planet" || b.body_type == "moon")
|
||||
matches!(
|
||||
b.atmosphere.as_deref(),
|
||||
Some("breathable") | Some("standard")
|
||||
) && (b.body_type == "planet" || b.body_type == "moon")
|
||||
})
|
||||
.count() as i32;
|
||||
|
||||
@@ -1992,6 +1996,66 @@ fn format_population(pop: i64) -> String {
|
||||
|
||||
// cmd_populate removed — replaced by per-system author/commit workflow
|
||||
|
||||
fn cmd_corridor_status(conn: &Connection) {
|
||||
// Query unfinished systems grouped by geographic_sector and hop_distance_from_gateway.
|
||||
// "Unfinished" = no rows in bodies for this system_id.
|
||||
let mut stmt = conn
|
||||
.prepare(
|
||||
"SELECT s.geographic_sector, g.hop_distance_from_gateway, COUNT(*) AS remaining
|
||||
FROM star_systems s
|
||||
JOIN system_gates g ON s.system_id = g.system_id
|
||||
WHERE s.system_id NOT IN (SELECT DISTINCT system_id FROM bodies)
|
||||
GROUP BY s.geographic_sector, g.hop_distance_from_gateway
|
||||
ORDER BY s.geographic_sector, g.hop_distance_from_gateway",
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
struct Row {
|
||||
sector: Option<String>,
|
||||
hop: Option<i32>,
|
||||
remaining: i64,
|
||||
}
|
||||
|
||||
let rows: Vec<Row> = stmt
|
||||
.query_map([], |row| {
|
||||
Ok(Row {
|
||||
sector: row.get(0)?,
|
||||
hop: row.get(1)?,
|
||||
remaining: row.get(2)?,
|
||||
})
|
||||
})
|
||||
.unwrap()
|
||||
.filter_map(|r| r.ok())
|
||||
.collect();
|
||||
|
||||
if rows.is_empty() {
|
||||
println!("All systems have bodies authored.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Plain text table: corridor | hop | remaining
|
||||
let total: i64 = rows.iter().map(|r| r.remaining).sum();
|
||||
println!("{:<30} {:>4} {:>9}", "Corridor", "Hop", "Remaining");
|
||||
println!("{}", "-".repeat(48));
|
||||
let mut last_sector = String::new();
|
||||
for row in &rows {
|
||||
let sector = row.sector.as_deref().unwrap_or("(unknown)");
|
||||
let hop = row
|
||||
.hop
|
||||
.map(|h| h.to_string())
|
||||
.unwrap_or_else(|| "?".to_string());
|
||||
if sector != last_sector {
|
||||
if !last_sector.is_empty() {
|
||||
println!();
|
||||
}
|
||||
last_sector = sector.to_string();
|
||||
}
|
||||
println!("{:<30} {:>4} {:>9}", sector, hop, row.remaining);
|
||||
}
|
||||
println!("{}", "-".repeat(48));
|
||||
println!("{:<30} {:>4} {:>9}", "TOTAL", "", total);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Main
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -2039,5 +2103,6 @@ fn main() {
|
||||
Commands::Unfinished { sector } => cmd_unfinished(&conn, sector.as_deref()),
|
||||
Commands::Next { hop, sector } => cmd_next(&conn, *hop, sector.as_deref()),
|
||||
Commands::SyncWiki { system_id, wiki } => cmd_sync_wiki(&conn, system_id.as_deref(), wiki),
|
||||
Commands::CorridorStatus => cmd_corridor_status(&conn),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user