diff --git a/app/helpers/admin/personal_conferences_helper.rb b/app/helpers/admin/personal_conferences_helper.rb
index 52ce5b6..b0c1065 100644
--- a/app/helpers/admin/personal_conferences_helper.rb
+++ b/app/helpers/admin/personal_conferences_helper.rb
@@ -1,12 +1,33 @@
module Admin::PersonalConferencesHelper
def get_authors_text(writing_conference)
- (writing_conference.authors.to_s.blank? ? get_member(writing_conference).collect(&:name).join('/') : Nokogiri::HTML(writing_conference.authors.to_s).text rescue '')
- end
- def get_authors_show(writing_conference)
- (writing_conference.authors.to_s.blank? ? get_member_show(writing_conference) : writing_conference.authors.to_s rescue '')
- end
+ authors_text = Nokogiri::HTML(writing_conference.authors.to_s).text
+ split_text = authors_text.match(/[、,,\/]/)
+ split_text = split_text.nil? ? '/' : split_text[0]
+ full_authors_names = get_member(writing_conference).collect(&:name)
+ if authors_text.present?
+ authors_names = authors_text.split(split_text).select{|a| !(full_authors_names.include?(a.strip()))}
+ full_authors_names += authors_names
+ end
+ full_authors_names.join(split_text)
+ end
+ def get_authors_show(writing_conference)
+ authors_text = Nokogiri::HTML(writing_conference.authors.to_s).text
+ split_text = authors_text.match(/[、,,\/]/)
+ split_text = split_text.nil? ? '/' : split_text[0]
+ full_authors_names = []
+ full_authors = get_member(writing_conference).collect{|member|
+ member_name = member.name
+ full_authors_names << member_name
+ "#{member_name}"
+ }
+ if authors_text.present?
+ authors_names = authors_text.split(split_text).select{|a| !(full_authors_names.include?(a.strip()))}
+ full_authors += authors_names
+ end
+ full_authors.join(split_text)
+ end
def get_member(writing_conference)
- Array(MemberProfile.find(Array(writing_conference).collect(&:member_profile_id)))
+ Array(MemberProfile.where(:id.in=>Array(writing_conference).collect(&:member_profile_id).flatten))
end
def get_member_show(writing_conference)
get_member(writing_conference).collect{|member| "#{member.name}"}.join('/')
diff --git a/app/models/writing_conference.rb b/app/models/writing_conference.rb
index 78d71c1..60cd5d1 100644
--- a/app/models/writing_conference.rb
+++ b/app/models/writing_conference.rb
@@ -199,7 +199,7 @@ class WritingConference
when "url"
value = self.url.to_s.blank? ? "" : "#{self.url}"
when "authors"
- value = get_member_show(self) rescue ""
+ value = get_authors_show(self) rescue ""
else
value = self.send(field) rescue ""
end