Skip to content

Commit

Permalink
update trait count to exclude deleted traits as well
Browse files Browse the repository at this point in the history
  • Loading branch information
bellerbrock committed Mar 26, 2024
1 parent 8b38623 commit eb20096
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class StudyDao {
SELECT
Studies.*,
(SELECT COUNT(*) FROM observation_units_attributes WHERE study_id = Studies.${Study.PK}) AS attribute_count,
(SELECT COUNT(DISTINCT observation_variable_name) FROM observations WHERE study_id = Studies.${Study.PK}) AS trait_count,
(SELECT COUNT(DISTINCT observation_variable_name) FROM observations WHERE study_id = Studies.${Study.PK} AND observation_variable_db_id > 0) AS trait_count,
(SELECT COUNT(*) FROM observations WHERE study_id = Studies.${Study.PK} AND observation_variable_db_id > 0) AS observation_count
FROM ${Study.tableName} AS Studies
"""
Expand Down Expand Up @@ -259,7 +259,7 @@ class StudyDao {
study_sort_name,
count,
(SELECT COUNT(*) FROM observation_units_attributes WHERE study_id = Studies.${Study.PK}) AS attribute_count,
(SELECT COUNT(DISTINCT observation_variable_name) FROM observations WHERE study_id = Studies.${Study.PK}) AS trait_count,
(SELECT COUNT(DISTINCT observation_variable_name) FROM observations WHERE study_id = Studies.${Study.PK} AND observation_variable_db_id > 0) AS trait_count,
(SELECT COUNT(*) FROM observations WHERE study_id = Studies.${Study.PK} AND observation_variable_db_id > 0) AS observation_count
FROM ${Study.tableName} AS Studies
WHERE ${Study.PK} = ?
Expand Down

0 comments on commit eb20096

Please sign in to comment.