Commit a980f2a5 authored by Manoj M J's avatar Manoj M J

Use `Arel::Nodes::ValuesList` in `EffectiveAccessLevelFinder`

This MR makes changes such that we now use
`Arel::Nodes::ValuesList` in
`EffectiveAccessLevelFinder` to generate
the query that finds members with
their user ids and access levels
in a given project.
parent c6a5f71e
...@@ -27,13 +27,9 @@ module Projects ...@@ -27,13 +27,9 @@ module Projects
attr_reader :project attr_reader :project
def generate_from_statement(user_ids_and_access_levels) def generate_from_statement(user_ids_and_access_levels)
"(VALUES #{generate_values_expression(user_ids_and_access_levels)}) members (user_id, access_level)" values_list = Arel::Nodes::ValuesList.new(user_ids_and_access_levels).to_sql
end
def generate_values_expression(user_ids_and_access_levels) "(#{values_list}) members (user_id, access_level)"
user_ids_and_access_levels.map do |user_id, access_level|
"(#{user_id}, #{access_level})"
end.join(",")
end end
def no_members? def no_members?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment