Project

General

Profile

« Previous | Next » 

Revision 11668

bugfix: schemas/vegbien.sql: plantobservation_aggregateoccurrence_count_1(): only default aggregateoccurrence.count to 1 for specimens data, because plots data may have any number of individuals in a taxon_presence record that has no explicit individual_count

View differences:

schemas/vegbien.sql
1164 1164
    LANGUAGE plpgsql
1165 1165
    AS $$
1166 1166
BEGIN
1167
    UPDATE aggregateoccurrence
1168
    SET count = GREATEST(COALESCE(count, 0), 1) -- at least 1
1169
    WHERE aggregateoccurrence_id = new.aggregateoccurrence_id
1170
    ;
1171
    RETURN new;
1167
	IF (SELECT observationtype = 'specimen' FROM source
1168
		WHERE source_id = new.source_id) THEN
1169
		UPDATE aggregateoccurrence
1170
		SET count = GREATEST(COALESCE(count, 0), 1) -- at least 1
1171
		WHERE aggregateoccurrence_id = new.aggregateoccurrence_id
1172
		;
1173
	END IF;
1174
	RETURN new;
1172 1175
END;
1173 1176
$$;
1174 1177

  

Also available in: Unified diff