Fixed output path being nullable bug for downloads
This commit is contained in:
@@ -155,7 +155,7 @@ pub struct DownloadRecord {
|
||||
pub size: Number,
|
||||
#[derivative(Default(value = "Number::from(0)"))]
|
||||
pub sizeleft: Number,
|
||||
pub output_path: HorizontallyScrollableText,
|
||||
pub output_path: Option<HorizontallyScrollableText>,
|
||||
pub indexer: String,
|
||||
pub download_client: String,
|
||||
}
|
||||
|
||||
@@ -2197,7 +2197,9 @@ mod test {
|
||||
id: Number::from(1),
|
||||
size: Number::from(3543348019u64),
|
||||
sizeleft: Number::from(1771674009u64),
|
||||
output_path: HorizontallyScrollableText::from("/nfs/movies/Test".to_owned()),
|
||||
output_path: Some(HorizontallyScrollableText::from(
|
||||
"/nfs/movies/Test".to_owned(),
|
||||
)),
|
||||
indexer: "kickass torrents".to_owned(),
|
||||
download_client: "transmission".to_owned(),
|
||||
}
|
||||
|
||||
@@ -384,7 +384,8 @@ fn draw_downloads<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
|
||||
..
|
||||
} = download_record;
|
||||
|
||||
output_path.scroll_or_reset(get_width(area), current_selection == *download_record);
|
||||
let path = output_path.clone().unwrap_or_default();
|
||||
path.scroll_or_reset(get_width(area), current_selection == *download_record);
|
||||
|
||||
let percent = 1f64 - (sizeleft.as_f64().unwrap() / size.as_f64().unwrap());
|
||||
let file_size: f64 = convert_to_gb(size.as_u64().unwrap());
|
||||
@@ -393,7 +394,7 @@ fn draw_downloads<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
|
||||
Cell::from(title.to_owned()),
|
||||
Cell::from(format!("{:.0}%", percent * 100.0)),
|
||||
Cell::from(format!("{:.2} GB", file_size)),
|
||||
Cell::from(output_path.to_string()),
|
||||
Cell::from(path.to_string()),
|
||||
Cell::from(indexer.to_owned()),
|
||||
Cell::from(download_client.to_owned()),
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user