fix bugs in version 1
This commit is contained in:
parent
52c2e92da2
commit
e121a48aa7
|
@ -677,8 +677,8 @@ class OlympiamanagementsController < ApplicationController
|
|||
if @id_error_msg.length != 0
|
||||
@error_msg << I18n.t('olympiamanagement.id_number_error')
|
||||
end
|
||||
if (@student_params['StudentIdentity'] == '1' || @student_params['StudentIdentity'] == '2') && (@student_params['olympia_student_images']['0']['student_file'].nil? rescue true)
|
||||
if (@olympia_student_data.olympia_student_images.empty? || !@olympia_student_data.olympia_student_images.first.student_file.file.present? rescue true)
|
||||
if (@student_params['StudentIdentity'] == '1' || @student_params['StudentIdentity'] == '2') && (@student_params['remove_image']=='true' || (@student_params['olympia_student_images']['0']['student_file'].nil? rescue true))
|
||||
if @student_params['remove_image']=='true' || (@olympia_student_data.olympia_student_images.empty? || !@olympia_student_data.olympia_student_images.first.student_file.file.present? rescue true)
|
||||
@error_msg << I18n.t('olympiamanagement.StudentFile')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -47,13 +47,13 @@ class SignUpSetting
|
|||
@sign_up_setting = SignUpSetting.where(:id.ne=>record.id).last
|
||||
@schools = OlympiaSchoolDataFields.where(:sign_up_setting_id=>@sign_up_setting.id).take_while{true}
|
||||
@schools.each do |school|
|
||||
OlympiaSchoolDataFields.create(school.attributes.except(*['_id','enrollment',"view_count","created_at","updated_at","sign_up_setting_id"]).merge({:sign_up_setting_id => record.id}))
|
||||
OlympiaSchoolDataFields.create(school.attributes.slice(*["account_number","password","school_name","school_code","school_address","class_number"]).merge({:sign_up_setting_id => record.id}))
|
||||
end
|
||||
end
|
||||
def change_all_password
|
||||
if self.set_default_password && !self.default_password.blank?
|
||||
OlympiaSchoolDataFields.where(:sign_up_setting_id=>self.id).each do |school_field|
|
||||
school_field.password = self.default_password
|
||||
school_field.password = ""
|
||||
school_field.save
|
||||
end
|
||||
self.set_default_password = false
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
<% @value = field[th_name] %>
|
||||
<% @index = @field_infos.map{|hash| hash.keys[0]}.index(th_name) rescue nil%>
|
||||
<% if !@index.nil? %>
|
||||
<% @value = @field_infos.map{|hash| hash.values[0]}[@index]['choices'].index(@value) if @field_infos.map{|hash| hash.values[0]}[@index]['type'] == 'radio' %>
|
||||
<% (['String','Year','select_num','File'].include?(@field_infos.map{|hash| hash.values[0]}[@index]['type'])) ? (nil) : (@value=(@field_infos.map{|hash| hash.values[0]}[@index]['values'][I18n.locale.to_s][@value.to_i].to_s rescue @value))%>
|
||||
<% end %>
|
||||
<td><%= @value %></td>
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
<% @value = field[th_name] %>
|
||||
<% @index = @field_infos.map{|hash| hash.keys[0]}.index(th_name) rescue nil%>
|
||||
<% if !@index.nil? %>
|
||||
<% @value = @field_infos.map{|hash| hash.values[0]}[@index]['choices'].index(@value) if @field_infos.map{|hash| hash.values[0]}[@index]['type'] == 'radio' %>
|
||||
<% (['String','Year','select_num','File'].include?(@field_infos.map{|hash| hash.values[0]}[@index]['type'])) ? (nil) : (@value=(@field_infos.map{|hash| hash.values[0]}[@index]['values'][I18n.locale.to_s][@value.to_i].to_s rescue @value))%>
|
||||
<% end %>
|
||||
<td><%= @value %></td>
|
||||
|
|
Loading…
Reference in New Issue