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

SW-35: processed review comments

parent 70547097
No related branches found
No related tags found
No related merge requests found
...@@ -520,14 +520,12 @@ BEGIN ...@@ -520,14 +520,12 @@ BEGIN
RETURN max_resource_at_or_before_starttime; RETURN max_resource_at_or_before_starttime;
END IF; END IF;
IF max_resource_usage_in_time_window.as_of_timestamp > _lower THEN IF max_resource_usage_in_time_window.as_of_timestamp > _lower THEN -- Skips as_of_timestamp = _lower on purpose
-- check if the usage at_or_before_starttime is higher then in_time_window -- check if the usage at_or_before_starttime is higher then in_time_window
SELECT * FROM resource_allocation.get_resource_usage_at_or_before(_resource_id, _claim_status_id, _lower, false, false, false) INTO max_resource_at_or_before_starttime; SELECT * FROM resource_allocation.get_resource_usage_at_or_before(_resource_id, _claim_status_id, _lower, false, false, false) INTO max_resource_at_or_before_starttime;
IF max_resource_at_or_before_starttime IS NOT NULL THEN IF max_resource_at_or_before_starttime IS NOT NULL THEN
IF max_resource_at_or_before_starttime.usage > max_resource_usage_in_time_window.usage THEN IF max_resource_at_or_before_starttime.usage > max_resource_usage_in_time_window.usage THEN
RETURN max_resource_at_or_before_starttime; RETURN max_resource_at_or_before_starttime;
ELSE
RETURN max_resource_usage_in_time_window;
END IF; END IF;
END IF; END IF;
END IF; END IF;
...@@ -727,7 +725,7 @@ BEGIN ...@@ -727,7 +725,7 @@ BEGIN
-- when a claim goes to conflict, then so does it's task, and we don't want that for running/finished/aborted tasks -- when a claim goes to conflict, then so does it's task, and we don't want that for running/finished/aborted tasks
IF EXISTS (SELECT 1 FROM resource_allocation.task IF EXISTS (SELECT 1 FROM resource_allocation.task
WHERE id=NEW.task_id WHERE id=NEW.task_id
AND status_id = ANY(ARRAY[300, 335, 350, 400, 500])) THEN -- hardcoded tasks statuses <= queued AND status_id = ANY(ARRAY[task_approved_status_id, task_conflict_status_id, task_prescheduled_status_id, task_scheduled_status_id, task_queued_status_id])) THEN -- hardcoded tasks statuses <= queued
-- conflict with others, so set claim status to conflict -- conflict with others, so set claim status to conflict
NEW.status_id := claim_conflict_status_id; NEW.status_id := claim_conflict_status_id;
END IF; END IF;
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
-- psql resourceassignment -U resourceassignment -f add_resource_allocation_statics.sql -W -- psql resourceassignment -U resourceassignment -f add_resource_allocation_statics.sql -W
BEGIN; BEGIN;
-- General Warning: if you change any of these values, make sure you update the hardcoded values in add_functions_and_triggers.sql too.
INSERT INTO resource_allocation.task_status VALUES (200, 'prepared'), (300, 'approved'), (320, 'on_hold'), (335, 'conflict'), INSERT INTO resource_allocation.task_status VALUES (200, 'prepared'), (300, 'approved'), (320, 'on_hold'), (335, 'conflict'),
(350, 'prescheduled'), (400, 'scheduled'), (500, 'queued'), (600, 'active'), (900, 'completing'), (1000, 'finished'), (1100, 'aborted'), (350, 'prescheduled'), (400, 'scheduled'), (500, 'queued'), (600, 'active'), (900, 'completing'), (1000, 'finished'), (1100, 'aborted'),
(1150, 'error'), (1200, 'obsolete'); -- This is the list from OTDB, we'll need to merge it with the list from MoM in the future, might use different indexes? (1150, 'error'), (1200, 'obsolete'); -- This is the list from OTDB, we'll need to merge it with the list from MoM in the future, might use different indexes?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment