Skip to content

Commit

Permalink
refact(sensitivity): instead of count query use rowcount to get numbe…
Browse files Browse the repository at this point in the history
…r of removed sensitivity rule (#3323)
  • Loading branch information
jacquesfize authored Jan 15, 2025
1 parent 5e166f3 commit e0790c6
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions backend/geonature/core/sensitivity/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,4 @@ def insert_sensitivity_referential(source, csvfile):

def remove_sensitivity_referential(source):
whereclause = SensitivityRule.source == source
count_source = db.session.scalar(
sa.select(sa.func.count()).where(whereclause),
)
db.session.execute(sa.delete(SensitivityRule).where(whereclause))
return count_source
return db.session.execute(sa.delete(SensitivityRule).where(whereclause)).rowcount

0 comments on commit e0790c6

Please sign in to comment.