Commit f918f53d authored by Damien Lespiau's avatar Damien Lespiau
Browse files

series: Add a state field to revisions



We want to have a state in series/revision so we make the difference
between series in progress and series done.
Signed-off-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
parent f582afee
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('patchwork', '0019_eventlog_patch'),
]
operations = [
migrations.AddField(
model_name='seriesrevision',
name='state',
field=models.SmallIntegerField(default=0, choices=[(0, b'incomplete'), (1, b'initial'), (2, b'in progress'), (3, b'done')]),
),
migrations.AddField(
model_name='seriesrevision',
name='state_summary',
field=jsonfield.fields.JSONField(null=True),
),
]
......@@ -584,6 +584,24 @@ class Series(models.Model):
# its patches)
series_revision_complete = django.dispatch.Signal(providing_args=["revision"])
class RevisionState:
INCOMPLETE = 0
INITIAL = 1
IN_PROGRESS = 2
DONE = 3
CHOICES = (
(INCOMPLETE, 'incomplete'),
(INITIAL, 'initial'),
(IN_PROGRESS, 'in progress'),
(DONE, 'done'),
)
@classmethod
def from_string(cls, s):
s2i = {s: i for i, s in cls.CHOICES}
return s2i[s]
# A 'revision' of a series. Resending a new version of a patch or a full new
# iteration of a series will create a new revision.
......@@ -596,6 +614,9 @@ class SeriesRevision(models.Model):
cover_letter = models.TextField(null=True, blank=True)
n_patches = models.IntegerField(default=0)
patches = models.ManyToManyField(Patch, through='SeriesRevisionPatch')
state = models.SmallIntegerField(choices=RevisionState.CHOICES,
default=RevisionState.INCOMPLETE)
state_summary = jsonfield.JSONField(null=True)
test_state = models.SmallIntegerField(choices=TestState.STATE_CHOICES,
null=True)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment