fix bugs in version 1.
This commit is contained in:
parent
e121a48aa7
commit
0c4b2c5ebd
|
@ -338,6 +338,7 @@ class Admin::OlympiamanagementsController < OrbitAdminController
|
|||
@value = field[field_name] rescue ""
|
||||
@index = @field_infos.map{|hash| hash.keys[0]}.index(field_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'
|
||||
if !['String','Year','select_num','File'].include?(@field_infos.map{|hash| hash.values[0]}[@index]['type'])
|
||||
@value = (@field_infos.map{|hash| hash.values[0]}[@index]['values'][I18n.locale.to_s][@value.to_i].to_s rescue @value)
|
||||
end
|
||||
|
|
|
@ -14,7 +14,16 @@ wb.add_worksheet(name: "school_class") do |sheet|
|
|||
@OlympiaSchoolDataFields.each do |school_data_field|
|
||||
temp_row = []
|
||||
@fields.each do |field_key|
|
||||
temp_row << (school_data_field[field_key].to_s rescue '')
|
||||
if field_key == "enrollment_limited"
|
||||
if school_data_field.enrollment_limited.to_i == 0
|
||||
enrollment_limited = ClassSettingFields.all.select{|class_setting_field| class_setting_field.class_number_range[0] <= school_data_field.class_number && class_setting_field.class_number_range[1] >= school_data_field.class_number}.first.enrollment_available.to_s rescue ClassSettingFields.all.desc(:enrollment_available).first.enrollment_available.to_s
|
||||
else
|
||||
enrollment_limited = school_data_field.enrollment_limited
|
||||
end
|
||||
temp_row << enrollment_limited
|
||||
else
|
||||
temp_row << (school_data_field[field_key].to_s rescue '')
|
||||
end
|
||||
end
|
||||
export_data_rows << temp_row
|
||||
end
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<%= f.check_box(:remove_image,{:checked=>false},"true","false") %>
|
||||
<%= t(:remove) %> <%= (I18n.locale.to_s == 'en') ? ' this image' : '該圖片' %>
|
||||
<%else%>
|
||||
<span class="btn btn-file">
|
||||
<%= f.fields_for image_field_name do |index| %>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<% if record_item == "enrollment_limited"%>
|
||||
<% @olympia_school_data_field = OlympiaSchoolDataFields.find(@olympia_school_data_fields_id)%>
|
||||
<% if(@olympia_school_data_field.enrollment_limited.to_i == 0) %>
|
||||
<td><%= ClassSettingFields.all.select{|class_setting_field| class_setting_field.class_number_range[0] <= @olympia_school_data_field.class_number && class_setting_field.class_number_range[1] >= @olympia_school_data_field.class_number}.first.enrollment_available.to_s %></td>
|
||||
<td><%= ClassSettingFields.all.select{|class_setting_field| class_setting_field.class_number_range[0] <= @olympia_school_data_field.class_number && class_setting_field.class_number_range[1] >= @olympia_school_data_field.class_number}.first.enrollment_available.to_s rescue ClassSettingFields.all.desc(:enrollment_available).first.enrollment_available.to_s %></td>
|
||||
<% else %>
|
||||
<td><%= @olympia_school_data_field.enrollment_limited %></td>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue