commit/galaxy-central: greg: Eliminate the problematic Repository.ReviewedRevisions mapper from the tool shed model.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/70ae646e6892/ changeset: 70ae646e6892 user: greg date: 2012-10-23 22:20:05 summary: Eliminate the problematic Repository.ReviewedRevisions mapper from the tool shed model. affected #: 3 files diff -r d6ce5e2a1cdb8645f3490043b151f2b271f4b2b4 -r 70ae646e6892e7bb5a05500c99b4cfcc22495a37 lib/galaxy/webapps/community/controllers/common.py --- a/lib/galaxy/webapps/community/controllers/common.py +++ b/lib/galaxy/webapps/community/controllers/common.py @@ -156,11 +156,9 @@ def changeset_revision_reviewed_by_user( trans, user, repository, changeset_revision ): """Determine if the current changeset revision has been reviewed by the current user.""" changeset_revision_reviewed_by_user = False - for reviewed_revision in repository.reviewed_revisions: - if reviewed_revision.changeset_revision == changeset_revision: - for review in repository.reviews: - if review.changeset_revision == changeset_revision and review.user == user: - return True + for review in repository.reviews: + if review.changeset_revision == changeset_revision and review.user == user: + return True return False def check_file_contents( trans ): # See if any admin users have chosen to receive email alerts when a repository is updated. @@ -505,13 +503,15 @@ def get_previous_repository_reviews( trans, repository, changeset_revision ): """Return an ordered dictionary of repository reviews up to and including the received changeset revision.""" repo = hg.repository( get_configured_ui(), repository.repo_path ) - reviewed_revision_hashes = [ reviewed_revisions.changeset_revision for reviewed_revisions in repository.reviewed_revisions ] + reviewed_revision_hashes = [ review.changeset_revision for review in repository.reviews ] previous_reviews_dict = odict() for changeset in reversed_upper_bounded_changelog( repo, changeset_revision ): previous_changeset_revision = str( repo.changectx( changeset ) ) if previous_changeset_revision in reviewed_revision_hashes: previous_rev, previous_changeset_revision_label = get_rev_label_from_changeset_revision( repo, previous_changeset_revision ) - revision_reviews = get_reviews_by_repository_id_changeset_revision( trans, trans.security.encode_id( repository.id ), previous_changeset_revision ) + revision_reviews = get_reviews_by_repository_id_changeset_revision( trans, + trans.security.encode_id( repository.id ), + previous_changeset_revision ) previous_reviews_dict[ previous_changeset_revision ] = dict( changeset_revision_label=previous_changeset_revision_label, reviews=revision_reviews ) return previous_reviews_dict @@ -701,7 +701,7 @@ def has_previous_repository_reviews( trans, repository, changeset_revision ): """Determine if a repository has a changeset revision review prior to the received changeset revision.""" repo = hg.repository( get_configured_ui(), repository.repo_path ) - reviewed_revision_hashes = [ reviewed_revisions.changeset_revision for reviewed_revisions in repository.reviewed_revisions ] + reviewed_revision_hashes = [ review.changeset_revision for review in repository.reviews ] for changeset in reversed_upper_bounded_changelog( repo, changeset_revision ): previous_changeset_revision = str( repo.changectx( changeset ) ) if previous_changeset_revision in reviewed_revision_hashes: diff -r d6ce5e2a1cdb8645f3490043b151f2b271f4b2b4 -r 70ae646e6892e7bb5a05500c99b4cfcc22495a37 lib/galaxy/webapps/community/controllers/repository.py --- a/lib/galaxy/webapps/community/controllers/repository.py +++ b/lib/galaxy/webapps/community/controllers/repository.py @@ -1530,7 +1530,7 @@ if current_user: # See if the current user owns any repositories that have been reviewed. for repository in current_user.active_repositories: - if repository.reviewed_revisions: + if repository.reviews: has_reviewed_repositories = True break # See if the current user has any repositories that have been marked as deprecated. diff -r d6ce5e2a1cdb8645f3490043b151f2b271f4b2b4 -r 70ae646e6892e7bb5a05500c99b4cfcc22495a37 lib/galaxy/webapps/community/model/mapping.py --- a/lib/galaxy/webapps/community/model/mapping.py +++ b/lib/galaxy/webapps/community/model/mapping.py @@ -239,12 +239,7 @@ reviewers=relation( User, secondary=RepositoryReview.table, primaryjoin=( Repository.table.c.id == RepositoryReview.table.c.repository_id ), - secondaryjoin=( RepositoryReview.table.c.user_id == User.table.c.id ) ), - reviewed_revisions=relation( RepositoryMetadata, - secondary=RepositoryReview.table, - foreign_keys=[ RepositoryMetadata.table.c.repository_id, RepositoryMetadata.table.c.changeset_revision ], - primaryjoin=( Repository.table.c.id == RepositoryMetadata.table.c.repository_id ), - secondaryjoin=( ( RepositoryMetadata.table.c.repository_id == RepositoryReview.table.c.repository_id ) & ( RepositoryMetadata.table.c.changeset_revision == RepositoryReview.table.c.changeset_revision ) ) ) ) ) + secondaryjoin=( RepositoryReview.table.c.user_id == User.table.c.id ) ) ) ) assign_mapper( context, RepositoryMetadata, RepositoryMetadata.table, properties=dict( repository=relation( Repository ), Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket