このコミットが含まれているのは:
@@ -64,11 +64,17 @@ class CountsPopulation
|
||||
|
||||
def axis_condition(scope, entry)
|
||||
key = entry.fetch('field')
|
||||
raise ArgumentError unless definition.axes(history).include?(key)
|
||||
if entry.key?('grain')
|
||||
unless definition.fields[key] == :datetime && CountsAxes::GRAINS.include?(entry['grain'])
|
||||
raise ArgumentError
|
||||
end
|
||||
end
|
||||
if key == 'tags'
|
||||
scope = scope.where(snapshot_membership(entry.fetch('value')))
|
||||
elsif key == 'changed_field'
|
||||
raise ArgumentError unless history && definition.changes.include?(entry['value'])
|
||||
|
||||
|
||||
scope = scope.where(Arel.sql(changed_sql(entry['value'])))
|
||||
elsif definition.fields[key] == :datetime && entry['grain']
|
||||
scope = scope.where(definition.expression(key) => nil) if entry['value'].nil?
|
||||
@@ -79,7 +85,7 @@ class CountsPopulation
|
||||
end
|
||||
else
|
||||
raise ArgumentError unless definition.axes(history).include?(key)
|
||||
|
||||
|
||||
scope = scope.where(definition.expression(key) => entry['value'])
|
||||
end
|
||||
scope
|
||||
@@ -130,6 +136,14 @@ class CountsPopulation
|
||||
end
|
||||
apply_tags if params['tags'].present? || params['tag'].present?
|
||||
conditions = QueryState.records(params, 'conditions')
|
||||
drills = QueryState.records(params, 'drill')
|
||||
raise ArgumentError unless drills.length <= 100
|
||||
drills.each do |entry|
|
||||
raise ArgumentError unless (entry.keys - ['field', 'grain', 'value']).empty?
|
||||
|
||||
condition = entry.merge('operator' => 'axis_eq')
|
||||
conditions << condition unless conditions.include?(condition)
|
||||
end
|
||||
raise ArgumentError unless conditions.is_a?(Array) && conditions.length <= 100
|
||||
|
||||
values = QueryState.records(params, 'condition_values')
|
||||
@@ -138,7 +152,13 @@ class CountsPopulation
|
||||
raise ArgumentError unless index.between?(0, conditions.length - 1)
|
||||
raise ArgumentError unless conditions[index]['values'] == true
|
||||
end
|
||||
evaluated = []
|
||||
conditions.each_with_index do |entry, index|
|
||||
if entry['operator'] == 'axis_eq'
|
||||
next if evaluated.include?(entry)
|
||||
|
||||
evaluated << entry
|
||||
end
|
||||
if entry.key?('values')
|
||||
raise ArgumentError unless entry['values'] == true
|
||||
|
||||
@@ -147,12 +167,7 @@ class CountsPopulation
|
||||
end
|
||||
apply_condition(entry)
|
||||
end
|
||||
drills = QueryState.records(params, 'drill')
|
||||
raise ArgumentError unless drills.is_a?(Array) && drills.length <= 100
|
||||
|
||||
drills.each do |entry|
|
||||
@scope = axis_condition(@scope, entry)
|
||||
end
|
||||
end
|
||||
|
||||
def apply_condition(entry)
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする