app/builders/v2/report_builder.rb
# unscoped removes all scopes added to a model previously
unscoped removes all scopes added to a model previously
unscoped removes all scopes added to a model previously
def incoming_messages_count
    scope.messages.unscoped.where(account_id: account.id).incoming
         .group_by_day(:created_at, range: range, default_value: 0)
         .count
  end
def incoming_messages_count scope . messages . unscoped . where ( account_id : account . id ) . incoming . group_by_day ( :created_at , range : range , default_value : 0 ) . count end
unscoped removes all scopes added to a model previously
unscoped removes all scopes added to a model previously