Skip to content

Commit

Permalink
feat: Simplify changePosition's code
Browse files Browse the repository at this point in the history
Signed-off-by: Michał Dziekoński <michal.dziekonski+github@gmail.com>
  • Loading branch information
mdziekon committed Dec 16, 2023
1 parent e6a3c33 commit 828677c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/store/server/jobQueue/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const actions: ActionTree<ServerJobQueueState, RootState> = {
const filenames: string[] = []
const jobs = getters['getJobs'] as ServerJobQueueStateJob[]

const jobToMoveIndex = jobs.findIndex((job: ServerJobQueueStateJob) => job.job_id === payload.job_id)
const jobToMoveIndex = jobs.findIndex((job) => job.job_id === payload.job_id)

if (jobToMoveIndex === -1) {
return
Expand All @@ -68,7 +68,7 @@ export const actions: ActionTree<ServerJobQueueState, RootState> = {
jobs.splice(jobToMoveIndex, 1)
jobs.splice(payload.positionIndex, 0, jobToMove)

jobs.forEach((job: ServerJobQueueStateJob) => {
jobs.forEach((job) => {
const count = (job.combinedIds?.length ?? 0) + 1
for (let i = 0; i < count; i++) {
filenames.push(job.filename)
Expand Down

0 comments on commit 828677c

Please sign in to comment.