Skip to content

Commit

Permalink
Fix ready list in obs-factory staging dashboard
Browse files Browse the repository at this point in the history
Since last refactor on this code, the Ready list was always empty. It
was taking request by reviews with 'new' state, whereas, in this case,
the review shouldn't be fixed to any state.

Co-authored-by: David Kang <dkang@suse.com>
  • Loading branch information
saraycp and DavidKang committed Dec 13, 2018
1 parent 09c58f0 commit edcd1c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ def index
@staging_projects = ::ObsFactory::StagingProjectPresenter.sort(@distribution.staging_projects_all)
@backlog_requests = BsRequest.with_open_reviews_for(by_group: @distribution.staging_manager)
.with_target_project(@distribution.name)
@requests_state_new = @backlog_requests.rewhere(state: :new)
@requests_state_new = BsRequest.new_with_reviews_for(by_group: @distribution.staging_manager)
.with_target_project(@distribution.name)

staging_project = Project.find_by_name("#{@distribution.project}:Staging")
@ignored_requests = staging_project.dashboard.try(:ignored_requests)
Expand Down
3 changes: 3 additions & 0 deletions src/api/app/models/bs_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ class SaveError < APIError
scope :with_target_project, lambda { |target_project|
includes(:bs_request_actions).where('bs_request_actions.target_project': target_project)
}
scope :new_with_reviews_for, lambda { |review_attributes|
where(state: 'new').where(id: Review.where(review_attributes).select(:bs_request_id)).includes(:reviews)
}
scope :with_open_reviews_for, lambda { |review_attributes|
where(state: 'review', id: Review.where(review_attributes).where(state: 'new').pluck(:bs_request_id))
.includes(:reviews)
Expand Down

0 comments on commit edcd1c7

Please sign in to comment.