Skip to content
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

Display correct number of labels by Anonymous Users in Admin Users table #799

Merged
merged 2 commits into from
Jul 3, 2017

Conversation

sbower213
Copy link
Collaborator

Resolves #791. Very minor SQL change to display the correct number of labels on the Anonymous Users table of the admin dashboard.

@sbower213 sbower213 changed the title Omit duplicate anonymous records in Admin Users pane Display correct number of labels by Anonymous Users in Admin Users table Jun 30, 2017
@misaugstad misaugstad self-assigned this Jun 30, 2017
@misaugstad
Copy link
Member

Nice find @sbower213! @Manaswis and I must both have assumed that there was only one entry in the audit_task_environment table per audit_task_id, but clearly that is not the case!

@jonfroehlich
Copy link
Member

@misaugstad: can you expand a bit on this and explain why you would have thought this and what the implication was of thinking this (and how it may have affected other parts of the system)?

@misaugstad
Copy link
Member

I guess we just wouldn't really expect ip address/browser/OS to change mid-street. The code that was written was done by @Manaswis and it was a ~35 line query (very complicated), and so something like that is just going to be missed at some point. I then based the query that I wrote off of that one, without looking at what else was in the audit_task_environment table (all we were getting from it was ip_address). So we were just not quite as thorough as we should have been there.

And as far as effect on the rest of the system, there are a couple other functions in that same file that do this same thing incorrectly. And those functions are only ever used on the admin dashboard (in that table that was pictured, and in the table on the overview page that shows number of anon users who visited the site today/yesterday).

I have not found anything relating to the tool that has been impacted by this, and the table where we originally found the issue seems to be the most important admin/analytics thing that was impacted.

@misaugstad
Copy link
Member

@sbower213 could you just go through the rest of that file you were editing, and make the same fix in the other couple functions that make that mistake?

@jonfroehlich
Copy link
Member

Thanks @misaugstad for the detailed feedback. Again, when we see very complicated queries like this, imo, its a symptom that we have a broken architecture and that a table or other schema modifications should be made to better support the query.

A second takeaway, which you also indicate, is that we just need to be more diligent about reviewing code and testing.

Copy link
Member

@misaugstad misaugstad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! And the numbers make more sense now :)

@misaugstad misaugstad merged commit cd3e50c into develop Jul 3, 2017
@misaugstad misaugstad deleted the 791-anonymous-user-label-counts branch March 25, 2020 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants