From c19738a69c6744dc67d00588d1080b3d1301a436 Mon Sep 17 00:00:00 2001 From: "Blazej M. Baczkowski" Date: Sun, 2 Aug 2026 09:51:44 +0200 Subject: [PATCH] Fix resetting non-contiguous selected jobs - Replace a single min/max range request with one request per selected job. - Ensure only explicitly selected jobs are reset. - Keep the existing backend API unchanged. Relates to #259 --- .../ResetJobsDialog/ResetJobsDialog.vue | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/resources/components/Participants/dialogs/ResetJobsDialog/ResetJobsDialog.vue b/resources/components/Participants/dialogs/ResetJobsDialog/ResetJobsDialog.vue index 86261ec..3164dbb 100644 --- a/resources/components/Participants/dialogs/ResetJobsDialog/ResetJobsDialog.vue +++ b/resources/components/Participants/dialogs/ResetJobsDialog/ResetJobsDialog.vue @@ -184,21 +184,21 @@ export default { this.loading = true try { - const positions = this.dialogFinishedJobs - .filter(j => this.selectedJobs.includes(j.id)) - .map(j => j.position) + const selectedJobs = this.dialogFinishedJobs + .filter(job => this.selectedJobs.includes(job.id)) - const minPos = Math.min(...positions) - const maxPos = Math.max(...positions) - - await this.$axios.put( - `${API_PREFIX}/studies/${this.studyId}/jobs/state`, - { - from: minPos, - to: maxPos + 1, - state: 1, - participant: this.participant.identifier - } + await Promise.all( + selectedJobs.map(job => + this.$axios.put( + `${API_PREFIX}/studies/${this.studyId}/jobs/state`, + { + from: job.position, + to: job.position + 1, + state: 1, + participant: this.participant.identifier + } + ) + ) ) this.notify({