Repository: liqd/a4-meinberlin

Issue:
delete old poll tables (one deployment after release v2107)
**URL:** 
**user:** 
**expected behaviour:** 
**behaviour:** 
**important screensize:**
**device & browser:** 
**Comment/Question:** We copied the content of the mB poll tables to the a4 poll tables and are now using the tables from a4. If everything went well with the deployment, we should drop the old mB poll tables.

Screenshot?



Discussion:
@Rineee I am not sure, I am brave enough to delete the tables with the next release already. On the other hand, it doesn't make any sense to keep them. What do you think?
@fuzzylogic2000 I think we should delete them with next release, otherwise it might never happen :see_no_evil: :muscle: !
@Rineee  True! Will do!

Resolving patch:
diff --git a/meinberlin/apps/polls/migrations/0007_remove_choice_question_vote.py b/meinberlin/apps/polls/migrations/0007_remove_choice_question_vote.py
new file mode 100644
--- /dev/null
+++ b/meinberlin/apps/polls/migrations/0007_remove_choice_question_vote.py
@@ -0,0 +1,34 @@
+# Generated by Django 2.2.24 on 2021-09-01 07:42
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('meinberlin_polls', '0006_copy_poll_data_to_a4_polls'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='mbquestion',
+            name='poll',
+        ),
+        migrations.RemoveField(
+            model_name='mbvote',
+            name='choice',
+        ),
+        migrations.RemoveField(
+            model_name='mbvote',
+            name='creator',
+        ),
+        migrations.DeleteModel(
+            name='MBChoice',
+        ),
+        migrations.DeleteModel(
+            name='MBQuestion',
+        ),
+        migrations.DeleteModel(
+            name='MBVote',
+        ),
+    ]
diff --git a/meinberlin/apps/polls/migrations/0008_delete_mbpoll.py b/meinberlin/apps/polls/migrations/0008_delete_mbpoll.py
new file mode 100644
--- /dev/null
+++ b/meinberlin/apps/polls/migrations/0008_delete_mbpoll.py
@@ -0,0 +1,16 @@
+# Generated by Django 2.2.24 on 2021-09-01 07:43
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('meinberlin_polls', '0007_remove_choice_question_vote'),
+    ]
+
+    operations = [
+        migrations.DeleteModel(
+            name='MBPoll',
+        ),
+    ]
diff --git a/meinberlin/apps/polls/models.py b/meinberlin/apps/polls/models.py
deleted file mode 100644
--- a/meinberlin/apps/polls/models.py
+++ /dev/null
@@ -1,110 +0,0 @@
-from django.contrib.contenttypes.fields import GenericRelation
-from django.db import models
-
-from adhocracy4.comments import models as comment_models
-from adhocracy4.models.base import UserGeneratedContentModel
-from adhocracy4.modules import models as module_models
-
-
-class QuestionQuerySet(models.QuerySet):
-    def annotate_vote_count(self):
-        return self.annotate(
-            vote_count=models.Count(
-                'choices__votes__creator_id',
-                distinct=True)).annotate(
-            vote_count_multi=models.Count(
-                'choices__votes',
-                distinct=True))
-
-
-class ChoiceQuerySet(models.QuerySet):
-    def annotate_vote_count(self):
-        return self.annotate(
-            vote_count=models.Count(
-                'votes'
-            )
-        )
-
-
-class MBPoll(module_models.Item):
-    comments = GenericRelation(comment_models.Comment,
-                               related_query_name='+',
-                               object_id_field='object_pk')
-
-    def get_absolute_url(self):
-        return self.project.get_absolute_url()
-
-
-class MBQuestion(models.Model):
-    label = models.CharField(max_length=255)
-    weight = models.SmallIntegerField()
-    multiple_choice = models.BooleanField(default=False)
-
-    poll = models.ForeignKey(
-        MBPoll,
-        on_delete=models.CASCADE,
-        related_name='questions'
-    )
-
-    objects = QuestionQuerySet.as_manager()
-
-    def user_choices_list(self, user):
-        if not user.is_authenticated:
-            return []
-
-        return self.choices\
-            .filter(votes__creator=user)\
-            .values_list('id', flat=True)
-
-    def get_absolute_url(self):
-        return self.poll.get_absolute_url()
-
-    def __str__(self):
-        return self.label
-
-    class Meta:
-        ordering = ['weight']
-
-
-class MBChoice(models.Model):
-    label = models.CharField(max_length=255)
-
-    question = models.ForeignKey(
-        MBQuestion,
-        on_delete=models.CASCADE,
-        related_name='choices',
-    )
-
-    objects = ChoiceQuerySet.as_manager()
-
-    def get_absolute_url(self):
-        return self.question.poll.get_absolute_url()
-
-    def __str__(self):
-        return '%s @%s' % (self.label, self.question)
-
-    class Meta:
-        ordering = ['id']
-
-
-class MBVote(UserGeneratedContentModel):
-    choice = models.ForeignKey(
-        MBChoice,
-        on_delete=models.CASCADE,
-        related_name='votes'
-    )
-
-    # Make Vote instances behave like items for rule checking
-    @property
-    def module(self):
-        return self.choice.question.poll.module
-
-    @property
-    def project(self):
-        return self.module.project
-
-    def get_absolute_url(self):
-        return self.choice.question.poll.get_absolute_url()
-
-    def __str__(self):
-        return '%s: %s' % (self.creator, self.choice)


Test patch: