jobs can also have indeterminate progress

feat/vaults
Tomáš Mládek 2022-02-19 16:31:51 +01:00
parent 7a05c69d40
commit 5a393b4ec0
No known key found for this signature in database
GPG Key ID: 65E225C8B3E2ED8A
1 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,7 @@ use uuid::Uuid;
pub struct Job {
pub job_type: Option<JobType>,
pub title: String,
pub progress: f32,
pub progress: Option<f32>,
pub state: State,
}
@ -94,7 +94,7 @@ impl JobContainer {
pub fn update_progress(&mut self, id: &JobId, progress: f32) -> Result<()> {
if let Some(job) = self.jobs.get_mut(id) {
job.progress = progress;
job.progress = Some(progress);
if progress >= 100.0 {
job.state = State::Done;
}