ActiveAdmin create user fix, fix job shifting

This commit is contained in:
Wedge 2016-03-01 06:27:30 +03:00
parent 531c4ee8f1
commit 179abe356f
3 changed files with 13 additions and 11 deletions

View File

@ -7,6 +7,8 @@ ActiveAdmin.register User do
filter :role, as: :select, collection: User::EXTENDED_ROLES
filter :created_at
permit_params :name, :email, :uname, :role, :password, :password_confirmation
controller do
def update(options={}, &block)
user_params = params[:user]

View File

@ -8,17 +8,17 @@ class Api::V1::JobsController < Api::V1::BaseController
skip_after_action :verify_authorized
def shift
@build_list = BuildList.next_build(arch_ids, platform_ids) if current_user.system?
if @build_list
set_builder
else
build_lists = BuildList.scoped_to_arch(arch_ids).
for_status([BuildList::BUILD_PENDING, BuildList::RERUN_TESTS]).
for_platform(platform_ids).
oldest.order(:created_at)
uid = BuildList.scoped_to_arch(arch_ids).
for_status([BuildList::BUILD_PENDING, BuildList::RERUN_TESTS]).
for_platform(platform_ids).pluck('DISTINCT user_id').sample
if uid
build_lists = BuildList.for_status([BuildList::BUILD_PENDING, BuildList::RERUN_TESTS]).
where(user_id: uid).oldest.order(:created_at)
ActiveRecord::Base.transaction do
if current_user.system?
@build_list = build_lists.external_nodes("").first
@build_list ||= build_lists.external_nodes(:everything).first
else
@build_list = build_lists.external_nodes(:owned).for_user(current_user).first

View File

@ -183,9 +183,9 @@ class BuildList < ActiveRecord::Base
state_machine :status, initial: :waiting_for_response do
after_transition(on: [:place_build, :rerun_tests]) do |build_list, transition|
build_list.add_job_to_abf_worker_queue if build_list.external_nodes.blank?
end
#after_transition(on: [:place_build, :rerun_tests]) do |build_list, transition|
#build_list.add_job_to_abf_worker_queue if build_list.external_nodes.blank?
#end
after_transition on: :published,
do: %i(set_version_and_tag actualize_packages)