Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun
commit
316b1bdb73
@ -1,6 +1,6 @@
|
||||
json.(@bank, :id, :name, :description, :is_public, :topic_type, :topic_source, :topic_property_first, :topic_property_second,
|
||||
:source_unit, :topic_repeat, :province, :city)
|
||||
json.authorize @bank.user_id == current_user.id || current_user.admin?
|
||||
json.authorize @bank.user_id == current_user.id || current_user.admin_or_business?
|
||||
|
||||
json.attachment_list @bank_attachments do |attachment|
|
||||
json.partial! "attachments/attachment_simple", locals: {attachment: attachment}
|
||||
|
@ -0,0 +1,11 @@
|
||||
class AddUniqIndexToEvaluationDistribution < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
sql = %Q(delete from student_works_evaluation_distributions where (user_id, student_work_id) in
|
||||
(select * from (select user_id, student_work_id from student_works_evaluation_distributions group by user_id, student_work_id having count(*) > 1) a)
|
||||
and id not in (select * from (select min(id) from student_works_evaluation_distributions group by user_id, student_work_id having count(*) > 1 order by id) b))
|
||||
ActiveRecord::Base.connection.execute sql
|
||||
|
||||
add_index :student_works_evaluation_distributions, [:student_work_id, :user_id], name: "index_on_student_work_id_and_user_id", unique: true
|
||||
remove_index :student_works_evaluation_distributions, :user_id
|
||||
end
|
||||
end
|
Loading…
Reference in new issue