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
|
if @id_error_msg.length != 0
|
||||||
@error_msg << I18n.t('olympiamanagement.id_number_error')
|
@error_msg << I18n.t('olympiamanagement.id_number_error')
|
||||||
end
|
end
|
||||||
if (@student_params['StudentIdentity'] == '1' || @student_params['StudentIdentity'] == '2') && (@student_params['olympia_student_images']['0']['student_file'].nil? 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 (@olympia_student_data.olympia_student_images.empty? || !@olympia_student_data.olympia_student_images.first.student_file.file.present? 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')
|
@error_msg << I18n.t('olympiamanagement.StudentFile')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,13 +5,13 @@ class OlympiaSchoolDataFields
|
||||||
include OrbitModel::Impression
|
include OrbitModel::Impression
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
field :account_number , type: String , default: ''
|
field :account_number , type: String , default: ''
|
||||||
field :password , type: String , default: ''
|
field :password , type: String , default: ''
|
||||||
field :school_name , type: String , default: ''
|
field :school_name , type: String , default: ''
|
||||||
field :school_code , type: String , default: ''
|
field :school_code , type: String , default: ''
|
||||||
field :school_address , type: String , default: ''
|
field :school_address , type: String , default: ''
|
||||||
field :class_number , type: Fixnum , default: 0
|
field :class_number , type: Fixnum , default: 0
|
||||||
field :enrollment_limited , type: Fixnum , default: 0
|
field :enrollment_limited , type: Fixnum , default: 0
|
||||||
field :school_contact_person_name , type: String , default: ''
|
field :school_contact_person_name , type: String , default: ''
|
||||||
field :department_job_title , type: String , default: ''
|
field :department_job_title , type: String , default: ''
|
||||||
field :office_tel_number , type: String , default: ''
|
field :office_tel_number , type: String , default: ''
|
||||||
field :fax , type: String , default: ''
|
field :fax , type: String , default: ''
|
||||||
|
|
|
@ -47,13 +47,13 @@ class SignUpSetting
|
||||||
@sign_up_setting = SignUpSetting.where(:id.ne=>record.id).last
|
@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 = OlympiaSchoolDataFields.where(:sign_up_setting_id=>@sign_up_setting.id).take_while{true}
|
||||||
@schools.each do |school|
|
@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
|
||||||
end
|
end
|
||||||
def change_all_password
|
def change_all_password
|
||||||
if self.set_default_password && !self.default_password.blank?
|
if self.set_default_password && !self.default_password.blank?
|
||||||
OlympiaSchoolDataFields.where(:sign_up_setting_id=>self.id).each do |school_field|
|
OlympiaSchoolDataFields.where(:sign_up_setting_id=>self.id).each do |school_field|
|
||||||
school_field.password = self.default_password
|
school_field.password = ""
|
||||||
school_field.save
|
school_field.save
|
||||||
end
|
end
|
||||||
self.set_default_password = false
|
self.set_default_password = false
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
<% @value = field[th_name] %>
|
<% @value = field[th_name] %>
|
||||||
<% @index = @field_infos.map{|hash| hash.keys[0]}.index(th_name) rescue nil%>
|
<% @index = @field_infos.map{|hash| hash.keys[0]}.index(th_name) rescue nil%>
|
||||||
<% if !@index.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))%>
|
<% (['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 %>
|
<% end %>
|
||||||
<td><%= @value %></td>
|
<td><%= @value %></td>
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
<% @value = field[th_name] %>
|
<% @value = field[th_name] %>
|
||||||
<% @index = @field_infos.map{|hash| hash.keys[0]}.index(th_name) rescue nil%>
|
<% @index = @field_infos.map{|hash| hash.keys[0]}.index(th_name) rescue nil%>
|
||||||
<% if !@index.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))%>
|
<% (['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 %>
|
<% end %>
|
||||||
<td><%= @value %></td>
|
<td><%= @value %></td>
|
||||||
|
|
Loading…
Reference in New Issue