web: use new utility function in callback
This commit is contained in:
parent
6c8533f7a6
commit
1aa4c1b7bb
|
@ -16,7 +16,7 @@ use plate_tool_lib::util::letters_to_num;
|
|||
use plate_tool_lib::transfer::Transfer;
|
||||
use plate_tool_lib::transfer_region::{Region, TransferRegion};
|
||||
|
||||
use plate_tool_lib::csv::TransferRecord;
|
||||
use plate_tool_lib::csv::{TransferRecord, string_well_to_pt};
|
||||
|
||||
use super::main_window_callbacks::create_close_button;
|
||||
|
||||
|
@ -229,28 +229,14 @@ pub fn import_transfer_csv_submit_callback(
|
|||
let from_dest = from_dest.value();
|
||||
let to_dest = to_dest.value();
|
||||
|
||||
lazy_static! {
|
||||
static ref REGEX: Regex = Regex::new(r"([A-Z,a-z]+)(\d+)").unwrap();
|
||||
}
|
||||
let records: Vec<((u8, u8), (u8, u8))> = records
|
||||
.iter()
|
||||
.filter(|record| record.source_plate == from_source)
|
||||
.filter(|record| record.destination_plate == from_dest)
|
||||
.map(|record| {
|
||||
let c1 = REGEX.captures(&record.source_well).unwrap();
|
||||
let c2 = REGEX.captures(&record.destination_well).unwrap();
|
||||
log::debug!("{} {}", &record.source_well, &record.destination_well);
|
||||
log::debug!("{},{} {},{}", &c1[1], &c1[2], &c2[1], &c2[2]);
|
||||
|
||||
(
|
||||
(
|
||||
letters_to_num(&c1[1]).unwrap(),
|
||||
c1[2].parse::<u8>().unwrap(),
|
||||
),
|
||||
(
|
||||
letters_to_num(&c2[1]).unwrap(),
|
||||
c2[2].parse::<u8>().unwrap(),
|
||||
),
|
||||
string_well_to_pt(&record.source_well).unwrap(),
|
||||
string_well_to_pt(&record.destination_well).unwrap()
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
|
|
Loading…
Reference in New Issue