This commit is contained in:
BoHung Chiu 2022-11-04 12:38:27 +08:00
parent 8ee0655923
commit 452e0e0705
3 changed files with 7 additions and 6 deletions

View File

@ -6,6 +6,6 @@ class SeminarSignupFieldCustom
field :hidden, type: Boolean, default: true
belongs_to :seminar_main
def seminar_signup_field
SeminarSignupField.find(self.seminar_signup_field_id) rescue nil
SeminarSignupField.find(self.seminar_signup_field_id) rescue nil
end
end

View File

@ -30,8 +30,8 @@
<% end %>
<% if @seminar.seminar_signup_field_customs.count != 0 %>
<% @seminar.seminar_signup_field_customs.each do |field_set| %>
<% s = SeminarSignupField.where(id:field_set.seminar_signup_field_id).first %>
<% next if s.key.blank? %>
<% s = field_set.seminar_signup_field %>
<% next if (s.nil? || s.key.blank?) %>
<% default_hidden << "seminar_signup_field_custom.#{s.key}" if (field_set.hidden) %>
<% end %>
<% end %>
@ -113,7 +113,8 @@
<% seminar_signup_field_customs = SeminarSignupFieldCustom.all.map{|field_set| SeminarSignupField.where(id: field_set.seminar_signup_field_id).first}.select{|s| !s.nil?}.uniq{|s| s.key } %>
<% if seminar_signup_field_customs.count != 0 %>
<% seminar_signup_field_customs.each do |s| %>
<% next if s.key.blank? %>
<% s = field_set.seminar_signup_field %>
<% next if (s.nil? || s.key.blank?) %>
<% default_hidden << "seminar_signup_field_custom.#{s.key}" if (field_set.hidden) %>
<% end %>
<% end %>

View File

@ -55,10 +55,10 @@ wb.add_worksheet(name: (@seminar.title.to_s[0..27]+'...')) do |sheet|
@seminar.seminar_signup_fields.asc(:_id).each do |rf|
if rf.can_muti_lang_input?
@site_in_use_locales.each do |l|
row2 << nl2br(show_attribute_value(@seminar.get_attribute_value(rf,signup.id).get_value_by_locale(l))) rescue ' '
row2 << (@seminar.get_attribute_value(rf,signup.id).get_value_by_locale(l) rescue '')
end
else
row2 << nl2br(show_attribute_value(@seminar.get_attribute_value(rf,signup.id).get_value_by_locale(I18n.locale))) rescue ' '
row2 << (@seminar.get_attribute_value(rf,signup.id).get_value_by_locale(I18n.locale) rescue '')
end
end
types = (0...row2.count).map{|i| types[i]}