Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graph_data/delta_records_since not working with scope #10

Open
fmh opened this issue Jul 21, 2015 · 0 comments
Open

graph_data/delta_records_since not working with scope #10

fmh opened this issue Jul 21, 2015 · 0 comments

Comments

@fmh
Copy link

fmh commented Jul 21, 2015

scope :have_clients_company, -> { joins(:clients).where('clients.cat = 0') } 
scope :have_clients_private, -> { joins(:clients).where('clients.cat =1 ') } 

 def self.graph_data since=30.days.ago
    [
      {
          name: 'Type1',
          pointInterval: point_interval = 1.day * 1000,
          pointStart: start_point = since.to_i * 1000,
          data: MyClass.have_clients_company.delta_records_since(since)
      },
      {
          name: 'Type2',
          pointInterval: point_interval,
          pointStart: start_point,
          data: MyClass.have_clients_private.delta_records_since(since)
      }
    ]
  end

always return a 0 as count

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant