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

Whitelist/Blacklist source_share_user_name is ambiguous #6

Open
islador opened this issue Jul 26, 2014 · 0 comments
Open

Whitelist/Blacklist source_share_user_name is ambiguous #6

islador opened this issue Jul 26, 2014 · 0 comments
Labels

Comments

@islador
Copy link
Owner

islador commented Jul 26, 2014

The code in whitelist/blacklist logs and indexs that compiles a hash of the different names is ambiguous. It depends on the database returning ordered values instead of enforcing ordered returns.

#Build the source_share_user names
        @source_share_user_names = {}

        values = Whitelist.where("share_id =?", csu.share_id).pluck("source_share_user").uniq
        names = ShareUser.where(id: values).pluck("main_char_name")
        values.each do |val|
            @source_share_user_names.store(names[values.index(val)].to_sym, val)
        end
@source_share_user_names = {}

        values = BlackListEntityLog.where("share_id =?", csu.share_id).pluck("source_share_user_id").uniq
        names = ShareUser.where(id: values).pluck("main_char_name")
        values.each do |val|
            @source_share_user_names.store(names[values.index(val)].to_sym, val)
        end

Solution

  • Build specs to test this behavior
  • Enforce ordered returns
@islador islador added bug and removed bug labels Jul 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant