Skip to content
Snippets Groups Projects
Commit 60ec9236 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

SW-907: added some more logging

parent 76386b72
No related branches found
No related tags found
2 merge requests!128Lofar release 4 0 -> master,!123Resolve SW-907
......@@ -19,6 +19,7 @@ DECLARE
task_aborted_status_id int := 1100; --beware: hard coded instead of lookup for performance
BEGIN
IF NEW.status_id <> OLD.status_id THEN
RAISE NOTICE 'on_task_updated: updating task id=% from status % to %', NEW.id, OLD.status_id, NEW.status_id;
IF NEW.status_id = task_scheduled_status_id AND OLD.status_id <> task_prescheduled_status_id THEN
-- tasks can only be scheduled from the prescheduled state
RAISE EXCEPTION 'Cannot update task status from % to %', OLD.status_id, NEW.status_id;
......@@ -818,6 +819,7 @@ BEGIN
IF TG_OP = 'INSERT' OR (TG_OP = 'UPDATE' AND (OLD.status_id <> NEW.status_id)) THEN
IF NEW.status_id = claim_conflict_status_id THEN
--if claim status went to conflict, then set the task status to conflict as well
RAISE NOTICE 'after_claim_insertupdatedelete: updating task id=% to conflict status % because there are claims in conflict for this task', NEW.task_id, task_conflict_status_id;
UPDATE resource_allocation.task SET status_id=task_conflict_status_id WHERE id=NEW.task_id AND status_id <> task_conflict_status_id;
ELSIF NEW.status_id = claim_tentative_status_id THEN
IF NOT EXISTS (SELECT id FROM resource_allocation.resource_claim
......@@ -827,10 +829,11 @@ BEGIN
IF NOT EXISTS (SELECT id FROM resource_allocation.task
WHERE id = NEW.task_id
AND status_id = task_approved_status_id) THEN
RAISE NOTICE 'Updating task id=% to approved status % because there are no more claims in conflict for this task', NEW.task_id, task_approved_status_id;
RAISE NOTICE 'after_claim_insertupdatedelete: updating task id=% to approved status % because there are no more claims in conflict for this task', NEW.task_id, task_approved_status_id;
-- update tasks which were in conflict, but which are not anymore due this claim-update to the approved status
UPDATE resource_allocation.task SET status_id=task_approved_status_id
WHERE id=NEW.task_id AND status_id = task_conflict_status_id;
RAISE NOTICE 'after_claim_insertupdatedelete: updated task id=% to approved status % because there are no more claims in conflict for this task', NEW.task_id, task_approved_status_id;
END IF;
END IF;
END IF;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment