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
attr_reader :project
def generate_from_statement(user_ids_and_access_levels)
"(VALUES #{generate_values_expression(user_ids_and_access_levels)}) members (user_id, access_level)"
end
values_list = Arel::Nodes::ValuesList.new(user_ids_and_access_levels).to_sql
def generate_values_expression(user_ids_and_access_levels)
user_ids_and_access_levels.map do |user_id, access_level|
"(#{user_id}, #{access_level})"
end.join(",")
"(#{values_list}) members (user_id, access_level)"
end
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