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

Manually added dimension appears in subsequent queries #40

Closed
auxbuss opened this issue Aug 23, 2013 · 3 comments
Closed

Manually added dimension appears in subsequent queries #40

auxbuss opened this issue Aug 23, 2013 · 3 comments

Comments

@auxbuss
Copy link

auxbuss commented Aug 23, 2013

Given:

class Legato::SiteVisits
  extend Legato::Model
  metrics :visits
  dimensions :date
end

I'm manually adding a dimension to a query, like so:

visits = SiteVisits.results(@client.profile, start_date: start_date, end_date: end_date)
visits.dimensions << :dimension1 if <some condition>
<add filters>
rs = visits.collection

I do this because I don't know until runtime which custom dimensions I'll need.

However, when I later create another query:

query = SiteVisits.results(@client.profile, start_date: start_date, end_date: end_date)

query.dimensions shows @elements=[:date, :dimension1]

I would not expect :dimension1 to be in the dimensions collection.

Not sure if this is a bug, but it's unexpected behaviour.

Any suggestions for fixing or avoiding this would be appreciated. Thanks

@tpitale
Copy link
Owner

tpitale commented Aug 25, 2013

The method used here is modifying the dimension list of the parent class passed to the query.

Garb used to permit passing options to the call to results like :metrics, and :dimensions.

I will fix this so that your use case works, and will make a new issue to reintroduce the feature from Garb.

@tpitale
Copy link
Owner

tpitale commented Aug 25, 2013

I just released gem version 0.2.0. Please try your use case again! Thank you!

@auxbuss
Copy link
Author

auxbuss commented Aug 26, 2013

I can confirm that this fixes the issue. Thanks very much.

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

2 participants