# HG changeset patch # User Mads Kiilerich # Date 2015-01-06 00:54:36 # Node ID 89bf1b081cc6449a7b9c0eb5c7b7f1864a0f22b0 # Parent cc1ab5ef6686526b7aad8c0c190a5c2944e92ecf changeset status: drop default 'unreviewed' status for changesets on PRs The default is expensive to compute and doesn't scale - especially not with the current data model where all pull-request revisions are stored in a single field and not just can be indexed and join in the database. diff --git a/kallithea/model/db.py b/kallithea/model/db.py --- a/kallithea/model/db.py +++ b/kallithea/model/db.py @@ -1362,7 +1362,8 @@ class Repository(Base, BaseModel): def statuses(self, revisions): """ - Returns statuses for this repository + Returns statuses for this repository. + PRs without any votes do _not_ show up as unreviewed. :param revisions: list of revisions to get statuses for """ @@ -1373,16 +1374,8 @@ class Repository(Base, BaseModel): .filter(ChangesetStatus.repo == self)\ .filter(ChangesetStatus.version == 0)\ .filter(ChangesetStatus.revision.in_(revisions)) + grouped = {} - - stat = ChangesetStatus.DEFAULT - status_lbl = ChangesetStatus.get_status_lbl(stat) - for pr in PullRequest.query().filter(PullRequest.org_repo == self).all(): - for rev in pr.revisions: - pr_id = pr.pull_request_id - pr_repo = pr.other_repo.repo_name - grouped[rev] = [stat, status_lbl, pr_id, pr_repo] - for stat in statuses.all(): pr_id = pr_repo = None if stat.pull_request: