mirror of
https://gitlab.cern.ch/wotsubo/psboard-qaqc-postprocess.git
synced 2024-11-24 16:11:11 +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::{
|
||||
fmt::Display,
|
||||
fs::File,
|
||||
io::{BufRead, BufReader},
|
||||
io::{self, BufRead, BufReader},
|
||||
path::{self, PathBuf},
|
||||
str::FromStr,
|
||||
};
|
||||
|
@ -369,14 +369,7 @@ fn main() -> Result<()> {
|
|||
debug!("{:?}", result);
|
||||
|
||||
// Print boards to retest
|
||||
for (pos, boardresult) in &result.board_results {
|
||||
if let Some(reason) = boardresult.is_need_retest() {
|
||||
println!(
|
||||
"Board {} at {} need retest for {}",
|
||||
boardresult.id.id, pos, reason
|
||||
);
|
||||
}
|
||||
}
|
||||
result.print_boards_to_retest(io::stdout())?;
|
||||
|
||||
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 chrono::{DateTime, Utc};
|
||||
|
@ -301,6 +306,19 @@ impl MasterLogResult {
|
|||
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 {
|
||||
|
|
Loading…
Reference in a new issue