Skip to content

Commit

Permalink
fix: Task 0 being selected for restarted
Browse files Browse the repository at this point in the history
  • Loading branch information
Nukesor committed Jan 11, 2025
1 parent 1ff5ce4 commit e713f98
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pueue/src/client/commands/restart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ pub async fn restart(
// Filter to get done tasks
let done_filter = |task: &Task| task.is_done();

// If all failed tasks or all failed tasks from a specific group are requested,
// determine the ids of those failed tasks.
//
// Otherwise, use the provided ids and check which of them were "Done" (successful or failed tasks).
let filtered_tasks = if all_failed || failed_in_group.is_some() {
// Either all failed tasks or all failed tasks of a specific group need to be restarted.

Expand Down Expand Up @@ -91,7 +95,7 @@ pub async fn restart(
let mut tasks: Vec<Task> = filtered_tasks
.matching_ids
.iter()
.map(|task_id| Task::from_task(state.tasks.get(task_id).unwrap()))
.map(|task_id| state.tasks.get(task_id).unwrap().clone())
.collect();

// If the tasks should be edited, edit them in one go.
Expand Down
1 change: 0 additions & 1 deletion pueue_lib/src/network/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ impl From<&Task> for EditableTask {
impl EditableTask {
/// Merge a [EditableTask] back into a [Task].
pub fn into_task(self, task: &mut Task) {
task.id = self.id;
task.command = self.command;
task.path = self.path;
task.label = self.label;
Expand Down

0 comments on commit e713f98

Please sign in to comment.