- Notifications
You must be signed in to change notification settings - Fork14
Introduce Workflow#65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Closed
Uh oh!
There was an error while loading.Please reload this page.
Closed
Changes fromall commits
Commits
Show all changes
2 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
83 changes: 83 additions & 0 deletionsmedia/commitfest/css/commitfest.css
This file contains hidden or 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
42 changes: 42 additions & 0 deletionspgcommitfest/commitfest/apiv1.py
This file contains hidden or 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,42 @@ | ||
from django.http import ( | ||
HttpResponse, | ||
) | ||
import json | ||
from datetime import datetime | ||
from .models import ( | ||
Workflow, | ||
) | ||
def datetime_serializer(obj): | ||
if isinstance(obj, datetime): | ||
return obj.strftime("%Y-%m-%dT%H:%M:%S%z") | ||
raise TypeError("Type not serializable") | ||
def apiResponse(request, payload, status=200, content_type="application/json"): | ||
response = HttpResponse( | ||
json.dumps(payload, default=datetime_serializer), status=status | ||
) | ||
response["Content-Type"] = content_type | ||
response["Access-Control-Allow-Origin"] = "*" | ||
return response | ||
def optional_as_json(obj): | ||
if obj is None: | ||
return None | ||
return obj.json() | ||
def active_commitfests(request): | ||
payload = { | ||
"workflow": { | ||
"open": optional_as_json(Workflow.open_cf()), | ||
"inprogress": optional_as_json(Workflow.inprogress_cf()), | ||
"parked": optional_as_json(Workflow.parked_cf()), | ||
}, | ||
} | ||
return apiResponse(request, payload) |
36 changes: 36 additions & 0 deletionspgcommitfest/commitfest/fixtures/auth_data.json
This file contains hidden or 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
67 changes: 67 additions & 0 deletionspgcommitfest/commitfest/fixtures/commitfest_data.json
This file contains hidden or 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
68 changes: 68 additions & 0 deletionspgcommitfest/commitfest/migrations/0011_add_status_related_constraints.py
This file contains hidden or 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,68 @@ | ||
from django.db import migrations | ||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("commitfest", "0010_add_failing_since_column"), | ||
] | ||
operations = [ | ||
migrations.RunSQL( | ||
""" | ||
CREATE UNIQUE INDEX cf_enforce_maxoneopen_idx | ||
ON commitfest_commitfest (status) | ||
WHERE status not in (1,4); | ||
""", | ||
reverse_sql=""" | ||
DROP INDEX IF EXISTS cf_enforce_maxoneopen_idx; | ||
""", | ||
), | ||
migrations.RunSQL( | ||
""" | ||
CREATE UNIQUE INDEX poc_enforce_maxoneoutcome_idx | ||
ON commitfest_patchoncommitfest (patch_id) | ||
WHERE status not in (5); | ||
""", | ||
reverse_sql=""" | ||
DROP INDEX IF EXISTS poc_enforce_maxoneoutcome_idx; | ||
""", | ||
), | ||
migrations.RunSQL( | ||
""" | ||
ALTER TABLE commitfest_patchoncommitfest | ||
ADD CONSTRAINT status_and_leavedate_correlation | ||
CHECK ((status IN (4,5,6,7,8)) = (leavedate IS NOT NULL)); | ||
""", | ||
reverse_sql=""" | ||
ALTER TABLE commitfest_patchoncommitfest | ||
DROP CONSTRAINT IF EXISTS status_and_leavedate_correlation; | ||
""", | ||
), | ||
migrations.RunSQL( | ||
""" | ||
COMMENT ON COLUMN commitfest_patchoncommitfest.leavedate IS | ||
$$A leave date is recorded in two situations, both of which | ||
means this particular patch-cf combination became inactive | ||
on the corresponding date. For status 5 the patch was moved | ||
to some other cf. For 4,6,7, and 8, this was the final cf. | ||
$$ | ||
""", | ||
reverse_sql=""" | ||
COMMENT ON COLUMN commitfest_patchoncommitfest.leavedate IS NULL; | ||
""", | ||
), | ||
migrations.RunSQL( | ||
""" | ||
COMMENT ON TABLE commitfest_patchoncommitfest IS | ||
$$This is a re-entrant table: patches may become associated | ||
with a given cf multiple times, resetting the entrydate and clearing | ||
the leavedate each time. Non-final statuses never have a leavedate | ||
while final statuses always do. The final status of 5 (moved) is | ||
special in that all but one of the rows a patch has in this table | ||
must have it as the status. | ||
$$ | ||
""", | ||
reverse_sql=""" | ||
COMMENT ON TABLE commitfest_patchoncommitfest IS NULL; | ||
""", | ||
), | ||
] |
23 changes: 23 additions & 0 deletionspgcommitfest/commitfest/migrations/0012_add_parked_cf_status.py
This file contains hidden or 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,23 @@ | ||
from django.db import migrations, models | ||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("commitfest", "0011_add_status_related_constraints"), | ||
] | ||
operations = [ | ||
migrations.AlterField( | ||
model_name="commitfest", | ||
name="status", | ||
field=models.IntegerField( | ||
choices=[ | ||
(1, "Future"), | ||
(2, "Open"), | ||
(3, "In Progress"), | ||
(4, "Closed"), | ||
(5, "Parked"), | ||
], | ||
default=1, | ||
), | ||
) | ||
] |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.