Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: software mentions counts on homepage #1329

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions database/100-create-api-views.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
$$;

Expand Down