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

added pagination for arguments #240

Merged
merged 16 commits into from
Jul 7, 2024
Merged

added pagination for arguments #240

merged 16 commits into from
Jul 7, 2024

Conversation

purple-void
Copy link
Collaborator

we also added some comments

@purple-void purple-void linked an issue Jul 2, 2024 that may be closed by this pull request
2 tasks
Copy link

vercel bot commented Jul 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rebutify ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2024 0:11am

@purple-void purple-void marked this pull request as ready for review July 2, 2024 17:56
@purple-void purple-void self-assigned this Jul 2, 2024
@purple-void purple-void added [ backend / feature Functionality or significant enhancement for the project labels Jul 2, 2024
Copy link
Owner

@Monstarrrr Monstarrrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Why are we making pagination for arguments specifically? Isn't pagination the same logic regardless of the type of content?
    Use django setting to apply to any endpoint

  2. The front-end should be able to decide on how many items per page there are. Do not hard-code it in the back-end unless as a default value

@purple-void
Copy link
Collaborator Author

purple-void commented Jul 4, 2024

@Monstarrrr we changed pagination to apply globally. PAGE_SIZE is set in env. Does that work for the front-end?

Copy link
Collaborator

@seporterfield seporterfield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented 2 changes
looks great and nice job!

@purple-void
Copy link
Collaborator Author

failed? boooo

@purple-void
Copy link
Collaborator Author

purple-void commented Jul 4, 2024

@seporterfield we think the checks are wrong. we can't reproduce the error in our code

@seporterfield
Copy link
Collaborator

@seporterfield we think the checks are wrong. we can't reproduce the error in our code

did you read the error/output of the checks?

@purple-void
Copy link
Collaborator Author

purple-void commented Jul 6, 2024

@seporterfield we think the checks are wrong. we can't reproduce the error in our code

did you read the error/output of the checks?

"PAGE_SIZE": int(os.getenv("PAGE_SIZE", 10)),
ValueError: invalid literal for int() with base 10: ''

We get this error only here with GitHub actions. PAGE_SIZE is '' here. That doesn't happen in our code. This would be fixed if PAGE_SIZE was set in the workflow file.

@seporterfield
Copy link
Collaborator

seporterfield commented Jul 6, 2024

The way we're parsing .env variables has a side effect of any empty variables in .env being parsed as the empty string instead of None which is kinda annoying but I haven't been able to find a solution that doesn't make things even harder for people trying to use our project.

Fix:
Make PAGE_SIZE=20 in .template-env
For now any variables pulled in from .env that need a type conversion will have to have a set default in .template-env
Otherwise the conversion will fail or have unintended behavior since it's trying to convert from an empty string.

@purple-void
Copy link
Collaborator Author

Fix: Make PAGE_SIZE=20 in .template-env For now any variables pulled in from .env that need a type conversion will have to have a set default in .template-env Otherwise the conversion will fail or have unintended behavior since it's trying to convert from an empty string.

We fixed it for now with "PAGE_SIZE": int(os.getenv("PAGE_SIZE", "10") or "10")

@seporterfield
Copy link
Collaborator

We fixed it for now with "PAGE_SIZE": int(os.getenv("PAGE_SIZE", "10") or "10")

this is probably the best long term strategy for non-string env vars, looks great

@purple-void purple-void marked this pull request as ready for review July 6, 2024 20:16
@purple-void purple-void requested review from seporterfield and removed request for seporterfield July 6, 2024 20:17
@purple-void purple-void marked this pull request as draft July 6, 2024 20:19
@purple-void
Copy link
Collaborator Author

we deleted endpoints with parameters (except for page_size) as they weren't relevant to this branch, and @Monstarrrr decided on different endpoints. will implement those in a new branch

@purple-void purple-void marked this pull request as ready for review July 7, 2024 00:12
Copy link
Owner

@Monstarrrr Monstarrrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To the rescue

@Monstarrrr Monstarrrr merged commit 01eb8f4 into main Jul 7, 2024
10 checks passed
@Monstarrrr Monstarrrr deleted the feat/135_api_viewsets branch July 7, 2024 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ backend / feature Functionality or significant enhancement for the project
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Modify API ViewSet: arguments with pagination
3 participants