Skip to content

Commit

Permalink
Fix issue with priority decrementing too much
Browse files Browse the repository at this point in the history
  • Loading branch information
HRemonen committed Aug 8, 2023
1 parent c37df42 commit fd868e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/client/components/Admin/EditSurvey/QuestionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ const QuestionItemPositionHandles = ({
const precedingChilds = questions.filter(
(q) => q.parentId === precedingQuestion.id
)
const priority = precedingChilds.length ? precedingChilds.length : 0

const priority = precedingChilds.length >= 1 ? precedingChilds.length : 0

const destination = {
parentId: precedingQuestion.id,
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ questionRouter.put('/:id/location', async (req: RequestWithUser, res: any) => {
where: {
parentId: question.parentId,
priority: {
[Op.gte]: question.priority,
[Op.gt]: question.priority,
},
},
})
Expand Down

0 comments on commit fd868e7

Please sign in to comment.