
from sqlalchemy import or_, func
from sqlalchemy.exc import IntegrityError

from pybossa.repositories import Repository
from pybossa.model.project_stats import ProjectStats
from pybossa.exc import WrongObjectError, DBIntegrityError


class ProjectStatsRepository(Repository):

    def __init__(self, db):
        self.db = db

    def get(self, id):
        return self.db.session.query(ProjectStats).get(id)

    def filter_by(self, limit=None, offset=0, yielded=False, last_id=None,
                  desc=False, **filters):
        return self._filter_by(ProjectStats, limit, offset, yielded,
                               last_id, **filters)


from sqlalchemy import or_, func
from sqlalchemy.exc import IntegrityError

from pybossa.repositories import Repository
from pybossa.model.project_stats import ProjectStats
from pybossa.exc import WrongObjectError, DBIntegrityError


class ProjectStatsRepository(Repository):

    def __init__(self, db):
        self.db = db

    def get(self, id):
        return self.db.session.query(ProjectStats).get(id)

    def filter_by(self, limit=None, offset=0, yielded=False, last_id=None,
                  fulltextsearch=None, desc=False, orderby='id',
                  **filters):
        return self._filter_by(ProjectStats, limit, offset, yielded,
                               last_id, fulltextsearch, desc, orderby,
                               **filters)

Add desc and orderby to repo
Add desc and orderby to repo

  
  from sqlalchemy import or_, func
  from sqlalchemy.exc import IntegrityError
  
  from pybossa.repositories import Repository
  from pybossa.model.project_stats import ProjectStats
  from pybossa.exc import WrongObjectError, DBIntegrityError
  
  
  class ProjectStatsRepository(Repository):
  
      def __init__(self, db):
          self.db = db
  
      def get(self, id):
          return self.db.session.query(ProjectStats).get(id)
  
      def filter_by(self, limit=None, offset=0, yielded=False, last_id=None,
+                   fulltextsearch=None, desc=False, orderby='id',
-                   desc=False, **filters):
+                   **filters):
          return self._filter_by(ProjectStats, limit, offset, yielded,
+                                last_id, fulltextsearch, desc, orderby,
-                                last_id, **filters)
+                                **filters)
  
Add desc and orderby to repo
## Code Before:

from sqlalchemy import or_, func
from sqlalchemy.exc import IntegrityError

from pybossa.repositories import Repository
from pybossa.model.project_stats import ProjectStats
from pybossa.exc import WrongObjectError, DBIntegrityError


class ProjectStatsRepository(Repository):

    def __init__(self, db):
        self.db = db

    def get(self, id):
        return self.db.session.query(ProjectStats).get(id)

    def filter_by(self, limit=None, offset=0, yielded=False, last_id=None,
                  desc=False, **filters):
        return self._filter_by(ProjectStats, limit, offset, yielded,
                               last_id, **filters)

## Instruction:
Add desc and orderby to repo
## Code After:

from sqlalchemy import or_, func
from sqlalchemy.exc import IntegrityError

from pybossa.repositories import Repository
from pybossa.model.project_stats import ProjectStats
from pybossa.exc import WrongObjectError, DBIntegrityError


class ProjectStatsRepository(Repository):

    def __init__(self, db):
        self.db = db

    def get(self, id):
        return self.db.session.query(ProjectStats).get(id)

    def filter_by(self, limit=None, offset=0, yielded=False, last_id=None,
                  fulltextsearch=None, desc=False, orderby='id',
                  **filters):
        return self._filter_by(ProjectStats, limit, offset, yielded,
                               last_id, fulltextsearch, desc, orderby,
                               **filters)
