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

Default value of date_to not updating in pagination_filters #59

Open
smadrigalb opened this issue Apr 8, 2024 · 2 comments
Open

Default value of date_to not updating in pagination_filters #59

smadrigalb opened this issue Apr 8, 2024 · 2 comments

Comments

@smadrigalb
Copy link

Hi,

First of all, I want to express my gratitude for the work done on this project and for sharing it with the community.

In the pagination_filters function, in dependencies.py, the default value for the date_to parameter is set to datetime.now(). However, this results in the date_to value being set only once, when the function is defined, and not updating with each call to the function. Consequently, subsequent calls to pagination_filters always return the same value for date_to, which is not the intended behavior.

def pagination_filters(
    date_from: datetime = Query(default=None),
    date_to: datetime = Query(default=datetime.now()),
    offset: int = Query(default=0),
    limit: int = Query(default=50),
):
    print("datetoooo")
    print(date_to)
    return {
        'date_from': date_from,
        'date_to': date_to,
        'offset': offset,
        'limit': limit,
    }
@VictorTechs
Copy link
Collaborator

Hi @smadrigalb, sorry for the very long response, if you are able to create a fix, we will review it and merge it.

@IOR88
Copy link
Contributor

IOR88 commented Sep 22, 2024

Hi @smadrigalb we are now getting back to ocpi library maintenance, we will soon take care of the request you created, have you successfully integrated ocpi lib with your project ?

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

3 participants