Skip to content

Commit

Permalink
exclude deleted trait observations from obs counts
Browse files Browse the repository at this point in the history
  • Loading branch information
bellerbrock committed Mar 26, 2024
1 parent e6d0ea8 commit 8b38623
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class StudyDao {
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(*) FROM observations WHERE study_id = Studies.${Study.PK}) AS observation_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
"""
db.rawQuery(query, null).use { cursor ->
Expand Down Expand Up @@ -260,7 +260,7 @@ class StudyDao {
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(*) FROM observations WHERE study_id = Studies.${Study.PK}) AS observation_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 Expand Up @@ -298,7 +298,7 @@ class StudyDao {
val cursor = db.rawQuery("""
SELECT observation_variable_name, observation_variable_field_book_format, COUNT(*) as count
FROM observations
WHERE study_id = ?
WHERE study_id = ? AND observation_variable_db_id > 0
GROUP BY observation_variable_name
""", arrayOf(studyId.toString()))

Expand Down

0 comments on commit 8b38623

Please sign in to comment.