Skip to content

Commit

Permalink
ERM-1645: getResourceCount now discards pcis with removedTimestamp (#429
Browse files Browse the repository at this point in the history
)
  • Loading branch information
EthanFreestone authored Jun 14, 2021
1 parent bf26b61 commit a3e0335
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion service/grails-app/domain/org/olf/kb/Pkg.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ public class Pkg extends ErmResource implements MultiTenant<Pkg> {

@Transient
public long getResourceCount() {
long num_items = PackageContentItem.countByPkg (this)
long num_items = (PackageContentItem.executeQuery("""
SELECT count(*) FROM PackageContentItem pci
WHERE pci.pkg.id = :id
AND pci.removedTimestamp = NULL
""",
[id: id]
) ?: [])[0];

return num_items;
}

Expand Down

0 comments on commit a3e0335

Please sign in to comment.