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

Fix some scenarios where ^userpoints records are not present and generate issues #605

Merged
merged 1 commit into from
Mar 1, 2018

Conversation

pupi1985
Copy link
Contributor

Assuming a user is overriding the QA_MYSQL_USERS_PREFIX then there are different sites each with its own ^userpoints table. The thing is when a site creates a user then that site (and only that site) executes this line:

qa_db_points_update_ifuser($userid, null);

As sites are independent I don't think making a site communicate to each other the creation of the user would make any sense.

That means having to cope with the fact that there might be records in the ^users table that are not in the ^userpoints table. I don't think this is a big deal.

The current issue can be seen when listing top users. The query uses an INNER JOIN against the userpoints table which immediately removes all non present users. The suggestion would be to make a LEFT JOIN. It will make queries a bit slower but I don't think there any other way. To compensate, the fix also checks if there are multiple sites sharing the same ^users table so that the most performant query is used.

@pupi1985 pupi1985 force-pushed the patch-102 branch 2 times, most recently from cadca79 to 92de6be Compare February 10, 2018 19:02
@pupi1985 pupi1985 changed the title Fix the top users query to contemplate users created from other Q2A sites Fix some scenarios where ^userpoints records are not present and generate issues Feb 10, 2018
@svivian svivian merged commit 96dd714 into q2a:dev Mar 1, 2018
@svivian
Copy link
Collaborator

svivian commented Mar 1, 2018

Will this also update the user count? I found on my site if people register on different Q2A instances the user counts on each site get out of sync.

@pupi1985
Copy link
Contributor Author

pupi1985 commented Mar 5, 2018

Well, the user count is being updated when the qa_db_points_update_ifuser() actually inserts a user record:

if (qa_db_insert_on_duplicate_inserted()) {
qa_db_userpointscount_update();
}

Is that what you're talking about?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants