-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Total Tag count on tag stats pages seems incorrect for tag "beach" #8244
Comments
Aha - more sense here: it's not doing a database count, it's accessing an attribute named irb(main):036:0> Tag.where(name: 'beach').first.count
=> 8
irb(main):037:0> Tag.where(name: 'beach').first
=> #<Tag tid: 15452, vid: 3, name: "beach", description: "", weight: 0, count: 8, parent: nil> |
So, perhaps that's simply not getting updated. Let's see where else we count tag usage, and also where we update the attribute... |
Looks like we need to be running this to maintain that attribute: Lines 39 to 42 in d9e7f11
We do that each time a tag is added: Line 845 in 122e8a7
OK, so when However, when we run this, we see there are only 4 notes (and no wikis) for Tag.find_nodes_by_type('beach', 'note').count |
Aha - so 4 are attached to nodes that are not
Great, there's our discrepancy! |
OK wait we have to run run_count on all tags!!! https://stable.publiclab.org/tag/beach/stats |
So we'll need to run: Tag.all.each do |tag|
tag.run_count
end |
Great detective work 🎉 |
Running this on stable.publiclab.org now to test. |
Exciting to see this detective work yield results! |
Sorry, this was completed long ago and is live! Closing! |
Reporting in here from @ebarry and Jeanette, the graph at https://publiclab.org/tag/beach/stats seems correct, but below it the "Total Tag count" of 8 seems wrong, by their count.
That code is driven from here:
plots2/app/views/tag/_graph.html.erb
Lines 4 to 8 in c60aaab
Strange --
@tags.first.count
would seem to be runningTag.where(name: params[:id]).first.count
, which doesn't make sense to me.Looking deeper, cc @cesswairimu as well...
The text was updated successfully, but these errors were encountered: