This commit is contained in:
Emilia Allison 2024-08-11 11:47:53 -04:00
parent c6d3b86237
commit b25d1eb0c6
Signed by: emilia
GPG Key ID: 7A3F8997BFE894E0
8 changed files with 19 additions and 24 deletions

View File

@ -167,9 +167,7 @@ fn get_transfer_for_pair(
.filter(|x| x.source_plate == source_name && x.destination_plate == destination_name) .filter(|x| x.source_plate == source_name && x.destination_plate == destination_name)
.peekable(); .peekable();
if filtered_records.peek().is_none() { filtered_records.peek()?;
return None;
}
let mut source_wells: HashSet<Well> = HashSet::new(); let mut source_wells: HashSet<Well> = HashSet::new();
let mut destination_wells: HashSet<Well> = HashSet::new(); let mut destination_wells: HashSet<Well> = HashSet::new();

View File

@ -9,7 +9,7 @@
pub fn mangle_headers(data: &str) -> String { pub fn mangle_headers(data: &str) -> String {
let (header, rows) = data.split_at(data.find('\n').unwrap()); let (header, rows) = data.split_at(data.find('\n').unwrap());
let fields = header.trim().split(","); let fields = header.trim().split(',');
let mut modified_headers: Vec<String> = Vec::new(); let mut modified_headers: Vec<String> = Vec::new();
for field in fields { for field in fields {
if let Some(f) = detect_field(field) { if let Some(f) = detect_field(field) {

View File

@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{plate::PlateFormat, transfer::Transfer, util::num_to_letters}; use crate::{plate::PlateFormat, util::num_to_letters};
/// Represents a single line of a CSV picklist. /// Represents a single line of a CSV picklist.
/// In practice, this is generated from the deserialize intermediate. /// In practice, this is generated from the deserialize intermediate.

View File

@ -296,11 +296,11 @@ fn auto_callback(
Closure::<dyn FnMut(_)>::new(move |_| { Closure::<dyn FnMut(_)>::new(move |_| {
let res = auto(&records); let res = auto(&records);
main_dispatch.reduce_mut(|state| { main_dispatch.reduce_mut(|state| {
state.source_plates.extend(res.sources.into_iter()); state.source_plates.extend(res.sources);
state state
.destination_plates .destination_plates
.extend(res.destinations.into_iter()); .extend(res.destinations);
state.transfers.extend(res.transfers.into_iter()); state.transfers.extend(res.transfers);
}); });
}) })
} }

View File

@ -1,10 +1,9 @@
#![allow(non_snake_case)] #![allow(non_snake_case)]
use js_sys::Function;
use wasm_bindgen::{prelude::*, JsCast}; use wasm_bindgen::{prelude::*, JsCast};
use web_sys::{ use web_sys::{
FileReader, HtmlButtonElement, HtmlDialogElement, HtmlElement, HtmlFormElement, HtmlDialogElement, HtmlFormElement, HtmlOptionElement, HtmlSelectElement,
HtmlInputElement, HtmlOptionElement, HtmlSelectElement,
}; };
use yew::prelude::*; use yew::prelude::*;

View File

@ -1,8 +1,8 @@
use plate_tool_lib::{plate::PlateType, plate_instances::PlateInstance}; use plate_tool_lib::{plate::PlateType};
use uuid::Uuid; use uuid::Uuid;
use wasm_bindgen::{prelude::*, JsCast}; use wasm_bindgen::{prelude::*, JsCast};
use web_sys::{ use web_sys::{
HtmlDialogElement, HtmlElement, HtmlFormElement, HtmlInputElement, HtmlOptionElement, HtmlDialogElement, HtmlElement, HtmlOptionElement,
HtmlSelectElement, HtmlSelectElement,
}; };
@ -203,7 +203,7 @@ fn find_plate_type(main_dispatch: Dispatch<MainState>, id: Uuid) -> Option<Plate
.iter() .iter()
.any(|x| x.get_uuid() == id) .any(|x| x.get_uuid() == id)
{ {
return Some(PlateType::Source); Some(PlateType::Source)
} else if main_dispatch } else if main_dispatch
.get() .get()
.destination_plates .destination_plates

View File

@ -1,8 +1,8 @@
#![allow(non_snake_case)] #![allow(non_snake_case)]
use std::collections::HashMap; use std::collections::HashMap;
use std::ops::Deref;
use plate_tool_lib::transfer_region::TransferRegion;
use plate_tool_lib::transfer_volume::TransferVolume; use plate_tool_lib::transfer_volume::TransferVolume;
use yew::prelude::*; use yew::prelude::*;
use yewdux::prelude::*; use yewdux::prelude::*;
@ -281,7 +281,7 @@ fn count_plate_usage(transfer: &Transfer, well: &Well) -> Option<u32> {
} }
let map = transfer.transfer_region.calculate_map(); let map = transfer.transfer_region.calculate_map();
map(*well).and_then(|list| Some(list.len() as u32)) map(*well).map(|list| list.len() as u32)
} }
#[cfg(test)] #[cfg(test)]

View File

@ -2,12 +2,12 @@
use plate_tool_lib::plate::PlateFormat; use plate_tool_lib::plate::PlateFormat;
use uuid::Uuid; use uuid::Uuid;
use wasm_bindgen::JsCast;
use web_sys::{HtmlDialogElement, HtmlInputElement}; use web_sys::{HtmlDialogElement};
use yew::prelude::*; use yew::prelude::*;
use yewdux::prelude::*; use yewdux::prelude::*;
use crate::components::callbacks::{main_window_callbacks, tree_callbacks}; use crate::components::callbacks::{tree_callbacks};
use crate::components::new_plate_dialog::NewPlateDialogType; use crate::components::new_plate_dialog::NewPlateDialogType;
use crate::components::states::{CurrentTransfer, MainState}; use crate::components::states::{CurrentTransfer, MainState};
@ -164,16 +164,14 @@ fn PlateInfoModal(props: &PlateInfoModalProps) -> Html {
None => "Not Found".to_string(), None => "Not Found".to_string(),
}; };
let plate_format = plate.map(|p| p.plate.plate_format); let plate_format = plate.map(|p| p.plate.plate_format);
let plate_formats = vec![ let plate_formats = [PlateFormat::W6,
PlateFormat::W6,
PlateFormat::W12, PlateFormat::W12,
PlateFormat::W24, PlateFormat::W24,
PlateFormat::W48, PlateFormat::W48,
PlateFormat::W96, PlateFormat::W96,
PlateFormat::W384, PlateFormat::W384,
PlateFormat::W1536, PlateFormat::W1536,
PlateFormat::W3456, PlateFormat::W3456];
];
let plate_format_options = plate_formats.iter().map(|v| { let plate_format_options = plate_formats.iter().map(|v| {
let selected = Some(v) == plate_format.as_ref(); let selected = Some(v) == plate_format.as_ref();
html! { html! {