Compare commits
	
		
			No commits in common. "5e1137c46050d6d1d10fb1cbf842d5efd455f926" and "11a561c1d447e1376e58f970f74d0778e8ed1722" have entirely different histories.
		
	
	
		
			5e1137c460
			...
			11a561c1d4
		
	
		| 
						 | 
					@ -34,12 +34,6 @@ dependencies = [
 | 
				
			||||||
 "syn 2.0.16",
 | 
					 "syn 2.0.16",
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					 | 
				
			||||||
name = "atomic"
 | 
					 | 
				
			||||||
version = "0.5.3"
 | 
					 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					 | 
				
			||||||
checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "autocfg"
 | 
					name = "autocfg"
 | 
				
			||||||
version = "1.1.0"
 | 
					version = "1.1.0"
 | 
				
			||||||
| 
						 | 
					@ -891,11 +885,10 @@ checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "uuid"
 | 
					name = "uuid"
 | 
				
			||||||
version = "1.6.1"
 | 
					version = "1.3.3"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560"
 | 
					checksum = "345444e32442451b267fc254ae85a209c64be56d2890e601a0c37ff0c3c5ecd2"
 | 
				
			||||||
dependencies = [
 | 
					dependencies = [
 | 
				
			||||||
 "atomic",
 | 
					 | 
				
			||||||
 "getrandom",
 | 
					 "getrandom",
 | 
				
			||||||
 "rand",
 | 
					 "rand",
 | 
				
			||||||
 "serde",
 | 
					 "serde",
 | 
				
			||||||
| 
						 | 
					@ -905,9 +898,9 @@ dependencies = [
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "uuid-macro-internal"
 | 
					name = "uuid-macro-internal"
 | 
				
			||||||
version = "1.6.1"
 | 
					version = "1.3.3"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "f49e7f3f3db8040a100710a11932239fd30697115e2ba4107080d8252939845e"
 | 
					checksum = "3f67b459f42af2e6e1ee213cb9da4dbd022d3320788c3fb3e1b893093f1e45da"
 | 
				
			||||||
dependencies = [
 | 
					dependencies = [
 | 
				
			||||||
 "proc-macro2",
 | 
					 "proc-macro2",
 | 
				
			||||||
 "quote",
 | 
					 "quote",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,7 +18,7 @@ log = "0.4"
 | 
				
			||||||
wasm-logger = "0.2"
 | 
					wasm-logger = "0.2"
 | 
				
			||||||
regex = "1"
 | 
					regex = "1"
 | 
				
			||||||
lazy_static = "1.4"
 | 
					lazy_static = "1.4"
 | 
				
			||||||
uuid = { version = "1.6", features = ["v7", "fast-rng", "macro-diagnostics", "js", "serde"] }
 | 
					uuid = { version = "1.3", features = ["v4", "fast-rng", "macro-diagnostics", "js", "serde"] }
 | 
				
			||||||
serde = { version = "1.0", features = ["derive"] }
 | 
					serde = { version = "1.0", features = ["derive"] }
 | 
				
			||||||
serde_json = "1.0"
 | 
					serde_json = "1.0"
 | 
				
			||||||
csv = "1.2"
 | 
					csv = "1.2"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,14 +41,6 @@ pub fn DestinationPlate(props: &DestinationPlateProps) -> Html {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    let destination_wells = ct_state.transfer.transfer_region.get_destination_wells();
 | 
					    let destination_wells = ct_state.transfer.transfer_region.get_destination_wells();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let ordered_ids: Vec<uuid::Uuid> = {
 | 
					 | 
				
			||||||
        let mut ids: Vec<uuid::Uuid> = main_state.transfers.clone().iter()
 | 
					 | 
				
			||||||
        .map(|x| x.id)
 | 
					 | 
				
			||||||
        .collect();
 | 
					 | 
				
			||||||
        ids.sort_unstable();
 | 
					 | 
				
			||||||
        ids
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    let mouse_callback = {
 | 
					    let mouse_callback = {
 | 
				
			||||||
        let m_start_handle = m_start_handle.clone();
 | 
					        let m_start_handle = m_start_handle.clone();
 | 
				
			||||||
        let m_end_handle = m_end_handle.clone();
 | 
					        let m_end_handle = m_end_handle.clone();
 | 
				
			||||||
| 
						 | 
					@ -126,7 +118,7 @@ pub fn DestinationPlate(props: &DestinationPlateProps) -> Html {
 | 
				
			||||||
                in_transfer={destination_wells.contains(&(i,j))}
 | 
					                in_transfer={destination_wells.contains(&(i,j))}
 | 
				
			||||||
                color={transfer_map.get(&(i,j))
 | 
					                color={transfer_map.get(&(i,j))
 | 
				
			||||||
                    .and_then(|t| t.last())
 | 
					                    .and_then(|t| t.last())
 | 
				
			||||||
                    .map(|t| PALETTE.get_ordered(t.get_uuid(), &ordered_ids))
 | 
					                    .map(|t| PALETTE.get_uuid(t.get_uuid()))
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                cell_height={props.cell_height}
 | 
					                cell_height={props.cell_height}
 | 
				
			||||||
                title={transfer_map.get(&(i,j)).map(|transfers| format!("Used by: {}", transfers.iter().map(|t| t.name.clone())
 | 
					                title={transfer_map.get(&(i,j)).map(|transfers| format!("Used by: {}", transfers.iter().map(|t| t.name.clone())
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -61,14 +61,6 @@ pub fn SourcePlate(props: &SourcePlateProps) -> Html {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let source_wells = ct_state.transfer.transfer_region.get_source_wells();
 | 
					    let source_wells = ct_state.transfer.transfer_region.get_source_wells();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let ordered_ids: Vec<uuid::Uuid> = {
 | 
					 | 
				
			||||||
        let mut ids: Vec<uuid::Uuid> = main_state.transfers.clone().iter()
 | 
					 | 
				
			||||||
        .map(|x| x.id)
 | 
					 | 
				
			||||||
        .collect();
 | 
					 | 
				
			||||||
        ids.sort_unstable();
 | 
					 | 
				
			||||||
        ids
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    let mouse_callback = {
 | 
					    let mouse_callback = {
 | 
				
			||||||
        let m_start_handle = m_start_handle.clone();
 | 
					        let m_start_handle = m_start_handle.clone();
 | 
				
			||||||
        let m_end_handle = m_end_handle.clone();
 | 
					        let m_end_handle = m_end_handle.clone();
 | 
				
			||||||
| 
						 | 
					@ -130,7 +122,7 @@ pub fn SourcePlate(props: &SourcePlateProps) -> Html {
 | 
				
			||||||
                        in_transfer={source_wells.contains(&(i,j))}
 | 
					                        in_transfer={source_wells.contains(&(i,j))}
 | 
				
			||||||
                        color={transfer_map.get(&(i,j))
 | 
					                        color={transfer_map.get(&(i,j))
 | 
				
			||||||
                            .and_then(|t| t.last())
 | 
					                            .and_then(|t| t.last())
 | 
				
			||||||
                            .map(|t| PALETTE.get_ordered(t.get_uuid(), &ordered_ids))
 | 
					                            .map(|t| PALETTE.get_uuid(t.get_uuid()))
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        cell_height={props.cell_height}
 | 
					                        cell_height={props.cell_height}
 | 
				
			||||||
                        title={transfer_map.get(&(i,j)).map(|transfers| format!("Used by: {}", transfers.iter().map(|t| t.name.clone())
 | 
					                        title={transfer_map.get(&(i,j)).map(|transfers| format!("Used by: {}", transfers.iter().map(|t| t.name.clone())
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,23 +35,10 @@ impl ColorPalette {
 | 
				
			||||||
        self.get((2f64.powi(-(t.ilog2() as i32))) * (t as f64 + 0.5f64) - 1.0f64)
 | 
					        self.get((2f64.powi(-(t.ilog2() as i32))) * (t as f64 + 0.5f64) - 1.0f64)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // pub fn get_uuid(&self, t: uuid::Uuid) -> [f64; 3] {
 | 
					    pub fn get_uuid(&self, t: uuid::Uuid) -> [f64; 3] {
 | 
				
			||||||
    //     // self.get(t.as_u128() as f64 / (u128::MAX) as f64)
 | 
					        // self.get(t.as_u128() as f64 / (u128::MAX) as f64)
 | 
				
			||||||
    //     let mut r = SmallRng::seed_from_u64(t.as_u128() as u64);
 | 
					        let mut r = SmallRng::seed_from_u64(t.as_u128() as u64);
 | 
				
			||||||
    //     self.get(r.gen_range(0.0..1.0f64))
 | 
					        self.get(r.gen_range(0.0..1.0f64))
 | 
				
			||||||
    // }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    pub fn get_ordered(&self, t: uuid::Uuid, ordered_uuids: &Vec<uuid::Uuid>)
 | 
					 | 
				
			||||||
        -> [f64; 3] {
 | 
					 | 
				
			||||||
        let index = ordered_uuids.iter().position(|&x| x == t).expect("uuid must be in list of uuids") + 1;
 | 
					 | 
				
			||||||
        return self.get(Self::space_evenly(index))
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    fn space_evenly(x: usize) -> f64 {
 | 
					 | 
				
			||||||
        let e: usize = (x.ilog2() + 1) as usize;
 | 
					 | 
				
			||||||
        let d: usize = (2usize.pow(e as u32)) as usize;
 | 
					 | 
				
			||||||
        let n: usize = (2*x + 1) % d;
 | 
					 | 
				
			||||||
        return (n as f64) / (d as f64);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,8 +5,6 @@ use uuid::Uuid;
 | 
				
			||||||
#[derive(PartialEq, Clone, Serialize, Deserialize)]
 | 
					#[derive(PartialEq, Clone, Serialize, Deserialize)]
 | 
				
			||||||
pub struct PlateInstance {
 | 
					pub struct PlateInstance {
 | 
				
			||||||
    pub plate: Plate,
 | 
					    pub plate: Plate,
 | 
				
			||||||
    #[serde(rename = "id_v7")]
 | 
					 | 
				
			||||||
    #[serde(default = "Uuid::now_v7")]
 | 
					 | 
				
			||||||
    id: Uuid,
 | 
					    id: Uuid,
 | 
				
			||||||
    pub name: String,
 | 
					    pub name: String,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -18,7 +16,7 @@ impl PlateInstance {
 | 
				
			||||||
                plate_type: sort,
 | 
					                plate_type: sort,
 | 
				
			||||||
                plate_format: format,
 | 
					                plate_format: format,
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            id: Uuid::now_v7(),
 | 
					            id: Uuid::new_v4(),
 | 
				
			||||||
            name,
 | 
					            name,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -36,7 +34,7 @@ impl From<Plate> for PlateInstance {
 | 
				
			||||||
    fn from(value: Plate) -> Self {
 | 
					    fn from(value: Plate) -> Self {
 | 
				
			||||||
        PlateInstance {
 | 
					        PlateInstance {
 | 
				
			||||||
            plate: value,
 | 
					            plate: value,
 | 
				
			||||||
            id: Uuid::now_v7(),
 | 
					            id: Uuid::new_v4(),
 | 
				
			||||||
            name: "New Plate".to_string(),
 | 
					            name: "New Plate".to_string(),
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,9 +10,7 @@ pub struct Transfer {
 | 
				
			||||||
    pub source_id: Uuid,
 | 
					    pub source_id: Uuid,
 | 
				
			||||||
    pub dest_id: Uuid,
 | 
					    pub dest_id: Uuid,
 | 
				
			||||||
    pub name: String,
 | 
					    pub name: String,
 | 
				
			||||||
    #[serde(rename = "id_v7")]
 | 
					    id: Uuid,
 | 
				
			||||||
    #[serde(default = "Uuid::now_v7")]
 | 
					 | 
				
			||||||
    pub id: Uuid,
 | 
					 | 
				
			||||||
    pub transfer_region: TransferRegion,
 | 
					    pub transfer_region: TransferRegion,
 | 
				
			||||||
    #[serde(default = "default_volume")]
 | 
					    #[serde(default = "default_volume")]
 | 
				
			||||||
    pub volume: f32,
 | 
					    pub volume: f32,
 | 
				
			||||||
| 
						 | 
					@ -46,7 +44,7 @@ impl Transfer {
 | 
				
			||||||
            source_id: source.get_uuid(),
 | 
					            source_id: source.get_uuid(),
 | 
				
			||||||
            dest_id: dest.get_uuid(),
 | 
					            dest_id: dest.get_uuid(),
 | 
				
			||||||
            name,
 | 
					            name,
 | 
				
			||||||
            id: Uuid::now_v7(),
 | 
					            id: Uuid::new_v4(),
 | 
				
			||||||
            transfer_region: tr,
 | 
					            transfer_region: tr,
 | 
				
			||||||
            volume: 2.5,
 | 
					            volume: 2.5,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue