このコミットが含まれているのは:
@@ -40,7 +40,7 @@ class CountsAxes
|
||||
end
|
||||
|
||||
def expressions
|
||||
all.map do |axis|
|
||||
@expressions ||= all.map do |axis|
|
||||
field = axis.fetch('field')
|
||||
case field
|
||||
when 'tags'
|
||||
@@ -56,9 +56,9 @@ class CountsAxes
|
||||
end
|
||||
end
|
||||
|
||||
def joins
|
||||
def joins(fields = all.map { _1['field'] })
|
||||
result = ''
|
||||
if all.any? { _1['field'] == 'tags' }
|
||||
if fields.include?('tags')
|
||||
result += <<~SQL.squish
|
||||
JOIN JSON_TABLE(CAST(v.tags_json AS JSON), '$[*]' COLUMNS (
|
||||
tag_id BIGINT PATH '$.tag_id' NULL ON EMPTY,
|
||||
@@ -66,7 +66,7 @@ class CountsAxes
|
||||
|
||||
SQL
|
||||
end
|
||||
if all.any? { _1['field'] == 'changed_field' }
|
||||
if fields.include?('changed_field')
|
||||
fields = @definition.changes.map do |field|
|
||||
"SELECT #{ ApplicationRecord.connection.quote(field) } AS field_key"
|
||||
end.join(' UNION ALL ')
|
||||
@@ -89,6 +89,8 @@ class CountsAxes
|
||||
raise ArgumentError unless @definition.axes(@population.history).include?(axis['field'])
|
||||
if @definition.fields[axis['field']] == :datetime
|
||||
raise ArgumentError unless GRAINS.include?(axis.fetch('grain', 'month'))
|
||||
|
||||
axis['grain'] ||= 'month'
|
||||
elsif axis.key?('grain')
|
||||
raise ArgumentError
|
||||
end
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする