From fc6b297917346180ef51a5eefdd52002ef2e04d5 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 28 Feb 2024 13:25:41 -0500 Subject: [PATCH 1/3] Add tags to the published output Also seperate areas for better findability --- app/serializers/conclar/session_serializer.rb | 13 ++++++++++--- app/services/publication_service.rb | 3 +++ app/services/session_service.rb | 18 +++++++++++++++--- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/app/serializers/conclar/session_serializer.rb b/app/serializers/conclar/session_serializer.rb index 295644063..05972b1a2 100644 --- a/app/serializers/conclar/session_serializer.rb +++ b/app/serializers/conclar/session_serializer.rb @@ -21,8 +21,7 @@ class Conclar::SessionSerializer < ActiveModel::Serializer object.start_time end - - attribute :tags do + attribute :areas do |session| res = [] object.area_list.each do |area| @@ -34,6 +33,14 @@ class Conclar::SessionSerializer < ActiveModel::Serializer res << a end + res + end + + attribute :tags do + res = [] + + res = session.taggings.select{|t| t.context == 'tags'}.collect(&:tag).collect(&:name) + case object.environment when 'in_person' t = { @@ -53,7 +60,7 @@ class Conclar::SessionSerializer < ActiveModel::Serializer t = { value: "session_".concat(object.environment), category: "Environment", - label: 'Virtual' + label: 'Online' } res << t else diff --git a/app/services/publication_service.rb b/app/services/publication_service.rb index fd599a814..f924ce4e0 100644 --- a/app/services/publication_service.rb +++ b/app/services/publication_service.rb @@ -129,6 +129,9 @@ def self.publish_session(session:, update: true) pub_session.send("#{attr}=", val) # the the attr in the publihsed instance end + # Need to copy the tags to the puiblished session + pub_session.tag_list = session.tag_list + pub_session.session_id = session.id unless pub_session.session_id # point published to source session pub_session diff --git a/app/services/session_service.rb b/app/services/session_service.rb index 36a7a769c..5aa84c32a 100644 --- a/app/services/session_service.rb +++ b/app/services/session_service.rb @@ -99,7 +99,11 @@ def self.published_sessions_unordered ::PublishedSession.arel_table[Arel.star], 'areas_list.area_list' ) - .includes(:format, :room, {participant_assignments: :person}) + .includes( + :format, :room, + {participant_assignments: :person}, + {taggings: :tag} + ) .joins(self.area_subquery(clazz: PublishedSession)) end @@ -112,7 +116,11 @@ def self.draft_sessions ::Session.arel_table[Arel.star], 'areas_list.area_list' ) - .includes(:format, :room, {participant_assignments: :person}) + .includes( + :format, :room, + {participant_assignments: :person}, + {taggings: :tag} + ) .joins(self.area_subquery) .where("start_time is not null and room_id is not null") .where("status != 'dropped'") @@ -124,7 +132,11 @@ def self.live_sessions ::Session.arel_table[Arel.star], 'areas_list.area_list' ) - .includes(:format, :room, {participant_assignments: :person}) + .includes( + :format, :room, + {participant_assignments: :person}, + {taggings: :tag} + ) .joins(self.area_subquery) .where("start_time is not null and room_id is not null") .where("status != 'dropped' and status != 'draft'") From 847a25dffda5011eafb8cf9e42282b6b919a7147 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 4 Jun 2024 12:04:22 -0400 Subject: [PATCH 2/3] Add tags to indesign output --- app/controllers/publications_controller.rb | 4 +++- app/views/xml_templates/schedule.nokogiri | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/publications_controller.rb b/app/controllers/publications_controller.rb index 5cfc9f41b..fbb9cfee6 100644 --- a/app/controllers/publications_controller.rb +++ b/app/controllers/publications_controller.rb @@ -9,6 +9,7 @@ def schedule SessionService.live_sessions end + # TODO - check this send_data XmlFormatter.new(sessions).render('schedule', sessions) .gsub(/<em>/, '') .gsub(/<\/em>/, '') @@ -25,8 +26,9 @@ def schedule .gsub(/\n\<\/timeduration\>/, '') .gsub(/\n\/, '') .gsub(/\n\/, ' - ') + .gsub(/\n\/, '') .gsub(/\n\/, ', ') - .gsub(/\n\<\/roomareasformat\>/, '') + .gsub(/\n\<\/roomareasformattags\>/, '') .gsub(/\\n/, '') .gsub(/\\n/, '') .gsub(/\n\/, '') diff --git a/app/views/xml_templates/schedule.nokogiri b/app/views/xml_templates/schedule.nokogiri index d3feb0b1b..0263588f4 100644 --- a/app/views/xml_templates/schedule.nokogiri +++ b/app/views/xml_templates/schedule.nokogiri @@ -1,6 +1,7 @@ # # XML template for a collection of sessions # +# TODO: xml.schedule { # We need a header at the start of the document, so # before_1st_session needs to be at least 86400 seconds (the @@ -33,7 +34,7 @@ xml.schedule { xml.start_time(session.start_time.strftime("%-l:%M")) xml.duration(session.duration) } - xml.roomareasformat{ + xml.roomareasformattags{ session.environment == 'virtual' ? xml.virtual(session.room.name) : xml.room(session.room.name) xml.areas(session.area_list.join(", ")) if session.format @@ -41,6 +42,7 @@ xml.schedule { end session.streamed ? xml.streamed("- Livestream") : "" session.recorded ? xml.recorded("- Recorded") : "" + xml.tags(session.tag_list.join(", ")) } xml.description(session.description) # If there are no visible participants, do not create an empty From ae112a5534e29946cffb83520b0c3e7070a83134 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 4 Jun 2024 12:21:27 -0400 Subject: [PATCH 3/3] Ensure tags are included in ConClar JSON --- app/serializers/conclar/session_serializer.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/serializers/conclar/session_serializer.rb b/app/serializers/conclar/session_serializer.rb index 05972b1a2..6cd319a8c 100644 --- a/app/serializers/conclar/session_serializer.rb +++ b/app/serializers/conclar/session_serializer.rb @@ -39,7 +39,13 @@ class Conclar::SessionSerializer < ActiveModel::Serializer attribute :tags do res = [] - res = session.taggings.select{|t| t.context == 'tags'}.collect(&:tag).collect(&:name) + res = object.taggings.select{|t| t.context == 'tags'}.collect(&:tag).collect{|t| + { + value: "tag_".concat(t.name.gsub(/\s/,'_')), + category: "Tag", + label: t.name + } + } case object.environment when 'in_person'