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

Interval perWeek() #43

Open
Amitoj02 opened this issue Oct 14, 2023 · 7 comments
Open

Interval perWeek() #43

Amitoj02 opened this issue Oct 14, 2023 · 7 comments

Comments

@Amitoj02
Copy link

It will be very useful to have perWeek() aggregate interval. Thank you.

@vpuentem
Copy link

You can use the interval() method which is used internally by the Trend class, something like this:

Trend::query(Model::class->where('condition', value))
            ->between(
                start: date,
                end: date,
            )
            ->interval('week')
            ->count();

(code not tested but it should work, although correct me if i'm wrong)

image

@davidvandertuijn
Copy link

davidvandertuijn commented Oct 26, 2023

You can use the interval() method which is used internally by the Trend class, something like this:

Trend::query(Model::class->where('condition', value))
            ->between(
                start: date,
                end: date,
            )
            ->interval('week')
            ->count();

(code not tested but it should work, although correct me if i'm wrong)

image

Error: Invalid Interval.

return match ($this->interval) {
    'minute' => 'Y-m-d H:i:00',
    'hour' => 'Y-m-d H:00',
    'day' => 'Y-m-d',
    'month' => 'Y-m',
    'year' => 'Y',
    default => throw new Error('Invalid interval.'),
};

@davidvandertuijn
Copy link

davidvandertuijn commented Oct 26, 2023

It will be very useful to have perQuarter() aggregate interval. Thank you.

@Semvrij
Copy link

Semvrij commented Feb 16, 2024

Any news on this issue?

@d8vjork
Copy link

d8vjork commented Mar 11, 2024

@davidvandertuijn +1 to what you just said, I was just around it

@d8vjork
Copy link

d8vjork commented Mar 11, 2024

image

Ok managed to get around quarters but not without "hacking" into some stuff

Now is whether the author(s) of this package want to mess the "normal" API flow or not (if it was me: I would just release a major)

Note: I didn't manage to make it work within SQLite cause I really don't understand its syntax and I never use it

@d8vjork
Copy link

d8vjork commented Mar 11, 2024

Mentioned here the quarter for those who might be interested: #56

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

5 participants