Skip to content

Commit

Permalink
Fix inaccurate count of versions
Browse files Browse the repository at this point in the history
Fix version join
  • Loading branch information
nimmolo committed Mar 6, 2024
1 parent 0d6aa2d commit 553f348
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/classes/site_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ def count_versions(parent_table, user_id)
parent_id = "#{parent_table}_id"

parent_class.joins(:versions).
where(user_id: user_id).
where(version_class.arel_table[:user_id].eq(user_id)).
where.not(
parent_class[:user_id].eq(version_class.arel_table[:user_id])
version_class.arel_table[:user_id].eq(parent_class[:user_id])
).distinct.select(version_class.arel_table[:"#{parent_id}"]).count
end

Expand Down

0 comments on commit 553f348

Please sign in to comment.