Git Product home page Git Product logo

Comments (6)

aconbere avatar aconbere commented on August 19, 2024

maybe my first tests were wrong, I've emulated this behavior this way


  filters :days_since_last_visit.eql => 7
  filters :days_since_last_visit.eql => 6
  filters :days_since_last_visit.eql => 5
  filters :days_since_last_visit.eql => 4
  filters :days_since_last_visit.eql => 3
  filters :days_since_last_visit.eql => 2
  filters :days_since_last_visit.eql => 1
  filters :days_since_last_visit.eql => 0

from garb.

tpitale avatar tpitale commented on August 19, 2024

I'm not certain what they net effect of all this is. Either way, your comment is correct. You can re-use the filters method and it will OR them together (because you can't have something that is both 5 AND 6 days since last visit).

A shorthand for this my be:

filters *([1..7].map { |i| {:days_since_last_visit.eql => i} })

from garb.

tpitale avatar tpitale commented on August 19, 2024

Just to clarify, that code creates an array of hashes containing the filter on days_since_last_visit equal to each day, and then unpacks it for passage to filters.

from garb.

tpitale avatar tpitale commented on August 19, 2024

The reason the first example did not work was because filters within one block will be AND'd together, and you can't have a metric/dimension as a filter that is two things at once.

This also occurs practically from the use of hashes. You can use the same metric with two distinct symbol operators (>= and <= on the same metric).

from garb.

aconbere avatar aconbere commented on August 19, 2024

the shorthand in your first comment is absolutely what I was going for. Digging into the garb code I recognized quickly that you were storing a list of hashes (not just a hash), but the methods of manipulating that were rather opaque.

At first I thought that the choice of a hash as the containing data structure was just flawed, and that it would be better implemented as a list where insertion offered an api to limit duplicates. But I think that the list of hashes is actually pretty solid, but that the current api makes it... unclear which of the two effects you're creating are. Are you adding the hash to a list... or are you adding an element to the hash...

Anyway... thanks for the prompt response, I'd call this closed :)

from garb.

tpitale avatar tpitale commented on August 19, 2024

You're welcome.

I've only just recently clarified the AND/OR behavior and reconciled with the GA api docs. This is still a work-in-progress.

from garb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.