-
Notifications
You must be signed in to change notification settings - Fork 6
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
GenericQuery: fix bug negative limit #51
GenericQuery: fix bug negative limit #51
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #51 +/- ##
========================================
Coverage 82.72% 82.72%
========================================
Files 4 4
Lines 272 272
========================================
Hits 225 225
Misses 47 47
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok pour moi. En effet, c'est bizarre comme comportement... Juste une petite modification et je merge 👍
src/utils_flask_sqla/generic.py
Outdated
@@ -255,7 +254,7 @@ def raw_query(self, process_filter=True, with_limit=True): | |||
unordered_q = self.build_query_filters(q, self.filters) | |||
q = self.build_query_order(unordered_q, self.filters) | |||
|
|||
if self.limit != -1 and with_limit: | |||
if self.limit != -1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if self.limit != -1: | |
if self.limit >0: |
Tu fais la modification ou je la fais ? Si je la fais, il faudrait que tu me donnes les droits. |
Il me semble qu'il y a un bug entre la version 0.3.3 et la version 0.4.1 quand on utilise limit=-1 dans la GenericQuery :
{"code": 500, "description": "(psycopg2.errors.InvalidRowCountInLimitClause) LIMIT must not be negative}
J'ai ce bug quand je clique sur le bouton 'générer la liste des espèces' (qui utilise Generic Query) dans le module zones humides (onglet 5) lorsque la version de Utils-Flask-SQLAlchemy est 0.4.1 mais pas lorsque qu'elle est en 0.3.3.
Voici une proposition de correction avec suppression de l'argument with_limit. J'ai peut-être manqué quelque chose mais je ne comprends pas vraiment en quoi cet argument est utile ? Si limit=-1 de toute façon il n'y a pas de limite et sinon on renseigne la limite souhaitée.