Index: openacs-4/packages/acs-events/sql/postgresql/timespan-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-events/sql/postgresql/timespan-create.sql,v diff -u -r1.9.2.2 -r1.9.2.3 --- openacs-4/packages/acs-events/sql/postgresql/timespan-create.sql 19 Aug 2024 13:48:32 -0000 1.9.2.2 +++ openacs-4/packages/acs-events/sql/postgresql/timespan-create.sql 30 Aug 2024 11:05:32 -0000 1.9.2.3 @@ -522,29 +522,29 @@ -- @param offset_interval Interval is offset by this date interval -- -- @return interval_id of the copied interval + CREATE OR REPLACE FUNCTION time_interval__copy( copy__interval_id integer, copy__offset_interval interval -- default 0 ) RETURNS integer AS $$ -DECLARE +DECLARE interval_row time_intervals%ROWTYPE; v_foo timestamptz; BEGIN select * into interval_row from time_intervals where interval_id = copy__interval_id; - + return time_interval__new( (interval_row.start_date ::timestamp + copy__offset_interval) :: timestamptz, (interval_row.end_date ::timestamp + copy__offset_interval) :: timestamptz ); END; -$$ LANGUAGE plpgsql; +$$ LANGUAGE plpgsql; - -- -- procedure time_interval__copy/1 -- @@ -1265,24 +1265,24 @@ v_timespan_id := null; -- Loop over each interval in timespan, creating a new copy - for rec_timespan in - select * + for rec_timespan in + select * from timespans where timespan_id = copy__timespan_id loop v_interval_id := time_interval__copy( - rec_timespan.interval_id, - copy__offset + rec_timespan.interval_id, + copy__offset_interval ); - if v_timespan_id is null + if v_timespan_id is null then -- JS: NOTE DEFAULT BEHAVIOR OF timespan__new v_timespan_id := timespan__new(v_interval_id); else -- no copy, use whatever is generated by time_interval__copy PERFORM timespan__join_interval( - v_timespan_id, + v_timespan_id, v_interval_id, false); end if; @@ -1292,11 +1292,9 @@ return v_timespan_id; END; -$$ LANGUAGE plpgsql; +$$ LANGUAGE plpgsql; - - -- -- procedure timespan__copy/1 --