Skip to content

Commit

Permalink
Fixed lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkCalvert committed Sep 11, 2024
1 parent 76c1469 commit 6efc9dc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ckanext/datarequests/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,22 @@ class DataRequest(model.core.StatefulObjectMixin, model.DomainObject):
def get(cls, **kw):
'''Finds all the instances required.'''
query = model.Session.query(cls).autoflush(False)
query = query.filter(or_(cls.state == model.core.State.ACTIVE, cls.state == None))
query = query.filter(or_(cls.state == model.core.State.ACTIVE, cls.state is None))
return query.filter_by(**kw).all()

@classmethod
def datarequest_exists(cls, title):
'''Returns true if there is a Data Request with the same title (case insensitive)'''
query = model.Session.query(cls).autoflush(False)
query = query.filter(or_(cls.state == model.core.State.ACTIVE, cls.state == None))
query = query.filter(or_(cls.state == model.core.State.ACTIVE, cls.state is None))
return query.filter(func.lower(cls.title) == func.lower(title)).first() is not None

@classmethod
def get_ordered_by_date(cls, requesting_organisation=None, user_id=None, closed=None, q=None, desc=False, status=None, state=None):
'''Personalized query'''
query = model.Session.query(cls).autoflush(False)
if state is None:
query = query.filter(or_(cls.state == model.core.State.ACTIVE, cls.state == None))
query = query.filter(or_(cls.state == model.core.State.ACTIVE, cls.state is None))
else:
query = query.filter_by(state=state)

Expand Down Expand Up @@ -127,7 +127,7 @@ def get_ordered_by_date(cls, requesting_organisation=None, user_id=None, closed=
@classmethod
def get_open_datarequests_number(cls):
'''Returns the number of data requests that are open'''
return model.Session.query(func.count(cls.id)).filter_by(closed=False).filter(or_(cls.state == model.core.State.ACTIVE, cls.state == None)).scalar()
return model.Session.query(func.count(cls.id)).filter_by(closed=False).filter(or_(cls.state == model.core.State.ACTIVE, cls.state is None)).scalar()


class Comment(model.DomainObject):
Expand Down

0 comments on commit 6efc9dc

Please sign in to comment.