Repository: liqd/adhocracy4

Issue:
Poll cannot change order of questions 
Poll: after moving a question in the dashboard and saving, the question moves back to it's original position.
NOTE: flip-move lib still working in documents, may require a poll refactor

https://github.com/liqd/adhocracy-plus/issues/1964
https://github.com/liqd/a4-meinberlin/issues/4370



Discussion:

Resolving patch:
diff --git a/adhocracy4/polls/models.py b/adhocracy4/polls/models.py
--- a/adhocracy4/polls/models.py
+++ b/adhocracy4/polls/models.py
@@ -21,7 +21,7 @@ def annotate_vote_count(self):
             answer_count=models.Count(
                 'answers__creator_id',
                 distinct=True),
-        )
+        ).order_by('weight')
 
 
 class ChoiceQuerySet(models.QuerySet):


Test patch:
diff --git a/adhocracy4/polls/assets/__tests__/CharCounter.jest.jsx b/adhocracy4/polls/assets/__tests__/CharCounter.jest.jsx
--- a/adhocracy4/polls/assets/__tests__/CharCounter.jest.jsx
+++ b/adhocracy4/polls/assets/__tests__/CharCounter.jest.jsx
@@ -3,7 +3,7 @@ import React from 'react'
 import { render } from '@testing-library/react'
 
 // component and related data to be tested
-import { CharCounter } from '../CharCounter'
+import { CharCounter } from '../PollDetail/CharCounter'
 
 test('<CharCounter> component renders correctly', () => {
   const tree = render(<CharCounter value="random" max={25} />)
diff --git a/adhocracy4/polls/assets/__tests__/EditPollChoice.jest.jsx b/adhocracy4/polls/assets/__tests__/EditPollChoice.jest.jsx
--- a/adhocracy4/polls/assets/__tests__/EditPollChoice.jest.jsx
+++ b/adhocracy4/polls/assets/__tests__/EditPollChoice.jest.jsx
@@ -3,7 +3,7 @@ import React from 'react'
 import { render, fireEvent } from '@testing-library/react'
 
 // component and related data to be tested
-import { EditPollChoice } from '../EditPollChoice.jsx'
+import { EditPollChoice } from '../PollDashboard/EditPollChoice.jsx'
 
 const CHOICE_OBJECT = {
   id: 1,
diff --git a/adhocracy4/polls/assets/__tests__/EditPollOpenQuestion.jest.jsx b/adhocracy4/polls/assets/__tests__/EditPollOpenQuestion.jest.jsx
--- a/adhocracy4/polls/assets/__tests__/EditPollOpenQuestion.jest.jsx
+++ b/adhocracy4/polls/assets/__tests__/EditPollOpenQuestion.jest.jsx
@@ -3,7 +3,7 @@ import React from 'react'
 import { render, fireEvent } from '@testing-library/react'
 
 // component and related data to be tested
-import { EditPollOpenQuestion } from '../EditPollOpenQuestion.jsx'
+import { EditPollOpenQuestion } from '../PollDashboard/EditPollOpenQuestion.jsx'
 import { QUESTION_OBJECT } from './__testdata__/QUESTION_OBJECT'
 
 describe('<EditPollOpenQuestion> with...', () => {
diff --git a/adhocracy4/polls/assets/__tests__/EditPollQuestion.jest.jsx b/adhocracy4/polls/assets/__tests__/EditPollQuestion.jest.jsx
--- a/adhocracy4/polls/assets/__tests__/EditPollQuestion.jest.jsx
+++ b/adhocracy4/polls/assets/__tests__/EditPollQuestion.jest.jsx
@@ -3,7 +3,7 @@ import React from 'react'
 import { render, fireEvent } from '@testing-library/react'
 
 // component and related data to be tested
-import { EditPollQuestion } from '../EditPollQuestion.jsx'
+import { EditPollQuestion } from '../PollDashboard/EditPollQuestion.jsx'
 import { QUESTION_OBJECT } from './__testdata__/QUESTION_OBJECT'
 
 describe('<EditPollQuestion> with...', () => {
diff --git a/adhocracy4/polls/assets/__tests__/PollQuestion.jest.jsx b/adhocracy4/polls/assets/__tests__/PollQuestion.jest.jsx
--- a/adhocracy4/polls/assets/__tests__/PollQuestion.jest.jsx
+++ b/adhocracy4/polls/assets/__tests__/PollQuestion.jest.jsx
@@ -3,7 +3,7 @@ import React from 'react'
 import { render, fireEvent } from '@testing-library/react'
 
 // component and related data to be tested
-import { PollQuestion } from '../PollQuestion.jsx'
+import { PollQuestion } from '../PollDetail/PollQuestion.jsx'
 import { QUESTION_OBJECT } from './__testdata__/QUESTION_OBJECT'
 
 describe('render <PollQuestion> with...', () => {