changeset 4747:89bf1b081cc6

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.
author Mads Kiilerich <madski@unity3d.com>
date Tue, 06 Jan 2015 00:54:36 +0100
parents cc1ab5ef6686
children b91c5a6327bd
files kallithea/model/db.py
diffstat 1 files changed, 3 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/model/db.py	Tue Jan 06 00:54:36 2015 +0100
+++ b/kallithea/model/db.py	Tue Jan 06 00:54:36 2015 +0100
@@ -1362,7 +1362,8 @@
 
     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 @@
             .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: