fixed 新版竞赛增加专家评审

This commit is contained in:
xxq250 2025-02-27 16:04:39 +08:00
parent 992a59a5d4
commit af04527ddb
3 changed files with 16 additions and 2 deletions

View File

@ -2,16 +2,19 @@ class CompetitionInfosController < ApplicationController
include ApplicationHelper
before_action :find_competition, only: [:show, :edit, :update, :update_zone_or_sub, :enroll, :upload, :enroll_status,
:statistics, :enroll_list, :ranking_list, :enroll_update, :enroll_status_update, :apply_status_update,
:upload_enroll_template, :upload_apply_template, :enroll_template, :apply_template, :online_switch, :destroy]
:upload_enroll_template, :upload_apply_template, :enroll_template, :apply_template, :online_switch, :destroy, :update_expert_audit]
before_action :require_admin, only: [:new, :edit, :create, :destroy]
before_action :check_competition_manager, only: [:update, :enroll_status_update, :online_switch, :enroll_list, :enroll_template]
before_action :require_login, only: [:enroll, :enroll_update, :enroll_status_update, :upload, :upload_enroll_template]
before_action :require_login, only: [:enroll, :enroll_update, :enroll_status_update, :upload, :upload_enroll_template, :update_expert_audit]
def index
competition_infos = CompetitionInfo.order(sort_no: :desc)
competition_infos = competition_infos.where("competition_infos.title like ?", "%#{params[:name]}%") if params[:name].present?
competition_infos = competition_infos.joins(:watchers).where(watchers: { user_id: current_user.id }) if params[:category].to_s == "watched"
competition_infos = competition_infos.where(status: ActiveModel::Type::Boolean.new.cast(params[:status])) if ActiveModel::Type::Boolean.new.cast(params[:status]).present?
if params[:is_expert_audit].present?
competition_infos = competition_infos.where(:is_expert_audit => params[:is_expert_audit].to_s == "true")
end
@competition_infos = paginate(competition_infos)
respond_to do |format|
format.html
@ -42,6 +45,11 @@ class CompetitionInfosController < ApplicationController
render_ok(data: @competition_infos.as_json, count: @total_count)
end
def update_expert_audit
@competition_info.update_attributes(:is_expert_audit => params[:is_expert_audit].to_s == "true")
render_ok
end
# GET /competition_infos/new
def new
@competition_info = CompetitionInfo.new

View File

@ -476,6 +476,7 @@ Rails.application.routes.draw do
get :list, on: :collection
get :recommend, on: :collection
post :auto_score, on: :collection
post :update_expert_audit, on: :collection
member do
get :enroll_list
get :ranking_list

View File

@ -0,0 +1,5 @@
class AddCompetitionInfoExpertAudit < ActiveRecord::Migration[5.2]
def change
add_column :competition_infos, :is_expert_audit, :boolean, :default => false
end
end