このコミットが含まれているのは:
2026-10-31 04:08:05 +09:00
コミット 6a0f1ec819
23個のファイルの変更、188行の追加、57行の削除
+8 -3
ファイルの表示
@@ -68,6 +68,14 @@ class CountsAxes
end
end
def count_expression
return 'COUNT(DISTINCT v.id)' unless rows.any? { _1['field'] == 'tags' }
# Keep tag occurrences even when several private tags share one masked label.
"COUNT(DISTINCT v.id, COALESCE(CONCAT('internal:', tag_entry.tag_id), " +
"CONCAT('external:', tag_entry.external_tag_id)))"
end
def joins(fields = all.map { _1['field'] })
result = ''
if fields.include?('tags')
@@ -85,9 +93,6 @@ class CountsAxes
condition = @definition.changes.map do |field|
"(changed.field_key = '#{ field }' AND #{ @population.changed_sql(field) })"
end.join(' OR ')
unless HistoryAccess.admin?
condition = "(#{ condition }) OR NOT (#{ HistoryAccess.sql(@definition.model, 'v') })"
end
result += " JOIN (#{ fields }) changed ON (#{ condition })"
end
result