mirror of
https://github.com/xbgmsharp/postgsail.git
synced 2025-09-17 19:27:49 +00:00
Update process_stay_queue_fn, process stays only when gone
This commit is contained in:
@@ -555,9 +555,12 @@ CREATE OR REPLACE FUNCTION process_stay_queue_fn(IN _id integer) RETURNS void AS
|
|||||||
-- Get the stay record with all necessary fields exist
|
-- Get the stay record with all necessary fields exist
|
||||||
SELECT * INTO stay_rec
|
SELECT * INTO stay_rec
|
||||||
FROM api.stays
|
FROM api.stays
|
||||||
WHERE id = _id
|
WHERE active IS false
|
||||||
|
AND departed IS NOT NULL
|
||||||
|
AND arrived IS NOT NULL
|
||||||
AND longitude IS NOT NULL
|
AND longitude IS NOT NULL
|
||||||
AND latitude IS NOT NULL;
|
AND latitude IS NOT NULL
|
||||||
|
AND id = _id;
|
||||||
-- Ensure the query is successful
|
-- Ensure the query is successful
|
||||||
IF stay_rec.vessel_id IS NULL THEN
|
IF stay_rec.vessel_id IS NULL THEN
|
||||||
RAISE WARNING '-> process_stay_queue_fn invalid stay %', _id;
|
RAISE WARNING '-> process_stay_queue_fn invalid stay %', _id;
|
||||||
|
Reference in New Issue
Block a user