From 9a84adf36dabf98e627f09898f67a62ff4d2775a Mon Sep 17 00:00:00 2001 From: Matt Arnold Date: Thu, 4 Aug 2022 07:25:09 -0400 Subject: [PATCH 01/58] Apostrophes and virtual rooms. --- app/controllers/publications_controller.rb | 3 +++ app/views/xml_templates/schedule.nokogiri | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/publications_controller.rb b/app/controllers/publications_controller.rb index ffae9d920..0e3439622 100644 --- a/app/controllers/publications_controller.rb +++ b/app/controllers/publications_controller.rb @@ -5,6 +5,9 @@ def schedule sessions = SessionService.live_sessions send_data XmlFormatter.new(sessions).render('schedule', sessions) + .gsub(/'/, '’') + .gsub(/<em>/, '') + .gsub(/<\/em>/, '') .gsub(/\<\?xml version="1\.0"\?\>\n/, '') .gsub(/\\n /, '') .gsub(/\\n /, '') diff --git a/app/views/xml_templates/schedule.nokogiri b/app/views/xml_templates/schedule.nokogiri index 92cb7e0c4..a312f5457 100644 --- a/app/views/xml_templates/schedule.nokogiri +++ b/app/views/xml_templates/schedule.nokogiri @@ -34,7 +34,7 @@ xml.schedule { xml.duration(session.duration) } xml.roomareasformat{ - xml.room(session.room.name) + session.environment == 'virtual' ? xml.virtual(session.room.name) : xml.room(session.room.name) xml.areas(session.area_list.join(", ")) xml.format(session.format.name) } From 80f5bc69c480de01638dbaef747b7ea1540f66a4 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 4 Aug 2022 08:31:12 -0400 Subject: [PATCH 02/58] fix the reinsert of areas --- app/views/xml_templates/schedule.nokogiri | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/xml_templates/schedule.nokogiri b/app/views/xml_templates/schedule.nokogiri index 2bae322eb..242657482 100644 --- a/app/views/xml_templates/schedule.nokogiri +++ b/app/views/xml_templates/schedule.nokogiri @@ -35,7 +35,6 @@ xml.schedule { } xml.roomareasformat{ session.environment == 'virtual' ? xml.virtual(session.room.name) : xml.room(session.room.name) - xml.areas(session.area_list.join(", ")) # Areas are for internal use only, not for the public # xml.areas(session.area_list.join(", ")) xml.format(session.format.name) From 3ea9148d967ffbd3136209a50d4b49948438144f Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 4 Aug 2022 13:10:35 -0400 Subject: [PATCH 03/58] adjust paper trail settings --- app/models/published_session.rb | 4 +++- app/models/published_session_assignment.rb | 4 +++- app/models/session.rb | 4 +++- app/models/session_assignment.rb | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/models/published_session.rb b/app/models/published_session.rb index c57017801..130367740 100644 --- a/app/models/published_session.rb +++ b/app/models/published_session.rb @@ -4,7 +4,9 @@ class PublishedSession < ApplicationRecord self.primary_key = :session_id - has_paper_trail versions: { class_name: 'Audit::PublishedSessionVersion' }, ignore: [:updated_at, :created_at, :lock_version] + has_paper_trail versions: { class_name: 'Audit::PublishedSessionVersion' }, + ignore: [:updated_at, :created_at, :lock_version], + limit: nil belongs_to :format belongs_to :session diff --git a/app/models/published_session_assignment.rb b/app/models/published_session_assignment.rb index f3e3777ac..35b3c6c53 100644 --- a/app/models/published_session_assignment.rb +++ b/app/models/published_session_assignment.rb @@ -1,7 +1,9 @@ class PublishedSessionAssignment < ApplicationRecord self.primary_key = :session_assignment_id - has_paper_trail versions: { class_name: 'Audit::PublishedSessionVersion' }, ignore: [:updated_at, :created_at, :lock_version, :sort_order] + has_paper_trail versions: { class_name: 'Audit::PublishedSessionVersion' }, + ignore: [:updated_at, :created_at, :lock_version, :sort_order], + limit: nil include RankedModel ranks :sort_order, with_same: [:published_session_id] diff --git a/app/models/session.rb b/app/models/session.rb index d95597cf0..f5411ad70 100644 --- a/app/models/session.rb +++ b/app/models/session.rb @@ -9,7 +9,9 @@ class Session < ApplicationRecord # NOTE: when we have a config for default duration change to use a lambda attribute :duration, default: 60 - has_paper_trail versions: { class_name: 'Audit::SessionVersion' }, ignore: [:updated_at, :created_at, :updated_by, :lock_version, :interest_opened_by, :interest_opened_at] + has_paper_trail versions: { class_name: 'Audit::SessionVersion' }, + ignore: [:updated_at, :created_at, :updated_by, :lock_version, :interest_opened_by, :interest_opened_at], + limit: nil belongs_to :format, required: false has_one :published_session, dependent: :destroy diff --git a/app/models/session_assignment.rb b/app/models/session_assignment.rb index 30621ef16..d879f08c8 100644 --- a/app/models/session_assignment.rb +++ b/app/models/session_assignment.rb @@ -20,7 +20,9 @@ class SessionAssignment < ApplicationRecord include RankedModel ranks :sort_order, with_same: [:session_id] - has_paper_trail versions: { class_name: 'Audit::SessionVersion' }, ignore: [:updated_at, :created_at, :lock_version, :sort_order, :interested, :interest_ranking, :interest_notes, :planner_notes, :interest_role] + has_paper_trail versions: { class_name: 'Audit::SessionVersion' }, + ignore: [:updated_at, :created_at, :lock_version, :sort_order, :interested, :interest_ranking, :interest_notes, :planner_notes, :interest_role], + limit: nil belongs_to :person belongs_to :session From 2c16eb13556f8f9ad5a6c265b353eff63e1de9b8 Mon Sep 17 00:00:00 2001 From: dcterman <105614148+dcterman@users.noreply.github.com> Date: Fri, 5 Aug 2022 12:01:55 -0400 Subject: [PATCH 04/58] Update version number to 2.0.0 --- docs/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.md b/docs/index.md index d63fc152c..f043b9ca6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -7,8 +7,8 @@ This software is open source! If you'd like to contribute, please email planoram [Planorama Data Privacy & Protection Policy](/planorama/privacy) -Production version: 1.7.0 +Production version: 2.0.0 -Staging version: 1.7.0 +Staging version: 2.0.0 From a94c103e491cf24f59e85e7d59e32f70d56fde0e Mon Sep 17 00:00:00 2001 From: Leane Verhulst Date: Sat, 6 Aug 2022 14:10:47 -0500 Subject: [PATCH 05/58] PLAN-672 Add participant attendance type as tag in conclar output --- app/serializers/conclar/participant_serializer.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/serializers/conclar/participant_serializer.rb b/app/serializers/conclar/participant_serializer.rb index 2fe0eddfa..5a2d29ebe 100644 --- a/app/serializers/conclar/participant_serializer.rb +++ b/app/serializers/conclar/participant_serializer.rb @@ -46,5 +46,12 @@ class Conclar::ParticipantSerializer < ActiveModel::Serializer res end - # tags - not supported yet + # tags + attribute :tags do + res = [] + + res.concat [object.attendance_type] # in person, virtual, hybrid + + res + end end From a395a0eefc0eac0222487d905f4585e90d3c8a2f Mon Sep 17 00:00:00 2001 From: Leane Verhulst Date: Sat, 6 Aug 2022 16:29:47 -0500 Subject: [PATCH 06/58] PLAN-672 Update participant tags --- app/serializers/conclar/participant_serializer.rb | 2 +- db/seeds/development/person.seeds.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/serializers/conclar/participant_serializer.rb b/app/serializers/conclar/participant_serializer.rb index 5a2d29ebe..c62307d2c 100644 --- a/app/serializers/conclar/participant_serializer.rb +++ b/app/serializers/conclar/participant_serializer.rb @@ -50,7 +50,7 @@ class Conclar::ParticipantSerializer < ActiveModel::Serializer attribute :tags do res = [] - res.concat [object.attendance_type] # in person, virtual, hybrid + res.concat ["Attendance: ".concat( object.attendance_type )] # in person, virtual, hybrid res end diff --git a/db/seeds/development/person.seeds.rb b/db/seeds/development/person.seeds.rb index 81ec24f12..e5ada9781 100644 --- a/db/seeds/development/person.seeds.rb +++ b/db/seeds/development/person.seeds.rb @@ -41,7 +41,8 @@ instagram: username, flickr: username, reddit: username, - tiktok: username + tiktok: username, + attendance_type: ['in person', 'virtual', 'hybrid'].sample ) e = name.gsub(' ', '_') + i.to_s + '@test.com' EmailAddress.create( From b944381ae50f78c1989846c13aa3426fe2d125d9 Mon Sep 17 00:00:00 2001 From: Leane Verhulst Date: Sat, 6 Aug 2022 17:02:44 -0500 Subject: [PATCH 07/58] PLAN-673 Update sessions tags --- app/serializers/conclar/session_serializer.rb | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/app/serializers/conclar/session_serializer.rb b/app/serializers/conclar/session_serializer.rb index f1fc6f220..206bc7200 100644 --- a/app/serializers/conclar/session_serializer.rb +++ b/app/serializers/conclar/session_serializer.rb @@ -25,22 +25,21 @@ class Conclar::SessionSerializer < ActiveModel::Serializer attribute :tags do res = [] - res.concat object.area_list #.collect(&:name) + res.concat object.area_list.collect { |x| "Area: " + x } + res.concat ["Environment: ".concat( object.environment )] if object.environment != 'unknown' # virtual hybrid etc - res.concat [object.age_restriction.name] if object.age_restriction - res.concat [object.environment] if object.environment != 'unknown' # virtual hybrid etc + #if object.minors_participation && object.minors_participation.class == Array + # res.concat object.minors_participation.collect { |x| "Minors Participation: " + x } + #end - if object.minors_participation && object.minors_participation.class == Array - res.concat object.minors_participation - end - - res.concat ['Require Signup'] if object.require_signup - res.concat ['Recorded'] if object.recorded - res.concat ['Streamed'] if object.streamed + res.concat ["Note: ".concat( object.age_restriction.name )] if object.age_restriction + res.concat ['Note: Require Signup'] if object.require_signup + res.concat ['Note: Recorded'] if object.recorded + res.concat ['Note: Streamed'] if object.streamed res end - + attribute :mins do object.duration end From c4b98e8dad466f75467dc31a1b192689c5afd185 Mon Sep 17 00:00:00 2001 From: Leane Verhulst Date: Sun, 7 Aug 2022 10:44:53 -0500 Subject: [PATCH 08/58] PLAN-672 Check that attendance type exists --- app/serializers/conclar/participant_serializer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/serializers/conclar/participant_serializer.rb b/app/serializers/conclar/participant_serializer.rb index c62307d2c..3432d5cb0 100644 --- a/app/serializers/conclar/participant_serializer.rb +++ b/app/serializers/conclar/participant_serializer.rb @@ -50,7 +50,7 @@ class Conclar::ParticipantSerializer < ActiveModel::Serializer attribute :tags do res = [] - res.concat ["Attendance: ".concat( object.attendance_type )] # in person, virtual, hybrid + res.concat ["Attendance: ".concat( object.attendance_type )] if object.attendance_type # in person, virtual, hybrid res end From 029a2b65ff8dfdc7412d4f5561166db840a051f6 Mon Sep 17 00:00:00 2001 From: Leane Verhulst Date: Sun, 7 Aug 2022 17:27:11 -0500 Subject: [PATCH 09/58] PLAN-673 Update conclar tags output to use new format --- .../conclar/participant_serializer.rb | 9 ++- app/serializers/conclar/session_serializer.rb | 61 +++++++++++++++++-- 2 files changed, 63 insertions(+), 7 deletions(-) diff --git a/app/serializers/conclar/participant_serializer.rb b/app/serializers/conclar/participant_serializer.rb index c62307d2c..1b33c60fa 100644 --- a/app/serializers/conclar/participant_serializer.rb +++ b/app/serializers/conclar/participant_serializer.rb @@ -50,7 +50,14 @@ class Conclar::ParticipantSerializer < ActiveModel::Serializer attribute :tags do res = [] - res.concat ["Attendance: ".concat( object.attendance_type )] # in person, virtual, hybrid + if object.attendance_type # in person, virtual, hybrid + t = { + value: "person_".concat(object.attendance_type), + category: "Attendance", + label: object.attendance_type + } + res << t + end res end diff --git a/app/serializers/conclar/session_serializer.rb b/app/serializers/conclar/session_serializer.rb index 206bc7200..0aba0ad26 100644 --- a/app/serializers/conclar/session_serializer.rb +++ b/app/serializers/conclar/session_serializer.rb @@ -25,17 +25,66 @@ class Conclar::SessionSerializer < ActiveModel::Serializer attribute :tags do res = [] - res.concat object.area_list.collect { |x| "Area: " + x } - res.concat ["Environment: ".concat( object.environment )] if object.environment != 'unknown' # virtual hybrid etc + object.area_list.each do |area| + a = { + value: "session_".concat(area), + category: "Area", + label: area + } + res << a + end + + + #res.concat ["Environment: ".concat( object.environment )] if object.environment != 'unknown' # virtual hybrid etc + if object.environment != 'unknown' # virtual hybrid etc + t = { + value: "session_".concat(object.environment), + category: "Environment", + label: object.environment + } + res << t + end #if object.minors_participation && object.minors_participation.class == Array # res.concat object.minors_participation.collect { |x| "Minors Participation: " + x } #end - res.concat ["Note: ".concat( object.age_restriction.name )] if object.age_restriction - res.concat ['Note: Require Signup'] if object.require_signup - res.concat ['Note: Recorded'] if object.recorded - res.concat ['Note: Streamed'] if object.streamed + #res.concat ["Note: ".concat( object.age_restriction.name )] if object.age_restriction + if object.age_restriction + t = { + value: "session_".concat(object.age_restriction.name), + category: "Note", + label: object.age_restriction.name + } + res << t + end + #res.concat ['Note: Require Signup'] if object.require_signup + if object.require_signup + t = { + value: "session_require_signup", + category: "Note", + label: "Require Signup" + } + res << t + end + #res.concat ['Note: Recorded'] if object.recorded + if object.recorded + t = { + value: "session_recorded", + category: "Note", + label: "Recorded" + } + res << t + end + #res.concat ['Note: Streamed'] if object.streamed + if object.streamed + t = { + value: "session_streamed", + category: "Note", + label: "Streamed" + } + res << t + end res end From cd40a0e97a87612d9c7d7f8c26b711d3573d864d Mon Sep 17 00:00:00 2001 From: Gail Terman Date: Sun, 7 Aug 2022 20:13:01 -0400 Subject: [PATCH 10/58] tweaks to publish table --- app/javascript/schedule/schedule_settings.vue | 61 ++++++++++++------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/app/javascript/schedule/schedule_settings.vue b/app/javascript/schedule/schedule_settings.vue index afdf9a090..3e90e7ad2 100644 --- a/app/javascript/schedule/schedule_settings.vue +++ b/app/javascript/schedule/schedule_settings.vue @@ -20,34 +20,31 @@
Publish schedule to public
- + - - + + Create a publish snapshot - + + +
@@ -93,8 +90,26 @@ export default { SCHEDULE_FIRM_CONFIRM_MESSAGE, NODE_ENV, mockSnapshots: [ - // {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - // {timestamp: '2022-08-04T00:24:00Z', id:'67890'} + {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, + {timestamp: '2022-08-04T00:24:00Z', id:'67890'}, + {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, + {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, + {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, + {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, + {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, + {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, + {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, + {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, + {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, + {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, + {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, + {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, + {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, + {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, + {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, + {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, + {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, + {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, ], pubsDiff: [false, false, false], }), @@ -183,4 +198,6 @@ export default { display: flex; align-items: center; } + + From 56fe81a883458a9d75035a1d7029fa41c2d1c3e9 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 8 Aug 2022 10:29:51 -0400 Subject: [PATCH 11/58] Initial version of utility change service --- app/services/change_service.rb | 70 ++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 app/services/change_service.rb diff --git a/app/services/change_service.rb b/app/services/change_service.rb new file mode 100644 index 000000000..603511a0f --- /dev/null +++ b/app/services/change_service.rb @@ -0,0 +1,70 @@ +module ChangeService + + # What changed in date between from date and to date + def self.session_changes(from:, to: nil) + { + sessions: self.sessions_changed(from: from, to: to), + assignments: self.sessions_changed(from: from, to: to) + } + end + + # What changed in published date between from date and to date + def self.published_changes(from:, to: nil) + { + sessions: self.published_sessions_changed(from: from, to: to), + assignments: self.published_session_assignments_changed(from: from, to: to) + } + end + + def self.sessions_changed(from:, to: nil) + get_changes(clazz: Audit::SessionVersion, type: 'Session', from: from, to: to) + end + + def self.published_sessions_changed(from:, to: nil) + get_changes(clazz: Audit::PublishedSessionVersion, type: 'PublishedSession', from: from, to: to) + end + + def self.session_assignments_changed(from:, to: nil) + get_changes(clazz: Audit::SessionVersion, type: 'SessionAssignment', from: from, to: to) + end + + def self.published_session_assignments_changed(from:, to: nil) + get_changes(clazz: Audit::PublishedSessionVersion, type: 'PublishedSessionAssignment', from: from, to: to) + end + + # get the paper trail verions from: to: + # we need the versions for each session that has been updated within the period + # order by the session id and the time (oldest to newest) + # for each session version get it's change set and "merge" as we go through the time line + # so we have one final change set per session id which can be used for the report + def self.get_changes(clazz:, type:, from:, to:) + changes = {} + + audits = clazz.where("item_type = ?", type).order("item_id, created_at asc") + + audits = audits.where("created_at >= ?", from) if from + audits = audits.where("created_at <= ?", to) if to + + grouped_audits = audits.group_by {|a| a.item_id} + + grouped_audits.each do |key, item_audits| + # just in case we sort by date + item_audits.sort{|a,b| a.created_at <=> b.created_at}.each do |audit| + # merge the change history + changes[key] = audit.object_changes unless changes[key] + changes[key] = self.merge_change_set(to: changes[key], from: audit.object_changes) if changes[key] + end + end + + changes + end + + def self.merge_change_set(to: , from:) + res = to + from.each do |key, change| + res[key] = from[key] unless res[key] + res[key][1] = from[key][1] if res[key] + end + res + end +end From fc28e46b07bbbb690b2dbe1c7e1b9fe405209d84 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 8 Aug 2022 10:42:35 -0400 Subject: [PATCH 12/58] publish xml use published if any --- app/controllers/publications_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/publications_controller.rb b/app/controllers/publications_controller.rb index 0e3439622..4de160891 100644 --- a/app/controllers/publications_controller.rb +++ b/app/controllers/publications_controller.rb @@ -2,7 +2,12 @@ class PublicationsController < ApplicationController around_action :set_timezone def schedule - sessions = SessionService.live_sessions + # use published if any otherwise use live + sessions = if PublishedSession.count > 0 + SessionService.published_sessions + else + SessionService.live_sessions + end send_data XmlFormatter.new(sessions).render('schedule', sessions) .gsub(/'/, '’') From 69e017d245454e3d8db1050be3ffaa366664a617 Mon Sep 17 00:00:00 2001 From: Matt Arnold Date: Mon, 8 Aug 2022 16:03:30 -0400 Subject: [PATCH 13/58] Update schedule. --- app/views/xml_templates/schedule.nokogiri | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/xml_templates/schedule.nokogiri b/app/views/xml_templates/schedule.nokogiri index a312f5457..1f20cad89 100644 --- a/app/views/xml_templates/schedule.nokogiri +++ b/app/views/xml_templates/schedule.nokogiri @@ -36,7 +36,9 @@ xml.schedule { xml.roomareasformat{ session.environment == 'virtual' ? xml.virtual(session.room.name) : xml.room(session.room.name) xml.areas(session.area_list.join(", ")) - xml.format(session.format.name) + session.area_list.include?(session.format.name) ? xml.format(session.format.name) : "" + session.streamed ? xml.streamed("- Livestream") : "" + session.recorded ? xml.recorded("- Recorded") : "" } xml.description(session.description) # If there are no visible participants, do not create an empty From 27ef627746409bab549bf14c1f79c8d1ad96e294 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 8 Aug 2022 17:56:39 -0400 Subject: [PATCH 14/58] WIP --- app/controllers/application_controller.rb | 5 + .../reports/conflict_reports_controller.rb | 5 - .../reports/people_reports_controller.rb | 5 - .../reports/schedule_reports_controller.rb | 192 ++++++++++++++++++ .../reports/session_reports_controller.rb | 5 - app/controllers/reports_controller.rb | 5 - app/models/published_session.rb | 3 + app/models/published_session_assignment.rb | 2 + app/services/change_service.rb | 20 +- app/services/publication_service.rb | 8 +- config/routes.rb | 2 + 11 files changed, 220 insertions(+), 32 deletions(-) create mode 100644 app/controllers/reports/schedule_reports_controller.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d60f404e3..5b9dcaf6d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -95,4 +95,9 @@ def render_jsonapi_internal_server_error(exception) # NOTE: if we have a central log put it in here super(exception) end + + def set_timezone(&block) + timezone = ConfigService.value('convention_timezone') + Time.use_zone(timezone, &block) + end end diff --git a/app/controllers/reports/conflict_reports_controller.rb b/app/controllers/reports/conflict_reports_controller.rb index a2783becc..e30c7ec82 100644 --- a/app/controllers/reports/conflict_reports_controller.rb +++ b/app/controllers/reports/conflict_reports_controller.rb @@ -551,9 +551,4 @@ def people_outside_availability filename: "PeopleOutsideAvailability#{Time.now.strftime('%m-%d-%Y')}.xlsx", disposition: 'attachment' end - - def set_timezone(&block) - timezone = ConfigService.value('convention_timezone') - Time.use_zone(timezone, &block) - end end diff --git a/app/controllers/reports/people_reports_controller.rb b/app/controllers/reports/people_reports_controller.rb index 6cf0460c6..beac7f20a 100644 --- a/app/controllers/reports/people_reports_controller.rb +++ b/app/controllers/reports/people_reports_controller.rb @@ -59,9 +59,4 @@ def record_stream_permissions filename: "PeopleRecordStream-#{Time.now.strftime('%m-%d-%Y')}.xlsx", disposition: 'attachment' end - - def set_timezone(&block) - timezone = ConfigService.value('convention_timezone') - Time.use_zone(timezone, &block) - end end diff --git a/app/controllers/reports/schedule_reports_controller.rb b/app/controllers/reports/schedule_reports_controller.rb new file mode 100644 index 000000000..5c6934b23 --- /dev/null +++ b/app/controllers/reports/schedule_reports_controller.rb @@ -0,0 +1,192 @@ +class Reports::ScheduleReportsController < ApplicationController + around_action :set_timezone + + def schedule_diff + # authorize Person, policy_class: ReportPolicy + + # TODO: base the from and to on the publish ids and this will be ok as a get + from = params[:from] + from ||= Time.now - 14.day + to = params[:to] + + changes = ChangeService.published_changes(from: from) + # if to + # ChangeService.published_changes(from: from, to: to) + # else + # ChangeService.session_changes(from: from) + # end + + to ||= Time.now + workbook = FastExcel.open(constant_memory: true) + date_time_style = workbook.number_format("d mmm yyyy h:mm") + + session_time_changed = workbook.add_worksheet("Session Time Changed") + session_room_changed = workbook.add_worksheet("Session Room Changed") + session_title_changed = workbook.add_worksheet("Session Title Changed") + session_description_changed = workbook.add_worksheet("Session Description Changed") + session_added = workbook.add_worksheet("Sessions Add") + session_removed = workbook.add_worksheet("Sessions Removed") + + participants_fully_dropped = workbook.add_worksheet("Participants Dropped") + participants_add_drop = workbook.add_worksheet("Participants Add Drop") + + tab_headers(session_time_changed, session_room_changed, session_title_changed, session_description_changed, session_added, session_removed, participants_add_drop) + + changes[:sessions].each do |id, change| + if change[:changes]['room_id'] || change[:changes]['start_time'] + if (!change[:changes]['room_id'][0] && change[:changes]['room_id'][1]) && + (!change[:changes]['room_id'][0] && change[:changes]['start_time'][1]) + session_added_row(session_added, change, date_time_style) + else + if !change[:changes]['room_id'][1] || !change[:changes]['start_time'][1] || change[:event] == 'destroy' + session_removed_row(session_removed, change) + else + if change[:changes]['room_id'] + session_room_change_row(session_room_changed, change) + end + if change[:changes]['start_time'] + session_time_change_row(session_time_changed, change, date_time_style) + end + end + end + end + + if change[:changes]['title'] + session_title_change_row(session_title_changed, change) + end + if change[:changes]['description'] + session_description_change_row(session_description_changed, change) + end + end + + moderator = SessionAssignmentRoleType.find_by(name: 'Moderator') + participant = SessionAssignmentRoleType.find_by(name: 'Participant') + roles = [moderator.id, participant.id] + # Rails.logger.debug "******** ROLES #{roles}" + + changes[:assignments].each do |id, change| + # Rails.logger.debug "***** ASSIGNMENTS #{change}" + # Participants add/drop + # if change[:changes]['visibility'] || change[:changes]['state'] || change[:changes]['session_assignment_role_type_id'] + if change[:changes]['session_assignment_role_type_id'] + # Rails.logger.debug "********** ADD/DROP? #{change}" + # next unless change[:changes]['session_assignment_role_type_id'] + # next unless (roles.include?(change[:changes]['session_assignment_role_type_id'][0]) || roles.include?(change[:changes]['session_assignment_role_type_id'][1])) + + # Rails.logger.debug "********** ADD/DROP? #{change}" + if (roles.include?(change[:changes]['session_assignment_role_type_id'][1])) + # Rails.logger.debug "********** ADDDED" + participants_add_drop.append_row( + [ + change[:object].session.title, + '', + change[:object].person.published_name + ] + ) + # || change[:changes]['state'][1] == 'rejected' || change[:changes]['visibility'][1] == 'private' + elsif (roles.include?(change[:changes]['session_assignment_role_type_id'][0])) + # Rails.logger.debug "********** DROPPPED #{change}" + participants_add_drop.append_row( + [ + change[:object].session.title, + change[:object].person.published_name, + ] + ) + end + end + end + + send_data workbook.read_string, + filename: "ScheduleDiff-#{from.strftime('%m-%d-%Y_%H_%M')}_to_#{to.strftime('%m-%d-%Y_%H_%M')}.xlsx", + disposition: 'attachment' + end + + def tab_headers(session_time_changed, session_room_changed, session_title_changed, session_description_changed, session_added, session_removed, participants_add_drop) + session_time_changed.append_row(['Session Title','Original Start Time', 'New Start Time']) + session_room_changed.append_row(['Session Title','Original Room', 'New Room']) + session_title_changed.append_row(['Original Session Title', 'New Session Title']) + session_description_changed.append_row(['Session Title','Original Description', 'New Description']) + session_added.append_row(['Session Title', 'Session Description', 'Format', 'Areas', 'Start Time', 'Room', 'Moderators', 'Participants']) + session_removed.append_row(['Session Title']) + + participants_add_drop.append_row(['Session Title', 'Participant Dropped', 'Participant Added']) + end + + def session_description_change_row(sheet, change) + sheet.append_row( + [ + change[:object].title, + change[:changes]['description'][0], + change[:changes]['description'][1] + ] + ) + end + + def session_title_change_row(sheet, change) + sheet.append_row( + [ + change[:changes]['title'][0], + change[:changes]['title'][1] + ] + ) + end + + def session_room_change_row(sheet, change) + orig_room = Room.find change[:changes]['room_id'][0] if change[:changes]['room_id'][0] + new_room = Room.find change[:changes]['room_id'][1] if change[:changes]['room_id'][1] + sheet.append_row( + [ + change[:object].title, + orig_room&.name, + new_room&.name + ] + ) + end + + def session_removed_row(sheet, change) + # TODO: if it is a destroy .... + sheet.append_row( + [ + change[:object].title + ] + ) + end + + def session_time_change_row(sheet, change, date_time_style) + orig_time = Time.parse(change[:changes]['start_time'][0]) if change[:changes]['start_time'][0] + new_time = Time.parse(change[:changes]['start_time'][1]) if change[:changes]['start_time'][1] + # Rails.logger.debug "********* #{change[:changes]['start_time'][1]} => #{new_time.class} #{new_time.strftime("%H")}" + sheet.append_row( + [ + change[:object].title, + orig_time ? FastExcel.date_num(orig_time, orig_time.in_time_zone.utc_offset) : nil, + new_time ? FastExcel.date_num(new_time, new_time.in_time_zone.utc_offset) : nil + ], + [ + nil, date_time_style, date_time_style + ] + ) + end + + # Generate a row for sessions added + def session_added_row(sheet, change, date_time_style) + moderator = SessionAssignmentRoleType.find_by(name: 'Moderator') + participant = SessionAssignmentRoleType.find_by(name: 'Participant') + + sheet.append_row( + [ + change[:object].title, + change[:object].description, + change[:object].format&.name, + change[:object].areas.collect(&:name).join("; "), + FastExcel.date_num(change[:object].start_time, change[:object].start_time.in_time_zone.utc_offset), + change[:object].room&.name, + change[:object].participant_assignments.where("session_assignment_role_type_id = ?", moderator).collect{|a| a.person.published_name}.join("; "), + change[:object].participant_assignments.where("session_assignment_role_type_id = ?", participant).collect{|a| a.person.published_name}.join("; ") + ], + [ + nil, nil, nil, nil, date_time_style, nil, nil, nil + ] + ) + end +end diff --git a/app/controllers/reports/session_reports_controller.rb b/app/controllers/reports/session_reports_controller.rb index 13099a914..d05c1f961 100644 --- a/app/controllers/reports/session_reports_controller.rb +++ b/app/controllers/reports/session_reports_controller.rb @@ -425,9 +425,4 @@ def panels_with_too_many_people filename: "Panels_With_Too_Many_People_#{Time.now.strftime('%m-%d-%Y')}.xlsx", disposition: 'attachment' end - - def set_timezone(&block) - timezone = ConfigService.value('convention_timezone') - Time.use_zone(timezone, &block) - end end diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index 5469175a7..7e37b1e03 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -642,9 +642,4 @@ def participant_do_not_assign_with filename: "ParticipantDoNotAssignWith#{Time.now.strftime('%m-%d-%Y')}.xlsx", disposition: 'attachment' end - - def set_timezone(&block) - timezone = ConfigService.value('convention_timezone') - Time.use_zone(timezone, &block) - end end diff --git a/app/models/published_session.rb b/app/models/published_session.rb index 625a52cd6..1b9d81cc7 100644 --- a/app/models/published_session.rb +++ b/app/models/published_session.rb @@ -51,6 +51,9 @@ def roles(role_ids) is_private: 'private' } + has_many :session_areas, inverse_of: :session, foreign_key: 'session_id' + has_many :areas, through: :session_areas + # acts_as_taggable acts_as_taggable_on :tags diff --git a/app/models/published_session_assignment.rb b/app/models/published_session_assignment.rb index 35b3c6c53..1e63170bf 100644 --- a/app/models/published_session_assignment.rb +++ b/app/models/published_session_assignment.rb @@ -13,6 +13,8 @@ class PublishedSessionAssignment < ApplicationRecord belongs_to :session_assignment_role_type, required: false belongs_to :session_assignment + alias :session :published_session + enum visibility: { is_public: 'public', is_private: 'private' diff --git a/app/services/change_service.rb b/app/services/change_service.rb index 603511a0f..68544bc30 100644 --- a/app/services/change_service.rb +++ b/app/services/change_service.rb @@ -4,7 +4,7 @@ module ChangeService def self.session_changes(from:, to: nil) { sessions: self.sessions_changed(from: from, to: to), - assignments: self.sessions_changed(from: from, to: to) + assignments: self.session_assignments_changed(from: from, to: to) } end @@ -17,19 +17,19 @@ def self.published_changes(from:, to: nil) end def self.sessions_changed(from:, to: nil) - get_changes(clazz: Audit::SessionVersion, type: 'Session', from: from, to: to) + get_changes(clazz: Audit::SessionVersion, type: Session, from: from, to: to) end def self.published_sessions_changed(from:, to: nil) - get_changes(clazz: Audit::PublishedSessionVersion, type: 'PublishedSession', from: from, to: to) + get_changes(clazz: Audit::PublishedSessionVersion, type: PublishedSession, from: from, to: to) end def self.session_assignments_changed(from:, to: nil) - get_changes(clazz: Audit::SessionVersion, type: 'SessionAssignment', from: from, to: to) + get_changes(clazz: Audit::SessionVersion, type: SessionAssignment, from: from, to: to) end def self.published_session_assignments_changed(from:, to: nil) - get_changes(clazz: Audit::PublishedSessionVersion, type: 'PublishedSessionAssignment', from: from, to: to) + get_changes(clazz: Audit::PublishedSessionVersion, type: PublishedSessionAssignment, from: from, to: to) end # get the paper trail verions from: to: @@ -40,7 +40,7 @@ def self.published_session_assignments_changed(from:, to: nil) def self.get_changes(clazz:, type:, from:, to:) changes = {} - audits = clazz.where("item_type = ?", type).order("item_id, created_at asc") + audits = clazz.where("item_type = ?", type.name).order("item_id, created_at asc") audits = audits.where("created_at >= ?", from) if from audits = audits.where("created_at <= ?", to) if to @@ -51,8 +51,12 @@ def self.get_changes(clazz:, type:, from:, to:) # just in case we sort by date item_audits.sort{|a,b| a.created_at <=> b.created_at}.each do |audit| # merge the change history - changes[key] = audit.object_changes unless changes[key] - changes[key] = self.merge_change_set(to: changes[key], from: audit.object_changes) if changes[key] + if changes[key] + changes[key][:changes] = self.merge_change_set(to: changes[key][:changes], from: audit.object_changes) + else + obj = audit.event != 'destroy' ? type.find(audit.item_id) : nil + changes[key] = {event: audit.event, object: obj, changes: audit.object_changes} + end end end diff --git a/app/services/publication_service.rb b/app/services/publication_service.rb index 71f1d3a7e..e2b6a6517 100644 --- a/app/services/publication_service.rb +++ b/app/services/publication_service.rb @@ -92,7 +92,7 @@ def self.publish_new_sessions(sessions) candidates.each do |session| pub_session = self.publish_session(session: session, update: false) - pub_session.save! + pub_session.save! if pub_session end count end @@ -127,7 +127,7 @@ def self.publish_session(session:, update: true) session.attributes.each do |attr, val| next if val.nil? # if there is nothing to copy skip next if !pub_session.attributes.key?(attr) # if the published version does not support the attr skip - next if [:lock_version, :created_at, :updated_at, :id].include?(attr) # skip lock and dates + next if ['lock_version', 'created_at', 'updated_at', 'id'].include?(attr) # skip lock and dates next if pub_session.attributes[attr] == val # skip if the value will not change pub_session.send("#{attr}=", val) # the the attr in the publihsed instance @@ -161,7 +161,7 @@ def self.publish_updated_assignments(assignments) candidates.each do |assignment| pub_assignment = self.publish_assignment(assignment: assignment) - pub_assignment.save! + pub_assignment.save! if pub_assignment end count @@ -184,7 +184,7 @@ def self.publish_assignment(assignment:, update: true) assignment.attributes.each do |attr, val| next if val.nil? # if there is nothing to copy skip next if !pub_assignment.attributes.key?(attr) # if the published version does not support the attr skip - next if [:lock_version, :created_at, :updated_at, :id, :session_id].include?(attr) # skip lock and dates + next if ['lock_version', 'created_at', 'updated_at', 'id', 'session_id'].include?(attr) # skip lock and dates next if pub_assignment.attributes[attr] == val # skip if the value will not change pub_assignment.send("#{attr}=", val) # the the attr in the publihsed instance diff --git a/config/routes.rb b/config/routes.rb index 569d02f45..f7c857eb8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -86,6 +86,8 @@ get 'report/people_reports/record_stream_permissions', to: 'reports/people_reports#record_stream_permissions' + get 'report/schedule_reports/schedule_diff', to: 'reports/schedule_reports#schedule_diff' + resources :availabilities, path: 'availability', except: [:index] resources :person_exclusions, path: 'person_exclusion', except: [:index] resources :session_limits, path: 'session_limit', except: [:index] From 66fda34814ce4fe16e0373273d103b40ad09efb1 Mon Sep 17 00:00:00 2001 From: Matt Arnold Date: Tue, 9 Aug 2022 09:47:56 -0400 Subject: [PATCH 15/58] Fix bug in rendering areas --- app/views/xml_templates/schedule.nokogiri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/xml_templates/schedule.nokogiri b/app/views/xml_templates/schedule.nokogiri index 1f20cad89..56c64cc54 100644 --- a/app/views/xml_templates/schedule.nokogiri +++ b/app/views/xml_templates/schedule.nokogiri @@ -36,7 +36,7 @@ xml.schedule { xml.roomareasformat{ session.environment == 'virtual' ? xml.virtual(session.room.name) : xml.room(session.room.name) xml.areas(session.area_list.join(", ")) - session.area_list.include?(session.format.name) ? xml.format(session.format.name) : "" + !session.area_list.include?(session.format.name) ? xml.format(session.format.name) : "" session.streamed ? xml.streamed("- Livestream") : "" session.recorded ? xml.recorded("- Recorded") : "" } From 07d3b08ca9be03da791493a8489907680a3a82ba Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 9 Aug 2022 09:52:01 -0400 Subject: [PATCH 16/58] WIP --- .../reports/schedule_reports_controller.rb | 56 ++++++++++--------- app/models/person.rb | 14 ++++- app/models/person_schedule.rb | 19 ------- app/models/session_assignment.rb | 2 + app/services/change_service.rb | 1 + 5 files changed, 45 insertions(+), 47 deletions(-) diff --git a/app/controllers/reports/schedule_reports_controller.rb b/app/controllers/reports/schedule_reports_controller.rb index 5c6934b23..af41e026c 100644 --- a/app/controllers/reports/schedule_reports_controller.rb +++ b/app/controllers/reports/schedule_reports_controller.rb @@ -5,16 +5,21 @@ def schedule_diff # authorize Person, policy_class: ReportPolicy # TODO: base the from and to on the publish ids and this will be ok as a get - from = params[:from] - from ||= Time.now - 14.day - to = params[:to] + pd_from = PublicationDate.find params[:from] if params[:from] - changes = ChangeService.published_changes(from: from) - # if to - # ChangeService.published_changes(from: from, to: to) - # else - # ChangeService.session_changes(from: from) - # end + from = pd_from.timestamp if pd_from + from ||= PublicationDate.order('created_at desc').first&.timestamp + from ||= Time.now - 2.year # TODO: for testing + + pd_to = PublicationDate.find params[:to] if params[:to] + to = pd_to.timestamp if pd_to + + # changes = ChangeService.published_changes(from: from, to: to) + changes = if to + ChangeService.published_changes(from: from, to: to) + else + ChangeService.session_changes(from: from) + end to ||= Time.now workbook = FastExcel.open(constant_memory: true) @@ -30,15 +35,16 @@ def schedule_diff participants_fully_dropped = workbook.add_worksheet("Participants Dropped") participants_add_drop = workbook.add_worksheet("Participants Add Drop") - tab_headers(session_time_changed, session_room_changed, session_title_changed, session_description_changed, session_added, session_removed, participants_add_drop) + tab_headers(session_time_changed, session_room_changed, session_title_changed, session_description_changed, session_added, session_removed, participants_add_drop, participants_fully_dropped) - changes[:sessions].each do |id, change| + changes[:sessions].values.sort{|a,b| (a[:object] ? a[:object].title : '') <=> (b[:object] ? b[:object].title : '')}.each do |change| if change[:changes]['room_id'] || change[:changes]['start_time'] - if (!change[:changes]['room_id'][0] && change[:changes]['room_id'][1]) && - (!change[:changes]['room_id'][0] && change[:changes]['start_time'][1]) + if change[:changes]['room_id'] && change[:changes]['start_time'] && + ((!change[:changes]['room_id'][0] && change[:changes]['room_id'][1]) || + (!change[:changes]['start_time'][0] && change[:changes]['start_time'][1])) session_added_row(session_added, change, date_time_style) else - if !change[:changes]['room_id'][1] || !change[:changes]['start_time'][1] || change[:event] == 'destroy' + if (change[:changes]['room_id'] && !change[:changes]['room_id'][1]) || (change[:changes]['start_time'] && !change[:changes]['start_time'][1])|| change[:event] == 'destroy' session_removed_row(session_removed, change) else if change[:changes]['room_id'] @@ -64,18 +70,12 @@ def schedule_diff roles = [moderator.id, participant.id] # Rails.logger.debug "******** ROLES #{roles}" + # TODO: sort .... ??? how + fully_dropped = [] changes[:assignments].each do |id, change| - # Rails.logger.debug "***** ASSIGNMENTS #{change}" # Participants add/drop - # if change[:changes]['visibility'] || change[:changes]['state'] || change[:changes]['session_assignment_role_type_id'] if change[:changes]['session_assignment_role_type_id'] - # Rails.logger.debug "********** ADD/DROP? #{change}" - # next unless change[:changes]['session_assignment_role_type_id'] - # next unless (roles.include?(change[:changes]['session_assignment_role_type_id'][0]) || roles.include?(change[:changes]['session_assignment_role_type_id'][1])) - - # Rails.logger.debug "********** ADD/DROP? #{change}" if (roles.include?(change[:changes]['session_assignment_role_type_id'][1])) - # Rails.logger.debug "********** ADDDED" participants_add_drop.append_row( [ change[:object].session.title, @@ -83,25 +83,30 @@ def schedule_diff change[:object].person.published_name ] ) - # || change[:changes]['state'][1] == 'rejected' || change[:changes]['visibility'][1] == 'private' elsif (roles.include?(change[:changes]['session_assignment_role_type_id'][0])) - # Rails.logger.debug "********** DROPPPED #{change}" participants_add_drop.append_row( [ change[:object].session.title, change[:object].person.published_name, ] ) + if change[:object].person.sessions.scheduled.count == 0 + fully_dropped.append [change[:object].person.published_name] + end end end end + fully_dropped.uniq.each do |name| + participants_fully_dropped.append_row(name) + end + send_data workbook.read_string, filename: "ScheduleDiff-#{from.strftime('%m-%d-%Y_%H_%M')}_to_#{to.strftime('%m-%d-%Y_%H_%M')}.xlsx", disposition: 'attachment' end - def tab_headers(session_time_changed, session_room_changed, session_title_changed, session_description_changed, session_added, session_removed, participants_add_drop) + def tab_headers(session_time_changed, session_room_changed, session_title_changed, session_description_changed, session_added, session_removed, participants_add_drop, participants_fully_dropped) session_time_changed.append_row(['Session Title','Original Start Time', 'New Start Time']) session_room_changed.append_row(['Session Title','Original Room', 'New Room']) session_title_changed.append_row(['Original Session Title', 'New Session Title']) @@ -110,6 +115,7 @@ def tab_headers(session_time_changed, session_room_changed, session_title_change session_removed.append_row(['Session Title']) participants_add_drop.append_row(['Session Title', 'Participant Dropped', 'Participant Added']) + participants_fully_dropped.append_row(['Participant Dropped']) end def session_description_change_row(sheet, change) diff --git a/app/models/person.rb b/app/models/person.rb index f05651754..53a04f647 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -65,7 +65,15 @@ def publishable # We let the publish mechanism do the destroy so that the update service knows what is happening has_many :published_session_assignments - has_many :published_sessions, through: :published_session_assignments + has_many :published_sessions, through: :published_session_assignments do + def scheduled + # get the people with the given role + where("published_sessions.start_time is not null and published_sessions.room_id is not null") + .where("published_session_assignments.session_assignment_role_type_id not in (select id from session_assignment_role_type where session_assignment_role_type.name = 'Invisible')") + .where("published_session_assignments.session_assignment_role_type_id not in (select id from session_assignment_role_type where session_assignment_role_type.name = 'Reserve')") + .where("published_session_assignments.session_assignment_role_type_id is not null") + end + end has_many :person_mailing_assignments has_many :mailings, through: :person_mailing_assignments @@ -247,11 +255,11 @@ def check_if_assigned def assigment_consistency # unassign when declined or rejected (or should we delete?) if con_state == Person.con_states[:declined] - self.session_assignments.update_all( + self.session_assignments.update( session_assignment_role_type_id: nil ) elsif con_state == Person.con_states[:rejected] - self.session_assignments.update_all( + self.session_assignments.update( session_assignment_role_type_id: nil, state: :rejected ) diff --git a/app/models/person_schedule.rb b/app/models/person_schedule.rb index 08ec70486..3582a13b3 100644 --- a/app/models/person_schedule.rb +++ b/app/models/person_schedule.rb @@ -46,22 +46,3 @@ def readonly? true end end - -# CONCAT(p.id, ':', sa.id) as id, -# p.id as person_id , -# p.name, -# p.published_name, -# p.con_state, -# p.pronouns -# sa.id as session_assignment_id, -# sart.id as session_assignment_role_type_id, -# sart.name as session_assignment_name, -# sart.role_type as session_assignment_role_type, -# sa.sort_order, -# sessions.id as session_id, -# sessions.title, -# sessions.start_time, -# (sessions.start_time + (sessions.duration || ' minute')::interval) as end_time, -# sessions.duration, -# sessions.room_id, -# sessions.format_id diff --git a/app/models/session_assignment.rb b/app/models/session_assignment.rb index d879f08c8..3fe4f0711 100644 --- a/app/models/session_assignment.rb +++ b/app/models/session_assignment.rb @@ -79,6 +79,8 @@ class SessionAssignment < ApplicationRecord # Ensure that we are not assigning a declined ot rejected person def check_person_state return if self.interested == false + return unless self.session_assignment_role_type_id + return if self.state == 'rejected' p = Person.find self.person_id if p.con_state == Person.con_states[:declined] || p.con_state == Person.con_states[:rejected] diff --git a/app/services/change_service.rb b/app/services/change_service.rb index 68544bc30..db0c21f43 100644 --- a/app/services/change_service.rb +++ b/app/services/change_service.rb @@ -60,6 +60,7 @@ def self.get_changes(clazz:, type:, from:, to:) end end + # TODO: any way we can order by the session title ??? changes end From 36b14877937843a7101aaad0526fbf9cbaae6ba6 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 9 Aug 2022 09:57:09 -0400 Subject: [PATCH 17/58] add params to route --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index f7c857eb8..7480ffa3e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -86,7 +86,7 @@ get 'report/people_reports/record_stream_permissions', to: 'reports/people_reports#record_stream_permissions' - get 'report/schedule_reports/schedule_diff', to: 'reports/schedule_reports#schedule_diff' + get 'report/schedule_reports/schedule_diff(/:from)(/:to)', to: 'reports/schedule_reports#schedule_diff' resources :availabilities, path: 'availability', except: [:index] resources :person_exclusions, path: 'person_exclusion', except: [:index] From a4878a6e75a0429f99d2afbe021d379c1dbb47ab Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 9 Aug 2022 10:05:57 -0400 Subject: [PATCH 18/58] add policy --- app/controllers/reports/schedule_reports_controller.rb | 2 +- app/policies/reports/schedule_report_policy.rb | 5 +++++ lib/tasks/rbac.rake | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 app/policies/reports/schedule_report_policy.rb diff --git a/app/controllers/reports/schedule_reports_controller.rb b/app/controllers/reports/schedule_reports_controller.rb index af41e026c..36d93fda9 100644 --- a/app/controllers/reports/schedule_reports_controller.rb +++ b/app/controllers/reports/schedule_reports_controller.rb @@ -2,7 +2,7 @@ class Reports::ScheduleReportsController < ApplicationController around_action :set_timezone def schedule_diff - # authorize Person, policy_class: ReportPolicy + authorize Person, policy_class: Reports::ScheduleReportPolicy # TODO: base the from and to on the publish ids and this will be ok as a get pd_from = PublicationDate.find params[:from] if params[:from] diff --git a/app/policies/reports/schedule_report_policy.rb b/app/policies/reports/schedule_report_policy.rb new file mode 100644 index 000000000..6fda7eaf1 --- /dev/null +++ b/app/policies/reports/schedule_report_policy.rb @@ -0,0 +1,5 @@ +class Reports::ScheduleReportPolicy < BasePolicy + def schedule_diff? + allowed?(action: :schedule_diff) + end +end diff --git a/lib/tasks/rbac.rake b/lib/tasks/rbac.rake index 144397fe2..bc4a2aaf0 100644 --- a/lib/tasks/rbac.rake +++ b/lib/tasks/rbac.rake @@ -538,6 +538,9 @@ namespace :rbac do "assigned_sessions_not_scheduled": true, "session_copy_edit_status": true }, + "schedule_report": { + "schedule_diff": true + }, "conflict_report": { "people_outside_availability": true, "people_double_booked": true, @@ -844,6 +847,9 @@ namespace :rbac do "all_conflicts": true, "all_ignored_conflicts": true }, + "schedule_report": { + "schedule_diff": true + }, "session_conflict": { "conflicts_with": true, "conflicts_for": true, From f4b8440c5e00bb18aff920fa52e4110c67a7cfc0 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 9 Aug 2022 10:19:56 -0400 Subject: [PATCH 19/58] add pub dates endpoint --- app/controllers/publication_dates_controller.rb | 11 +++++++++++ app/policies/publication_date_policy.rb | 9 +++++++++ app/serializers/publication_date_serializer.rb | 7 +++++++ config/routes.rb | 1 + lib/tasks/rbac.rake | 9 +++++++++ 5 files changed, 37 insertions(+) create mode 100644 app/controllers/publication_dates_controller.rb create mode 100644 app/policies/publication_date_policy.rb create mode 100644 app/serializers/publication_date_serializer.rb diff --git a/app/controllers/publication_dates_controller.rb b/app/controllers/publication_dates_controller.rb new file mode 100644 index 000000000..933f9f04b --- /dev/null +++ b/app/controllers/publication_dates_controller.rb @@ -0,0 +1,11 @@ +class PublicationDatesController < ResourceController + SERIALIZER_CLASS = 'PublicationDateSerializer'.freeze + POLICY_CLASS = 'PublicationDatePolicy'.freeze + POLICY_SCOPE_CLASS = 'PublicationDatePolicy::Scope'.freeze + DEFAULT_SORTBY = 'timestamp' + DEFAULT_ORDER = 'desc'.freeze + + def paginate + false + end +end diff --git a/app/policies/publication_date_policy.rb b/app/policies/publication_date_policy.rb new file mode 100644 index 000000000..86abb72b8 --- /dev/null +++ b/app/policies/publication_date_policy.rb @@ -0,0 +1,9 @@ +class PublicationDatePolicy < PlannerPolicy + class Scope < PlannerPolicy::Scope + def resolve + if allowed?(action: :index) + scope.all + end + end + end +end diff --git a/app/serializers/publication_date_serializer.rb b/app/serializers/publication_date_serializer.rb new file mode 100644 index 000000000..fcdf55852 --- /dev/null +++ b/app/serializers/publication_date_serializer.rb @@ -0,0 +1,7 @@ +class PublicationDateSerializer + include JSONAPI::Serializer + + attributes :id, :created_at, :updated_at, :timestamp, + :new_sessions, :updated_sessions, :dropped_sessions, + :new_assignments, :updated_assignments, :dropped_assignments +end diff --git a/config/routes.rb b/config/routes.rb index 7480ffa3e..8c946a0c9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -87,6 +87,7 @@ get 'report/people_reports/record_stream_permissions', to: 'reports/people_reports#record_stream_permissions' get 'report/schedule_reports/schedule_diff(/:from)(/:to)', to: 'reports/schedule_reports#schedule_diff' + resources :publication_dates, path: 'publication_date', only: [:index] resources :availabilities, path: 'availability', except: [:index] resources :person_exclusions, path: 'person_exclusion', except: [:index] diff --git a/lib/tasks/rbac.rake b/lib/tasks/rbac.rake index bc4a2aaf0..0ccbaf9fc 100644 --- a/lib/tasks/rbac.rake +++ b/lib/tasks/rbac.rake @@ -278,6 +278,9 @@ namespace :rbac do "show": false, "update": false, "fetch": false + }, + "publication_date": { + "index": false } }) end @@ -578,6 +581,9 @@ namespace :rbac do "update": true, "fetch": true }, + "publication_date": { + "index": true + } }) end @@ -877,6 +883,9 @@ namespace :rbac do "update": true, "fetch": true }, + "publication_date": { + "index": true + } }) end end From 562e642b97b87e833b598a0c423d657f08900a05 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 9 Aug 2022 11:19:07 -0400 Subject: [PATCH 20/58] tweaks for pub diffs --- app/controllers/reports/schedule_reports_controller.rb | 10 ++++++++-- app/models/published_session_assignment.rb | 1 + app/services/change_service.rb | 3 ++- app/workers/publication_worker.rb | 5 ++--- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/controllers/reports/schedule_reports_controller.rb b/app/controllers/reports/schedule_reports_controller.rb index 36d93fda9..7fa6efb03 100644 --- a/app/controllers/reports/schedule_reports_controller.rb +++ b/app/controllers/reports/schedule_reports_controller.rb @@ -38,6 +38,8 @@ def schedule_diff tab_headers(session_time_changed, session_room_changed, session_title_changed, session_description_changed, session_added, session_removed, participants_add_drop, participants_fully_dropped) changes[:sessions].values.sort{|a,b| (a[:object] ? a[:object].title : '') <=> (b[:object] ? b[:object].title : '')}.each do |change| + next unless change[:object] + if change[:changes]['room_id'] || change[:changes]['start_time'] if change[:changes]['room_id'] && change[:changes]['start_time'] && ((!change[:changes]['room_id'][0] && change[:changes]['room_id'][1]) || @@ -73,12 +75,16 @@ def schedule_diff # TODO: sort .... ??? how fully_dropped = [] changes[:assignments].each do |id, change| + next unless change[:object] + # Participants add/drop if change[:changes]['session_assignment_role_type_id'] + session = change[:object].session if change[:object].session + session ||= Session.find change[:object].session_id if (roles.include?(change[:changes]['session_assignment_role_type_id'][1])) participants_add_drop.append_row( [ - change[:object].session.title, + session.title, '', change[:object].person.published_name ] @@ -86,7 +92,7 @@ def schedule_diff elsif (roles.include?(change[:changes]['session_assignment_role_type_id'][0])) participants_add_drop.append_row( [ - change[:object].session.title, + session.title, change[:object].person.published_name, ] ) diff --git a/app/models/published_session_assignment.rb b/app/models/published_session_assignment.rb index 1e63170bf..d764f01d4 100644 --- a/app/models/published_session_assignment.rb +++ b/app/models/published_session_assignment.rb @@ -14,6 +14,7 @@ class PublishedSessionAssignment < ApplicationRecord belongs_to :session_assignment alias :session :published_session + alias_attribute :session_id, :published_session_id enum visibility: { is_public: 'public', diff --git a/app/services/change_service.rb b/app/services/change_service.rb index db0c21f43..72303be75 100644 --- a/app/services/change_service.rb +++ b/app/services/change_service.rb @@ -54,7 +54,8 @@ def self.get_changes(clazz:, type:, from:, to:) if changes[key] changes[key][:changes] = self.merge_change_set(to: changes[key][:changes], from: audit.object_changes) else - obj = audit.event != 'destroy' ? type.find(audit.item_id) : nil + obj = type.find(audit.item_id) if audit.event != 'destroy' && type.exists?(audit.item_id) + obj ||= audit.reify changes[key] = {event: audit.event, object: obj, changes: audit.object_changes} end end diff --git a/app/workers/publication_worker.rb b/app/workers/publication_worker.rb index cd7284978..850c341c8 100644 --- a/app/workers/publication_worker.rb +++ b/app/workers/publication_worker.rb @@ -7,15 +7,14 @@ def perform # 3. Popultaed any caches that we need pub_date = nil PublishedSession.transaction do - pub_date = PublicationDate.new - - pub_date.timestamp = DateTime.current last_pub = PublicationDate.order('timestamp desc').first last_time = last_pub&.timestamp # DO WORK result = PublicationService.publish(since: last_time) + pub_date = PublicationDate.new + pub_date.timestamp = DateTime.current pub_date.update(result) pub_date.save! From c435f860b9e22e754bed82ed6ac9010c2de00275 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 9 Aug 2022 14:05:23 -0400 Subject: [PATCH 21/58] fix conditions --- .../reports/schedule_reports_controller.rb | 3 +++ app/services/change_service.rb | 12 ++++++++++-- app/services/publication_service.rb | 7 ++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/controllers/reports/schedule_reports_controller.rb b/app/controllers/reports/schedule_reports_controller.rb index 7fa6efb03..ba4efdb73 100644 --- a/app/controllers/reports/schedule_reports_controller.rb +++ b/app/controllers/reports/schedule_reports_controller.rb @@ -37,7 +37,10 @@ def schedule_diff tab_headers(session_time_changed, session_room_changed, session_title_changed, session_description_changed, session_added, session_removed, participants_add_drop, participants_fully_dropped) + # Rails.logger.debug "******** CHANGES: #{changes[:sessions]}" + changes[:sessions].values.sort{|a,b| (a[:object] ? a[:object].title : '') <=> (b[:object] ? b[:object].title : '')}.each do |change| + # Rails.logger.debug "******** CHANGE: #{change}" next unless change[:object] if change[:changes]['room_id'] || change[:changes]['start_time'] diff --git a/app/services/change_service.rb b/app/services/change_service.rb index 72303be75..1d5921d99 100644 --- a/app/services/change_service.rb +++ b/app/services/change_service.rb @@ -25,7 +25,8 @@ def self.published_sessions_changed(from:, to: nil) end def self.session_assignments_changed(from:, to: nil) - get_changes(clazz: Audit::SessionVersion, type: SessionAssignment, from: from, to: to) + publishable_sessions = PublicationService.publishable_sessions + get_changes(clazz: Audit::SessionVersion, type: SessionAssignment, from: from, to: to, publishable_session_ids: publishable_sessions.collect(&:id)) end def self.published_session_assignments_changed(from:, to: nil) @@ -37,7 +38,8 @@ def self.published_session_assignments_changed(from:, to: nil) # order by the session id and the time (oldest to newest) # for each session version get it's change set and "merge" as we go through the time line # so we have one final change set per session id which can be used for the report - def self.get_changes(clazz:, type:, from:, to:) + def self.get_changes(clazz:, type:, from:, to:, publishable_session_ids: nil) + # Rails.logger.debug "**** GET #{type} from #{from}" changes = {} audits = clazz.where("item_type = ?", type.name).order("item_id, created_at asc") @@ -45,9 +47,12 @@ def self.get_changes(clazz:, type:, from:, to:) audits = audits.where("created_at >= ?", from) if from audits = audits.where("created_at <= ?", to) if to + # Rails.logger.debug "**** AUDITS #{audits.count}" + grouped_audits = audits.group_by {|a| a.item_id} grouped_audits.each do |key, item_audits| + # Rails.logger.debug "**** AUDIT #{key} #{publishable_session_ids}" # just in case we sort by date item_audits.sort{|a,b| a.created_at <=> b.created_at}.each do |audit| # merge the change history @@ -56,6 +61,9 @@ def self.get_changes(clazz:, type:, from:, to:) else obj = type.find(audit.item_id) if audit.event != 'destroy' && type.exists?(audit.item_id) obj ||= audit.reify + if publishable_session_ids + next unless publishable_session_ids.include?(obj.session_id) + end changes[key] = {event: audit.event, object: obj, changes: audit.object_changes} end end diff --git a/app/services/publication_service.rb b/app/services/publication_service.rb index e2b6a6517..fad9f57b5 100644 --- a/app/services/publication_service.rb +++ b/app/services/publication_service.rb @@ -62,11 +62,8 @@ def self.publish_sessions(sessions:, since:) end def self.publish_assignments(sessions:, since:) - candidates = if since - self.publishable_assignments(sessions: sessions).where("session_assignments.updated_at >= ?", since) - else - self.publishable_assignments(sessions: sessions) - end + # ensure we get assignments added before the session was made publishable .... + candidates = self.publishable_assignments(sessions: sessions) # updated updated_assignments = self.publish_updated_assignments(candidates) From 6aae740d94a4e5e07af753aeb15e124a4bf276ea Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 9 Aug 2022 16:19:11 -0400 Subject: [PATCH 22/58] plan-659 moderators for publishable sessions --- .../reports/people_reports_controller.rb | 41 +++++++++++++++++++ app/javascript/reports/reports_screen.vue | 3 ++ app/models/person.rb | 7 ++++ app/policies/report_policy.rb | 4 ++ app/services/session_service.rb | 15 +++++++ config/routes.rb | 1 + lib/tasks/rbac.rake | 6 ++- 7 files changed, 75 insertions(+), 2 deletions(-) diff --git a/app/controllers/reports/people_reports_controller.rb b/app/controllers/reports/people_reports_controller.rb index 6cf0460c6..d3fd53572 100644 --- a/app/controllers/reports/people_reports_controller.rb +++ b/app/controllers/reports/people_reports_controller.rb @@ -1,6 +1,47 @@ class Reports::PeopleReportsController < ApplicationController around_action :set_timezone + def moderators + authorize Person, policy_class: ReportPolicy + + people = SessionService.live_moderators + + workbook = FastExcel.open(constant_memory: true) + worksheet = workbook.add_worksheet("Moderators and Sessions") + + worksheet.append_row( + [ + 'Published Name', + 'Primary Email', + 'Attendance Type', + 'Participant Status', + 'Session Name', + 'Session Format', + 'Session Environment' + ] + ) + + people.each do |person| + person.sessions.moderating.each do |session| + worksheet.append_row( + [ + person.published_name, + person.primary_email&.email, + person.attendance_type, + person.con_state, + session.title, + session.format&.name, + session.environment + ] + ) + end + end + + send_data workbook.read_string, + filename: "ParticipantsModeratingSessions-#{Time.now.strftime('%m-%d-%Y')}.xlsx", + disposition: 'attachment' + end + def record_stream_permissions authorize Person, policy_class: ReportPolicy diff --git a/app/javascript/reports/reports_screen.vue b/app/javascript/reports/reports_screen.vue index 2eeb786e9..37c04da46 100644 --- a/app/javascript/reports/reports_screen.vue +++ b/app/javascript/reports/reports_screen.vue @@ -98,6 +98,9 @@ Person data included: moderators, participants

+
  • + Participants Moderating at least one session +
  • Sessions
    diff --git a/app/models/person.rb b/app/models/person.rb index f05651754..c15056604 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -30,6 +30,13 @@ def publishable end has_many :sessions, through: :session_assignments do + def moderating + where("sessions.status != 'dropped'") + .where("sessions.start_time is not null and sessions.room_id is not null") + .where("session_assignments.session_assignment_role_type_id in (select id from session_assignment_role_type where session_assignment_role_type.name = 'Moderator')") + .where("session_assignments.state != 'rejected'") + end + def scheduled # get the people with the given role where("sessions.status != 'dropped'") diff --git a/app/policies/report_policy.rb b/app/policies/report_policy.rb index eea450a4c..c7b52062f 100644 --- a/app/policies/report_policy.rb +++ b/app/policies/report_policy.rb @@ -1,5 +1,9 @@ class ReportPolicy < BasePolicy + def moderators? + allowed?(action: :moderators) + end + def record_stream_permissions? allowed?(action: :record_stream_permissions) end diff --git a/app/services/session_service.rb b/app/services/session_service.rb index 05cd2a54a..be9f250a5 100644 --- a/app/services/session_service.rb +++ b/app/services/session_service.rb @@ -146,6 +146,21 @@ def self.live_people .order("people.published_name") end + def self.live_moderators + moderator = SessionAssignmentRoleType.find_by(name: 'Moderator') + + people = Person.includes( + {session_assignments: [:session, :session_assignment_role_type]} + ).references( + {session_assignments: :session} + ) + .where("session_assignments.session_assignment_role_type_id in (?)", [moderator.id]) + .where("sessions.start_time is not null and sessions.room_id is not null") + .where("sessions.status != 'dropped' and sessions.status != 'draft'") + .where("people.con_state not in (?)", ['declined', 'rejected']) #.distinct + .order("people.published_name") + end + def self.area_subquery(clazz: Session) session_table = clazz.arel_table areas_list = clazz.area_list.as('areas_list') diff --git a/config/routes.rb b/config/routes.rb index 569d02f45..c864b98cc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -85,6 +85,7 @@ get 'report/conflict_reports/all_ignored_conflicts', to: 'reports/conflict_reports#all_ignored_conflicts' get 'report/people_reports/record_stream_permissions', to: 'reports/people_reports#record_stream_permissions' + get 'report/people_reports/moderators', to: 'reports/people_reports#moderators' resources :availabilities, path: 'availability', except: [:index] resources :person_exclusions, path: 'person_exclusion', except: [:index] diff --git a/lib/tasks/rbac.rake b/lib/tasks/rbac.rake index 144397fe2..39cf5a20a 100644 --- a/lib/tasks/rbac.rake +++ b/lib/tasks/rbac.rake @@ -524,7 +524,8 @@ namespace :rbac do "schedule_by_room_then_time": true, "session_selections": true, "sessions_with_participants": true, - "record_stream_permissions": true + "record_stream_permissions": true, + "moderators": true }, "session_report": { "panels_with_too_few_people": true, @@ -820,7 +821,8 @@ namespace :rbac do "schedule_by_room_then_time": true, "session_selections": true, "sessions_with_participants": true, - "record_stream_permissions": true + "record_stream_permissions": true, + "moderators": true }, "session_report": { "panels_with_too_few_people": true, From 85f75d2f44aa362c6d0ea5ebaced2f1b30947368 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 9 Aug 2022 16:32:32 -0400 Subject: [PATCH 23/58] plan-670 daily grid --- .../reports/session_reports_controller.rb | 40 +++++++++++++++++++ app/javascript/reports/reports_screen.vue | 3 ++ app/policies/reports/session_report_policy.rb | 4 ++ app/services/session_service.rb | 1 + config/routes.rb | 1 + lib/tasks/rbac.rake | 6 ++- 6 files changed, 53 insertions(+), 2 deletions(-) diff --git a/app/controllers/reports/session_reports_controller.rb b/app/controllers/reports/session_reports_controller.rb index 13099a914..c3eb535fe 100644 --- a/app/controllers/reports/session_reports_controller.rb +++ b/app/controllers/reports/session_reports_controller.rb @@ -1,6 +1,46 @@ class Reports::SessionReportsController < ApplicationController around_action :set_timezone + def daily_grid + authorize SessionAssignment, policy_class: Reports::SessionReportPolicy + + sessions = SessionService.published_sessions + + workbook = FastExcel.open(constant_memory: true) + worksheet = workbook.add_worksheet("Assigned Session not Sched") + date_time_style = workbook.number_format("d mmm yyyy h:mm") + styles = [ + nil, nil, nil, date_time_style, nil + ] + + worksheet.append_row( + [ + 'Session', + 'Areas', + 'Format', + 'Time', + 'Room' + ] + ) + + sessions.each do |session| + worksheet.append_row( + [ + session.title, + session.area_list.sort.join(';'), + session.format&.name, + session.start_time ? FastExcel.date_num(session.start_time, session.start_time.in_time_zone.utc_offset) : nil, + session.room&.name + ], + styles + ) + end + + send_data workbook.read_string, + filename: "DailyGrid#{Time.now.strftime('%m-%d-%Y')}.xlsx", + disposition: 'attachment' + end + def session_copy_edit_status authorize SessionAssignment, policy_class: Reports::SessionReportPolicy diff --git a/app/javascript/reports/reports_screen.vue b/app/javascript/reports/reports_screen.vue index 2eeb786e9..fa780b3ab 100644 --- a/app/javascript/reports/reports_screen.vue +++ b/app/javascript/reports/reports_screen.vue @@ -172,6 +172,9 @@ Session data included: all sessions

    +
  • + Daily Grid +
  • Conflicts
    diff --git a/app/policies/reports/session_report_policy.rb b/app/policies/reports/session_report_policy.rb index fcecd43e2..de8f435f6 100644 --- a/app/policies/reports/session_report_policy.rb +++ b/app/policies/reports/session_report_policy.rb @@ -38,4 +38,8 @@ def assigned_sessions_not_scheduled? def session_copy_edit_status? allowed?(action: :session_copy_edit_status) end + + def daily_grid? + allowed?(action: :daily_grid) + end end diff --git a/app/services/session_service.rb b/app/services/session_service.rb index 05cd2a54a..e04388759 100644 --- a/app/services/session_service.rb +++ b/app/services/session_service.rb @@ -101,6 +101,7 @@ def self.published_sessions ) .includes(:format, :room, {participant_assignments: :person}) .joins(self.area_subquery(clazz: PublishedSession)) + .order(:start_time) end def self.live_sessions diff --git a/config/routes.rb b/config/routes.rb index 569d02f45..25182ce80 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -70,6 +70,7 @@ get 'report/session_reports/session_with_no_moderator', to: 'reports/session_reports#session_with_no_moderator' get 'report/session_reports/assigned_sessions_not_scheduled', to: 'reports/session_reports#assigned_sessions_not_scheduled' get 'report/session_reports/session_copy_edit_status', to: 'reports/session_reports#session_copy_edit_status' + get 'report/session_reports/daily_grid', to: 'reports/session_reports#daily_grid' get 'report/session_reports/scheduled_session_no_people', to: 'reports/session_reports#scheduled_session_no_people' get 'report/session_reports/non_accepted_on_schedule', to: 'reports/session_reports#non_accepted_on_schedule' get 'report/session_reports/participants_over_session_limits', to: 'reports/session_reports#participants_over_session_limits' diff --git a/lib/tasks/rbac.rake b/lib/tasks/rbac.rake index 144397fe2..3fb9acb31 100644 --- a/lib/tasks/rbac.rake +++ b/lib/tasks/rbac.rake @@ -536,7 +536,8 @@ namespace :rbac do "session_with_no_moderator": true, "scheduled_session_no_people": true, "assigned_sessions_not_scheduled": true, - "session_copy_edit_status": true + "session_copy_edit_status": true, + "daily_grid": true }, "conflict_report": { "people_outside_availability": true, @@ -832,7 +833,8 @@ namespace :rbac do "session_with_no_moderator": true, "scheduled_session_no_people": true, "assigned_sessions_not_scheduled": true, - "session_copy_edit_status": true + "session_copy_edit_status": true, + "daily_grid": true }, "conflict_report": { "people_outside_availability": true, From ae788d6f59c17f000c3deeba127c3978d0d156e7 Mon Sep 17 00:00:00 2001 From: Gail Terman Date: Tue, 9 Aug 2022 19:05:06 -0400 Subject: [PATCH 24/58] add schedule confirm dialog --- app/javascript/schedule/schedule_settings.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/javascript/schedule/schedule_settings.vue b/app/javascript/schedule/schedule_settings.vue index 3e90e7ad2..6e8b33399 100644 --- a/app/javascript/schedule/schedule_settings.vue +++ b/app/javascript/schedule/schedule_settings.vue @@ -27,7 +27,7 @@ Show difference - Create a publish snapshot + Create a publish snapshot @@ -55,6 +55,11 @@ {{SCHEDULE_FIRM_CONFIRM_MESSAGE}}
    + + + This will publish the schedule and make the current version of it available to external sources. This action is + irreversible and will bring the server down for a short time. Please double check that you wish to perform this action. + From ab2a8b78cdd2c85a6a7d8e66bebe8db982174f5e Mon Sep 17 00:00:00 2001 From: dcterman <105614148+dcterman@users.noreply.github.com> Date: Tue, 9 Aug 2022 19:39:47 -0400 Subject: [PATCH 25/58] Add descriptive info for 2 new reports In Participants: Participants moderating at least one session In Sessions: Daily Grid --- app/javascript/reports/reports_screen.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/javascript/reports/reports_screen.vue b/app/javascript/reports/reports_screen.vue index 77eda70bb..29359380f 100644 --- a/app/javascript/reports/reports_screen.vue +++ b/app/javascript/reports/reports_screen.vue @@ -99,7 +99,13 @@

  • - Participants Moderating at least one session + Participants Moderating at least One Session +

    + Description: People serving as moderator for at least one session, and the session information, one line per person and session
    + Fields: Person name, published name, primary email, attendance type (in-person, virtual, hybrid), participant status, session title, session environment
    + Session data included: all scheduled sessions
    + Person data included: moderators +

  • @@ -177,6 +183,11 @@
  • Daily Grid +

    + Description: Session information for daily grid, one line per session
    + Fields: Session title, area(s) of session, session format, session start time, session room
    + Session data included: all scheduled sessions that are visible and published +

  • From ca051d21a2b9c59e0961ed2d2f34878ba5bfce32 Mon Sep 17 00:00:00 2001 From: Gail Terman Date: Tue, 9 Aug 2022 20:23:46 -0400 Subject: [PATCH 26/58] hook up buttons --- app/javascript/schedule/schedule_settings.vue | 48 +++++++++---------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/app/javascript/schedule/schedule_settings.vue b/app/javascript/schedule/schedule_settings.vue index 6e8b33399..dc44520c4 100644 --- a/app/javascript/schedule/schedule_settings.vue +++ b/app/javascript/schedule/schedule_settings.vue @@ -24,7 +24,7 @@ - Show difference + Show difference Create a publish snapshot @@ -94,33 +94,12 @@ export default { SCHEDULE_DRAFT_CONFIRM_MESSAGE, SCHEDULE_FIRM_CONFIRM_MESSAGE, NODE_ENV, - mockSnapshots: [ - {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - {timestamp: '2022-08-04T00:24:00Z', id:'67890'}, - {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - {timestamp: '2022-08-01T09:58:00Z', id: '12345'}, - ], - pubsDiff: [false, false, false], + snapshots: [ ], + pubsDiff: [], }), computed: { pubSnapshots() { - return [{timestamp: "Current state", id: null}, ...this.mockSnapshots.map(snap => ({...snap, timestamp: DateTime.fromISO(snap.timestamp).toFormat("DDDD, t ZZZZ")}))] + return [{timestamp: "Current state", id: null}, ...this.snapshots.map(snap => ({...snap, timestamp: DateTime.fromISO(snap.timestamp).toFormat("DDDD, t ZZZZ")}))] }, pubsDiffCount() { return this.pubsDiff.filter(pd => pd).length @@ -169,6 +148,19 @@ export default { }, publishdSchedule() { this.toastPromise(http.get('/session/schedule_publish'), "Succesfully requested publish") + }, + diff() { + console.log('clicked diff'); + const ids = this.snapshots.filter((s, i) => this.pubsDiff[i+1]).map(s => s.id) + // these will be in reverse time order because magic! + let url = '/report/schedule_reports/schedule_diff' + if(ids.length > 1) { + url += `/${ids[1]}/${ids[0]}` + } else { + url += `/${ids[0]}` + } + console.log('going to url', url) + window.open(url, '_blank'); } }, watch: { @@ -193,6 +185,12 @@ export default { this.localFirmSchedule = this.firmSchedule; this.firmScheduleConfirmed = this.firmSchedule; }) + this.$store.dispatch('jv/get', '/publication_date').then((data) => { + const {_jv, ...filteredData} = data; + this.snapshots = Object.values(filteredData).map(s => ({timestamp: s.timestamp, id: s.id})) + this.snapshots.sort((a, b) => DateTime.fromISO(b.timestamp) - DateTime.fromISO(a.timestamp)); + this.pubsDiff = [false, ...Object.keys(filteredData).map(s => false)]; + }) } } From b8dd945da195480fb39e4608c6e47f5c089e57a1 Mon Sep 17 00:00:00 2001 From: Gail Terman Date: Tue, 9 Aug 2022 20:50:10 -0400 Subject: [PATCH 27/58] plan-662 make staging visually different --- app/javascript/navbar/bottom-navbar.vue | 8 ++++++-- app/javascript/navbar/top-navbar.vue | 8 +++++--- app/javascript/stylesheets/style.scss | 7 +++++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/javascript/navbar/bottom-navbar.vue b/app/javascript/navbar/bottom-navbar.vue index 393151dab..68ee741f8 100644 --- a/app/javascript/navbar/bottom-navbar.vue +++ b/app/javascript/navbar/bottom-navbar.vue @@ -1,5 +1,5 @@