Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow state skipping for dependent encoding profiles #217

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Application/Controller/XMLRPC/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ public function setCommenceTicketState($ticket_id) {
throw new Exception(__FUNCTION__.': ticket is not in initial state!',1304);
}

$commenceState = ProjectTicketState::getCommenceState($ticket['project_id'], $ticket['ticket_type']);
$commenceState = ProjectTicketState::getCommenceState($ticket_id);
if(!$commenceState) {
throw new Exception(__FUNCTION__.': ticket has no commence state!',1305);
}
Expand Down
94 changes: 47 additions & 47 deletions src/Application/Migrations/01_ticket_states.sql
Original file line number Diff line number Diff line change
Expand Up @@ -78,59 +78,59 @@ CREATE TRIGGER increment_ticket_state_sort BEFORE INSERT ON tbl_ticket_state FOR


-- meta tickets
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('meta', 'staging', 0, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('meta', 'staged', 50, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('meta', 'closed', 50, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('meta', 'staging', 0, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('meta', 'staged', 50, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('meta', 'closed', 50, false, false);

-- recording tickets
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('recording', 'locked', 0, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('recording', 'scheduled', 5, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('recording', 'recording', 40, true);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('recording', 'recorded', 5, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('recording', 'preparing', 10, true);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('recording', 'prepared', 5, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('recording', 'cutting', 30, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('recording', 'cut', 5, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('recording', 'finalizing', 10, true);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('recording', 'finalized', 5, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('recording', 'ready to archive', 0, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('recording', 'archiving', 0, true);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('recording', 'archived', 0, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('recording', 'ready to remove', 0, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('recording', 'removing', 0, true);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('recording', 'gone', 0, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('recording', 'locked', 0, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('recording', 'scheduled', 5, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('recording', 'recording', 40, true, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('recording', 'recorded', 5, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('recording', 'preparing', 10, true, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('recording', 'prepared', 5, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('recording', 'cutting', 30, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('recording', 'cut', 5, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('recording', 'finalizing', 10, true, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('recording', 'finalized', 5, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('recording', 'ready to archive', 0, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('recording', 'archiving', 0, true, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('recording', 'archived', 0, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('recording', 'ready to remove', 0, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('recording', 'removing', 0, true, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('recording', 'gone', 0, false, false);

-- encoding tickets
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('encoding', 'material needed', 0, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('encoding', 'ready to encode', 5, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('encoding', 'encoding', 50, true);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('encoding', 'encoded', 5, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('encoding', 'postencoding', 10, true);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('encoding', 'postencoded', 5, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('encoding', 'checking', 20, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('encoding', 'checked', 5, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('encoding', 'postprocessing', 10, true);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('encoding', 'postprocessed', 5, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('encoding', 'ready to release', 5, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('encoding', 'releasing', 20, true);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('encoding', 'released', 5, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('encoding', 'ready to remove', 0, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('encoding', 'removing', 0, true);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('encoding', 'gone', 0, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('encoding', 'material needed', 0, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('encoding', 'ready to encode', 5, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('encoding', 'encoding', 50, true, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('encoding', 'encoded', 5, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('encoding', 'postencoding', 10, true, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('encoding', 'postencoded', 5, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('encoding', 'checking', 20, false, true);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('encoding', 'checked', 5, false, true);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('encoding', 'postprocessing', 10, true, true);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('encoding', 'postprocessed', 5, false, true);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('encoding', 'ready to release', 5, false, true);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('encoding', 'releasing', 20, true, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('encoding', 'released', 5, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('encoding', 'ready to remove', 0, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('encoding', 'removing', 0, true, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('encoding', 'gone', 0, false, false);

-- ingest tickets
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('ingest', 'incomplete', 0, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('ingest', 'ready to ingest', 5, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('ingest', 'ingesting', 50, true);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('ingest', 'ingested', 5, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('ingest', 'finalizing', 10, true);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('ingest', 'finalized', 5, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('ingest', 'ready to archive', 5, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('ingest', 'archiving', 30, true);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('ingest', 'archived', 5, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('ingest', 'ready to remove', 5, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('ingest', 'removing', 20, true);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable) VALUES ('ingest', 'gone', 5, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('ingest', 'incomplete', 0, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('ingest', 'ready to ingest', 5, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('ingest', 'ingesting', 50, true, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('ingest', 'ingested', 5, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('ingest', 'finalizing', 10, true, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('ingest', 'finalized', 5, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('ingest', 'ready to archive', 5, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('ingest', 'archiving', 30, true, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('ingest', 'archived', 5, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('ingest', 'ready to remove', 5, false, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('ingest', 'removing', 20, true, false);
INSERT INTO tbl_ticket_state (ticket_type, ticket_state, percent_progress, service_executable, skippable_on_dependent) VALUES ('ingest', 'gone', 5, false, false);

-- mark non-initial states by giving sort <= 0
UPDATE tbl_ticket_state SET sort = 0 where ticket_state = 'locked';
Expand Down
1 change: 1 addition & 0 deletions src/Application/Migrations/04_projects.sql
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ CREATE TABLE tbl_project_ticket_state
ticket_type enum_ticket_type NOT NULL,
ticket_state enum_ticket_state NOT NULL,
service_executable boolean NOT NULL DEFAULT false,
skip_on_dependent boolean NOT NULL DEFAULT false,
CONSTRAINT tbl_project_ticket_state_pk PRIMARY KEY (project_id, ticket_type, ticket_state),
CONSTRAINT tbl_project_ticket_state_project_fk FOREIGN KEY (project_id)
REFERENCES tbl_project (id) MATCH SIMPLE
Expand Down
4 changes: 2 additions & 2 deletions src/Application/Migrations/06_tickets.sql
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ $BODY$
DECLARE
next_state record;
BEGIN
next_state := ticket_state_next(NEW.project_id, NEW.ticket_type, NEW.ticket_state);
next_state := ticket_state_next(NEW.id, NEW.ticket_state);

NEW.ticket_state_next := next_state.ticket_state;
NEW.service_executable := next_state.service_executable;
Expand Down Expand Up @@ -95,7 +95,7 @@ $BODY$
(progress, ticket_state_next, service_executable)
= (tp, (n).ticket_state, (n).service_executable)
FROM (
SELECT id, ticket_state_next(t2.project_id, t2.ticket_type, t2.ticket_state) AS n, ticket_progress(t2.id) as tp
SELECT id, ticket_state_next(t2.id) AS n, ticket_progress(t2.id) as tp
FROM tbl_ticket t2
WHERE t2.project_id = param_project_id AND param_project_id IS NOT NULL
) AS x
Expand Down
Loading