Merge branch 'dev_local' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_local

dev_local
cxt 6 years ago
commit 8db3062fc3

@ -61,6 +61,12 @@ class LocalSettingsController < ApplicationController
respond_to do |format|
if @local_setting.update_attributes(params[:local_setting])
if params[:local_setting][:exam] == "0"
Shixun.where(local_status: 2).update_all(status: 2, local_status: 0)
elsif params[:local_setting][:exam] == "1"
Shixun.where(status: 2).update_all(status: 0, local_status: 2)
end
format.html { redirect_to @local_setting, notice: 'Local setting was successfully updated.' }
format.json { head :no_content }
else

@ -0,0 +1,12 @@
class AddLocalStatusToShixuns < ActiveRecord::Migration
def change
add_column :shixuns, :local_status, :integer, :limit => 1
Shixun.find_each do |shixun|
begin
shixun.local_status = shixun.status.to_i
shixun.save!
rescue Exception => e
end
end
end
end
Loading…
Cancel
Save