diff --git a/scripts/copy-chart-info.sh b/scripts/copy-chart-info.sh index 8ceed3d..5f73656 100755 --- a/scripts/copy-chart-info.sh +++ b/scripts/copy-chart-info.sh @@ -6,8 +6,10 @@ if [ "$#" != 2 ]; then exit 1 fi -from="$1/db.sqlite" -to ="$2/db.sqlite" +a="$1/db.sqlite" +b="$2/db.sqlite" -sqlite3 $from ".dump songs" | sqlite3 $to -sqlite3 $from ".dump charts" | sqlite3 $to +sqlite3 $b "DROP TABLE songs" +sqlite3 $b "DROP TABLE charts" +sqlite3 $a ".dump songs" | sqlite3 $b +sqlite3 $a ".dump charts" | sqlite3 $b diff --git a/src/arcaea/play.rs b/src/arcaea/play.rs index 0b608e5..64103be 100644 --- a/src/arcaea/play.rs +++ b/src/arcaea/play.rs @@ -1,6 +1,7 @@ use std::array; use std::num::NonZeroU64; +use anyhow::Context; use chrono::NaiveDateTime; use chrono::Utc; use num::traits::Euclid; @@ -83,7 +84,13 @@ impl CreatePlay { self.far_notes, ), |row| Ok((row.get("id")?, row.get("created_at")?)), - )?; + ) + .with_context(|| { + format!( + "Could not create play {self:?} with user {:?} and chart {:?}", + user.id, chart.id + ) + })?; // }}} // {{{ Update creation ptt data let scores = ScoreCollection::from_standard_score(self.score, chart); diff --git a/src/commands/discord.rs b/src/commands/discord.rs index cc75fb5..3384681 100644 --- a/src/commands/discord.rs +++ b/src/commands/discord.rs @@ -145,7 +145,9 @@ pub mod mock { let path = dir.join(&attachment.filename); if path.exists() { - assert_eq!(&attachment.data, &fs::read(path)?); + if &attachment.data != &fs::read(&path)? { + panic!("Attachment differs from {path:?}"); + } } else { fs::write(&path, &attachment.data)?; } diff --git a/src/context.rs b/src/context.rs index 0a77c31..4539558 100644 --- a/src/context.rs +++ b/src/context.rs @@ -106,11 +106,16 @@ pub mod testing { } pub fn import_songs_and_jackets_from(to: &Path) -> () { - std::process::Command::new("scripts/copy-chart-info.sh") + let out = std::process::Command::new("scripts/copy-chart-info.sh") .arg(get_data_dir()) .arg(to) .output() .expect("Could not run sh chart info copy script"); + + assert!( + out.status.success(), + "chart info copy script exited with non-0 code" + ); } #[macro_export] diff --git a/src/recognition/hyperglass.rs b/src/recognition/hyperglass.rs index 387dd73..cb1646f 100644 --- a/src/recognition/hyperglass.rs +++ b/src/recognition/hyperglass.rs @@ -334,7 +334,7 @@ impl CharMeasurements { .map(|(i, _, d)| (d.sqrt(), i)) .ok_or_else(|| anyhow!("No chars in cache"))?; - println!("char '{}', distance {}", best_match.1, best_match.0); + // println!("char '{}', distance {}", best_match.1, best_match.0); if best_match.0 <= 0.75 { result.push(best_match.1); }