Interpolate timestamps for non-existing shotpoints

This commit is contained in:
D. Berge
2022-03-09 21:22:33 +01:00
parent fd278a5ee6
commit 648ce9970f

View File

@@ -158,7 +158,11 @@ BEGIN
-- Complete the tstamp if possible
IF NEW.sequence IS NOT NULL AND NEW.point IS NOT NULL AND NEW.tstamp IS NULL THEN
SELECT ts INTO NEW.tstamp FROM tstamp_from_sequence_shot(NEW.sequence, NEW.point);
SELECT COALESCE(
tstamp_from_sequence_shot(NEW.sequence, NEW.point),
tstamp_interpolate(NEW.sequence, NEW.point)
)
INTO NEW.tstamp;
END IF;
-- Any id that is provided will be ignored. The generated
@@ -187,7 +191,11 @@ BEGIN
IF NEW.sequence <> OLD.sequence OR NEW.point <> OLD.point
AND NEW.sequence IS NOT NULL AND NEW.point IS NOT NULL
AND NEW.tstamp IS NULL OR NEW.tstamp = OLD.tstamp THEN
SELECT ts INTO NEW.tstamp FROM tstamp_from_sequence_shot(NEW.sequence, NEW.point);
SELECT COALESCE(
tstamp_from_sequence_shot(NEW.sequence, NEW.point),
tstamp_interpolate(NEW.sequence, NEW.point)
)
INTO NEW.tstamp;
END IF;
UPDATE event_log_full