diff --git a/database/100-create-api-views.sql b/database/100-create-api-views.sql index 8299c2913..ccfa7f80c 100644 --- a/database/100-create-api-views.sql +++ b/database/100-create-api-views.sql @@ -749,6 +749,7 @@ $$; -- TOTAL COUNTS FOR HOMEPAGE -- software_cnt, project_cnt, organisation_cnt -- this rpc returns json object instead of array +-- DEPENDS on RPC mentions_by_software (104-software-views.sql) CREATE FUNCTION homepage_counts( OUT software_cnt BIGINT, OUT open_software_cnt BIGINT, @@ -759,18 +760,18 @@ CREATE FUNCTION homepage_counts( ) LANGUAGE plpgsql STABLE AS $$ BEGIN - SELECT COUNT(id) FROM software INTO software_cnt; - SELECT COUNT(id) FROM software WHERE NOT closed_source INTO open_software_cnt; - SELECT COUNT(id) FROM project INTO project_cnt; + SELECT COUNT(*) FROM software INTO software_cnt; + SELECT COUNT(*) FROM software WHERE NOT closed_source INTO open_software_cnt; + SELECT COUNT(*) FROM project INTO project_cnt; SELECT - COUNT(id) AS organisation_cnt + COUNT(*) AS organisation_cnt FROM organisations_overview(TRUE) WHERE organisations_overview.parent IS NULL AND organisations_overview.score>0 INTO organisation_cnt; SELECT COUNT(DISTINCT(orcid,given_names,family_names)) FROM contributor INTO contributor_cnt; - SELECT COUNT(mention) FROM mention_for_software INTO software_mention_cnt; + SELECT COUNT(*) FROM mentions_by_software() INTO software_mention_cnt; END $$;