-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add status for TestRuns * switch to Integer choices
- Loading branch information
Showing
6 changed files
with
159 additions
and
87 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
ayushma/migrations/0034_remove_testrun_complete_testrun_status.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Generated by Django 4.2.1 on 2023-07-31 12:00 | ||
|
||
from django.db import migrations, models | ||
|
||
from ayushma.models.enums import StatusChoices | ||
|
||
|
||
def migrate_testrun_status(apps, schema_editor): | ||
TestRun = apps.get_model("ayushma", "TestRun") | ||
for testrun in TestRun.objects.all(): | ||
if testrun.complete: | ||
testrun.status = StatusChoices.COMPLETED | ||
else: | ||
testrun.status = StatusChoices.CANCELED | ||
testrun.save() | ||
|
||
|
||
def reverse_testrun_status(apps, schema_editor): | ||
TestRun = apps.get_model("ayushma", "TestRun") | ||
for testrun in TestRun.objects.all(): | ||
if testrun.status == StatusChoices.COMPLETED: | ||
testrun.complete = True | ||
else: | ||
testrun.complete = False | ||
testrun.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("ayushma", "0033_project_archived"), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name="testrun", | ||
name="complete", | ||
), | ||
migrations.AddField( | ||
model_name="testrun", | ||
name="status", | ||
field=models.IntegerField( | ||
choices=[ | ||
(1, "Running"), | ||
(2, "Completed"), | ||
(3, "Canceled"), | ||
(4, "Failed"), | ||
], | ||
default=1, | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters