mirror of
https://gitlab.cern.ch/wotsubo/psboard-qaqc-postprocess.git
synced 2024-11-21 23:00:20 +09:00
refactor: split func for printing boards for retest
This commit is contained in:
parent
b80c4902ca
commit
9e93a085fd
2 changed files with 21 additions and 10 deletions
11
src/main.rs
11
src/main.rs
|
@ -2,7 +2,7 @@ use core::str;
|
||||||
use std::{
|
use std::{
|
||||||
fmt::Display,
|
fmt::Display,
|
||||||
fs::File,
|
fs::File,
|
||||||
io::{BufRead, BufReader},
|
io::{self, BufRead, BufReader},
|
||||||
path::{self, PathBuf},
|
path::{self, PathBuf},
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
};
|
};
|
||||||
|
@ -369,14 +369,7 @@ fn main() -> Result<()> {
|
||||||
debug!("{:?}", result);
|
debug!("{:?}", result);
|
||||||
|
|
||||||
// Print boards to retest
|
// Print boards to retest
|
||||||
for (pos, boardresult) in &result.board_results {
|
result.print_boards_to_retest(io::stdout())?;
|
||||||
if let Some(reason) = boardresult.is_need_retest() {
|
|
||||||
println!(
|
|
||||||
"Board {} at {} need retest for {}",
|
|
||||||
boardresult.id.id, pos, reason
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let outfile = outfile.unwrap_or(get_output_filename(&result));
|
let outfile = outfile.unwrap_or(get_output_filename(&result));
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
use std::{collections::BTreeMap, io::BufRead, path::PathBuf, str::FromStr};
|
use std::{
|
||||||
|
collections::BTreeMap,
|
||||||
|
io::{BufRead, Write},
|
||||||
|
path::PathBuf,
|
||||||
|
str::FromStr,
|
||||||
|
};
|
||||||
|
|
||||||
use anyhow::{anyhow, Context, Result};
|
use anyhow::{anyhow, Context, Result};
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
|
@ -301,6 +306,19 @@ impl MasterLogResult {
|
||||||
filename,
|
filename,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn print_boards_to_retest(&self, mut wtr: impl Write) -> Result<()> {
|
||||||
|
for (pos, boardresult) in &self.board_results {
|
||||||
|
if let Some(reason) = boardresult.is_need_retest() {
|
||||||
|
writeln!(
|
||||||
|
wtr,
|
||||||
|
"Board {} at {} need retest for {}",
|
||||||
|
boardresult.id.id, pos, reason
|
||||||
|
)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_output_filename(result: &MasterLogResult) -> PathBuf {
|
pub fn get_output_filename(result: &MasterLogResult) -> PathBuf {
|
||||||
|
|
Loading…
Reference in a new issue