Would it make sense to use models.IntegerField and change these values
from strings to integers. I think that would then allow you do
eventually have logic like:
if ticket.status < Ticket.IMAGE_BUILD_DONE:
print("No image available for ticket")
I'd define these status as multiples of 10 like:
PKG_BUILD_WAITING = 0
PKG_BUILD_INPROGRESS = 10
because I could forsee a day when we might need new steps in the process.
This feels like we might not have a relation defined properly. It seems
like an Artifact shouldn't need the "ticket_component" attribute. I
think a SubTicket has a SourcePackageUpload which has artifacts. So
adding this ticket_component here feels like something isn't properly
normalized. I'm not sure the intent but it seems like it should be one
of these options:
= 1 ======
You add to SourcePackageUpload:
subticket = models.ForeignKey(SubTicket)
Remove the the "ticket_component" attribute from Artifact.
The drawback here, is that a SubTicket could have more than
SourcePackageUploads. Maybe a OneToOneField is needed instead?
= 2 =====
You don't need a SourcePackage upload class. You just make
"source_package" and "source_package_version" as attributes to
SubTicket. Then Arfifact just has a foreign key to SubTicket.
= 3 =====
This is already correct, and I'm missing something.
On 12/10/2013 01:23 PM, Chris Johnston wrote:
> Chris Johnston has proposed merging lp:~cjohnston/ubuntu-ci-services-itself/ts-ticket-models into lp:ubuntu-ci-services-itself.
> === added file 'ticket_ system/ ticket/ models. py'
> +class Ticket( models. Model): BUILDING" , "Package building"), PUBLISHING" , "Package publishing"), STEP_STATUSES = ( WAITING" , "Not started"), INPROGRESS" , "In progress"), FAILED" , "Failed"), BUILD_WAITING" , "Not started"), BUILD_INPROGRES S", "In progress"), BUILD_DONE" , "Completed"), BUILD_FAILED" , "Failed"), TESTS_WAITING" , "Not started"), TESTS_INPROGRES S", "In progress"), TESTS_PASSED" , "Passed"), TESTS_FAILED" , "Failed"), G_DONE" , "Completed"), G_FAILED" , "Failed"),
> + class Meta:
> + db_table = 'ticket'
> +
> + WORKFLOW_STEPS = (
> + ("PACKAGE_
> + ("IMAGE_BUILDING", "Image building"),
> + ("IMAGE_TESTING", "Image testing"),
> + ("PACKAGE_
> + )
> + WORKFLOW_
> + ("PKG_BUILD_
> + ("PKG_BUILD_
> + ("PKG_BUILD_DONE", "Completed"),
> + ("PKG_BUILD_
> + ("IMAGE_
> + ("IMAGE_
> + ("IMAGE_
> + ("IMAGE_
> + ("IMAGE_
> + ("IMAGE_
> + ("IMAGE_
> + ("IMAGE_
> + ("PKG_PUBLISHIN
> + ("PKG_PUBLISHIN
> + )
> + current_ workflow_ step = models. CharField( choices= WORKFLOW_ STEPS, CharField( choices= WORKFLOW_ STEP_STATUSES,
> + max_length=4096)
> + status = models.
> + max_length=4096)
Would it make sense to use models.IntegerField and change these values
from strings to integers. I think that would then allow you do
eventually have logic like:
if ticket.status < Ticket. IMAGE_BUILD_ DONE:
print("No image available for ticket")
I'd define these status as multiples of 10 like: BUILD_WAITING = 0 BUILD_INPROGRES S = 10
PKG_
PKG_
because I could forsee a day when we might need new steps in the process.
> +class SourcePackageUp load(models. Model): pload' ForeignKey( SourcePackage) CharField( max_length= 4096) self.sourcepack age, self.version) models. Model): BUILDING" , "Package building"), STEP_STATUSES = ( WAITING" , "Not started"), INPROGRESS" , "In progress"), FAILED" , "Failed"),
> + class Meta:
> + db_table = 'sourcepackageu
> +
> + sourcepackage = models.
> + version = models.
> +
> + def __unicode__(self):
> + return "{} {}".format(
> +
> +
> +class SubTicket(
> + class Meta:
> + db_table = 'subticket'
> +
> + WORKFLOW_STEPS = (
> + ("WAITING", "Not started"),
> + ("PACKAGE_
> + ("COMPLETE", "Completed"),
> + )
> + WORKFLOW_
> + ("PKG_BUILD_
> + ("PKG_BUILD_
> + ("PKG_BUILD_DONE", "Completed"),
> + ("PKG_BUILD_
> + )
same point about integer field here.
> + assignee = models. ForeignKey( Person)
I assume we want subtickets to be able to have different owners than the
main ticket?
> + sourcepackageupload = models. ForeignKey( SourcePackageUp load)
> +class Artifact( models. Model):
> + ticket_component = models. ForeignKey( SubTicket, blank=True, null=True) load, null=True, blank=True, name='Source Package Upload')
> + sourcepackageupload = models.ForeignKey(
> + SourcePackageUp
> + verbose_
This feels like we might not have a relation defined properly. It seems
like an Artifact shouldn't need the "ticket_component" attribute. I
think a SubTicket has a SourcePackageUpload which has artifacts. So
adding this ticket_component here feels like something isn't properly
normalized. I'm not sure the intent but it seems like it should be one
of these options:
= 1 ====== load: ForeignKey( SubTicket)
You add to SourcePackageUp
subticket = models.
Remove the the "ticket_component" attribute from Artifact.
The drawback here, is that a SubTicket could have more than loads. Maybe a OneToOneField is needed instead?
SourcePackageUp
= 2 =====
You don't need a SourcePackage upload class. You just make package_ version" as attributes to
"source_package" and "source_
SubTicket. Then Arfifact just has a foreign key to SubTicket.
= 3 =====
This is already correct, and I'm missing something.