[BE][Scans] Fix UI error with certs with only DNI. Add unix timestamp to the names of the PDF generated
This commit is contained in:
parent
0fe2c53ffd
commit
811f60fa0e
@ -142,8 +142,7 @@ fn get_details_from_paths(paths: Vec<PathBuf>) -> Vec<(PathBuf, ScanInfo)> {
|
||||
fn get_image_info(path: PathBuf) -> ScanInfo {
|
||||
let img = image::open(&path).unwrap();
|
||||
|
||||
// get unix timestamp now
|
||||
// Get current time in seconds
|
||||
// get unix timestamp now in ms
|
||||
let current_time = SystemTime::now().duration_since(UNIX_EPOCH);
|
||||
let current_time = match current_time {
|
||||
Ok(t) => t,
|
||||
@ -250,7 +249,7 @@ async fn convert_scans_from_data(data: &Vec<(PathBuf, ScanInfo)>) -> Result<(),
|
||||
);
|
||||
|
||||
let register_id_list = ids.join(",");
|
||||
let person_dni_list = dnis.join("-");
|
||||
let person_dni_list = dnis.join(",");
|
||||
|
||||
log::info!("register_id_list: {}", register_id_list);
|
||||
log::info!("person_dni_list: {}", person_dni_list);
|
||||
@ -298,12 +297,23 @@ async fn convert_scans_from_data(data: &Vec<(PathBuf, ScanInfo)>) -> Result<(),
|
||||
}
|
||||
};
|
||||
|
||||
let current_time = SystemTime::now().duration_since(UNIX_EPOCH);
|
||||
let current_time = match current_time {
|
||||
Ok(t) => t,
|
||||
Err(err) => {
|
||||
log::error!("Error obteniendo hora actual: {:?}", err);
|
||||
continue;
|
||||
}
|
||||
};
|
||||
let current_ms = current_time.as_millis();
|
||||
|
||||
let filename = format!(
|
||||
"{} {} {} - {} [{:X}].pdf",
|
||||
"{} {} {} - {} [{}][{:X}].pdf",
|
||||
person_info.person_names,
|
||||
person_info.person_paternal_surname,
|
||||
person_info.person_maternal_surname,
|
||||
person_info.course_name,
|
||||
current_ms,
|
||||
person_info.register_id,
|
||||
);
|
||||
|
||||
|
@ -195,7 +195,7 @@ impl Register {
|
||||
select
|
||||
'' as 'course_name',
|
||||
0 as register_id,
|
||||
'' as person_dni,
|
||||
person.person_dni,
|
||||
person.person_names,
|
||||
person.person_paternal_surname,
|
||||
person.person_maternal_surname
|
||||
|
@ -23,7 +23,7 @@ function dataFromScanResult(result: ScanResult) {
|
||||
if ("Full" in result) {
|
||||
return `DNI: ${result.Full[0]}, iid: ${result.Full[1]}`;
|
||||
} else if ("Partial" in result) {
|
||||
return `DNI: ${result.Partial}`;
|
||||
return `DNI: ${result.Partial[0]}`;
|
||||
} else if ("Error" in result) {
|
||||
return `Error: ${result.Error}`;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user