From cb640407b6ecf165ce4115c59adc46a2c0c09b8b Mon Sep 17 00:00:00 2001 From: pablohashescobar Date: Tue, 13 Dec 2022 23:20:43 +0530 Subject: [PATCH] feat: group states into predefined state types --- apiserver/plane/api/views/project.py | 10 ++++------ apiserver/plane/db/models/state.py | 10 ++++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/apiserver/plane/api/views/project.py b/apiserver/plane/api/views/project.py index 081371984..611ec05da 100644 --- a/apiserver/plane/api/views/project.py +++ b/apiserver/plane/api/views/project.py @@ -90,12 +90,10 @@ class ProjectViewSet(BaseViewSet): ## Default states states = [ - {"name": "Backlog", "color": "#5e6ad2", "sequence": 15000}, - {"name": "ToDo", "color": "#eb5757", "sequence": 25000}, - {"name": "Started", "color": "#26b5ce", "sequence": 35000}, - {"name": "InProgress", "color": "#f2c94c", "sequence": 45000}, - {"name": "Done", "color": "#4cb782", "sequence": 55000}, - {"name": "Cancelled", "color": "#cc1d10", "sequence": 65000}, + {"name": "Todo", "color": "#eb5757", "sequence": 25000}, + {"name": "In Progress", "color": "#26b5ce", "sequence": 35000}, + {"name": "Done", "color": "#f2c94c", "sequence": 45000}, + {"name": "Cancelled", "color": "#4cb782", "sequence": 55000}, ] State.objects.bulk_create( diff --git a/apiserver/plane/db/models/state.py b/apiserver/plane/db/models/state.py index 42142364f..dd1223394 100644 --- a/apiserver/plane/db/models/state.py +++ b/apiserver/plane/db/models/state.py @@ -12,6 +12,16 @@ class State(ProjectBaseModel): color = models.CharField(max_length=255, verbose_name="State Color") slug = models.SlugField(max_length=100, blank=True) sequence = models.FloatField(default=65535) + group = models.CharField( + choices=( + ("backlog", "Backlog"), + ("unstarted", "Unstarted"), + ("started", "Started"), + ("completed", "Completed"), + ("cancelled", "Cancelled"), + ), + default="backlog", + ) def __str__(self): """Return name of the state"""