Skip to content

Commit 93dd156

Browse files
Merge pull request #2212 from laws-africa/comment-tasks
Tasks linked to annotations (comments) have code = 'comment'
2 parents 81fb621 + 5d0a5ba commit 93dd156

File tree

5 files changed

+28
-0
lines changed

5 files changed

+28
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Generated by Django 4.2.15 on 2024-08-28 06:40
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('indigo_api', '0041_citationalias'),
10+
]
11+
12+
operations = [
13+
migrations.RunSQL(
14+
"""
15+
UPDATE indigo_api_task
16+
SET code = 'comment'
17+
WHERE id IN (
18+
SELECT task_id
19+
FROM indigo_api_annotation
20+
)
21+
""",
22+
migrations.RunSQL.noop,
23+
),
24+
]

indigo_api/models/documents.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@ def create_task(self, user):
711711

712712
if not self.task:
713713
task = Task()
714+
task.code = 'comment'
714715
task.country = self.document.work.country
715716
task.locality = self.document.work.locality
716717
task.work = self.document.work

indigo_api/models/tasks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ class Task(models.Model):
102102
('check-update-primary', _('Check / update primary work')),
103103
('check-update-repeal', _('Check / update repeal')),
104104
('commences-on-date-missing', _("'Commences on' date missing")),
105+
('comment', _("Comment")),
105106
('link-amendment-active', _('Link amendment (active)')),
106107
('link-amendment-passive', _('Link amendment (passive)')),
107108
('link-amendment-pending-commencement', _('Link amendment (pending commencement)')),

indigo_api/serializers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ class Meta:
464464
fields = (
465465
'id',
466466
'title',
467+
'code',
467468
'description',
468469
'country',
469470
'locality',

indigo_api/tests/test_annotations_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ def test_create_annotation_task(self):
122122
assert_equal(response.status_code, 201)
123123
assert_equal(response.data['title'], '"Section 1.": hello')
124124
assert_equal(response.data['state'], 'open')
125+
assert_equal(response.data['code'], 'comment')
125126
assert_is_none(response.data.get('anchor_id'))
126127

127128
def test_create_annotation_task_anchor_missing(self):

0 commit comments

Comments
 (0)