Skip to content

Commit

Permalink
all tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
dferhod committed Jun 19, 2024
1 parent f36d808 commit f4a2bba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ CREATE OR REPLACE FUNCTION pgwar.update_community_entity_label_on_project_entity
DECLARE
label text;
BEGIN
IF NEW.fk_project != 0 THEN
SELECT pgwar.get_most_frequent_entity_label(NEW.pk_entity) INTO label;
IF NEW.fk_project != 0 OR OLD.fk_project !=0 THEN

IF tg_op = 'UPDATE' AND OLD.entity_label != NEW.entity_label THEN
SELECT pgwar.get_most_frequent_entity_label(NEW.pk_entity) INTO label;
PERFORM
pgwar.upsert_community_entity_preview((
NEW.pk_entity,
Expand All @@ -113,6 +114,7 @@ BEGIN
NEW.tmsp_last_modification)::pgwar.entity_preview
);
ELSEIF tg_op = 'INSERT' THEN
SELECT pgwar.get_most_frequent_entity_label(NEW.pk_entity) INTO label;
PERFORM
pgwar.upsert_community_entity_preview((
NEW.pk_entity,
Expand All @@ -131,6 +133,7 @@ BEGIN
NEW.tmsp_last_modification)::pgwar.entity_preview
);
ELSE
SELECT pgwar.get_most_frequent_entity_label(OLD.pk_entity) INTO label;
UPDATE pgwar.entity_preview
SET entity_label = label
WHERE fk_project = 0 AND pk_entity = OLD.pk_entity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ WHERE notes = '_1';
SELECT is(
ep.entity_label,
'Label 1bis',
'Assert community entity preview has Label 1bis'
'Assert community entity preview has Label 1bis after inserts'
)
FROM pgwar.entity_preview ep,
information.resource r
Expand All @@ -339,7 +339,7 @@ WHERE fk_project > 3;
SELECT is(
ep.entity_label,
'Label 1ter',
'Assert community entity preview has Label 1ter'
'Assert community entity preview has Label 1ter after updates'
)
FROM pgwar.entity_preview ep,
information.resource r
Expand All @@ -355,7 +355,7 @@ WHERE fk_project > 1;
SELECT is(
ep.entity_label,
'Label 1',
'Assert community entity preview has Label 1'
'Assert community entity preview has Label 1 after deletes'
)
FROM pgwar.entity_preview ep,
information.resource r
Expand Down

0 comments on commit f4a2bba

Please sign in to comment.