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 @@
Publish Firm Schedule Confirmation
{{SCHEDULE_FIRM_CONFIRM_MESSAGE}}
+
+ Publish Schedule To Public Confirmation
+ 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 @@
-
+
@@ -9,13 +9,17 @@
diff --git a/app/javascript/navbar/top-navbar.vue b/app/javascript/navbar/top-navbar.vue
index 4e654b0c0..72a102e02 100644
--- a/app/javascript/navbar/top-navbar.vue
+++ b/app/javascript/navbar/top-navbar.vue
@@ -1,7 +1,7 @@
-
- Planorama
+
+ Planorama - {{currentSettings.env}}
Logged in as: {{currentUser.primary_email ? currentUser.primary_email.email : ''}}
@@ -20,6 +20,7 @@
From dc73a2bb6e8cb60daaf1624e122d88ada69fe503 Mon Sep 17 00:00:00 2001
From: Leane Verhulst
Date: Thu, 11 Aug 2022 20:10:15 -0500
Subject: [PATCH 39/58] PLAN-689 PLAN-690 fix conclar fields
---
.../conclar/participant_serializer.rb | 20 +++++++++-
app/serializers/conclar/session_serializer.rb | 37 ++++++++++++-------
2 files changed, 41 insertions(+), 16 deletions(-)
diff --git a/app/serializers/conclar/participant_serializer.rb b/app/serializers/conclar/participant_serializer.rb
index 1b33c60fa..9cbe3540a 100644
--- a/app/serializers/conclar/participant_serializer.rb
+++ b/app/serializers/conclar/participant_serializer.rb
@@ -50,13 +50,29 @@ class Conclar::ParticipantSerializer < ActiveModel::Serializer
attribute :tags do
res = []
- if object.attendance_type # in person, virtual, hybrid
+ case object.attendance_type
+ when 'in person'
t = {
value: "person_".concat(object.attendance_type),
category: "Attendance",
- label: object.attendance_type
+ label: 'In Person'
}
res << t
+ when 'hybrid'
+ t = {
+ value: "person_".concat(object.attendance_type),
+ category: "Attendance",
+ label: 'Hybrid'
+ }
+ res << t
+ when 'virtual'
+ t = {
+ value: "person_".concat(object.attendance_type),
+ category: "Attendance",
+ label: 'Virtual'
+ }
+ res << t
+ else
end
res
diff --git a/app/serializers/conclar/session_serializer.rb b/app/serializers/conclar/session_serializer.rb
index 0aba0ad26..7ad4834bc 100644
--- a/app/serializers/conclar/session_serializer.rb
+++ b/app/serializers/conclar/session_serializer.rb
@@ -21,7 +21,7 @@ class Conclar::SessionSerializer < ActiveModel::Serializer
object.start_time
end
- # TODO: change for when we do have tags
+
attribute :tags do
res = []
@@ -34,22 +34,31 @@ class Conclar::SessionSerializer < ActiveModel::Serializer
res << a
end
-
- #res.concat ["Environment: ".concat( object.environment )] if object.environment != 'unknown' # virtual hybrid etc
- if object.environment != 'unknown' # virtual hybrid etc
+ case object.environment
+ when 'in_person'
t = {
value: "session_".concat(object.environment),
category: "Environment",
- label: object.environment
+ label: 'In Person'
}
res << t
+ when 'hybrid'
+ t = {
+ value: "session_".concat(object.environment),
+ category: "Environment",
+ label: 'Hybrid'
+ }
+ res << t
+ when 'virtual'
+ t = {
+ value: "session_".concat(object.environment),
+ category: "Environment",
+ label: 'Virtual'
+ }
+ res << t
+ else
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
if object.age_restriction
t = {
value: "session_".concat(object.age_restriction.name),
@@ -58,16 +67,16 @@ class Conclar::SessionSerializer < ActiveModel::Serializer
}
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"
+ label: "Requires Signup"
}
res << t
end
- #res.concat ['Note: Recorded'] if object.recorded
+
if object.recorded
t = {
value: "session_recorded",
@@ -76,7 +85,7 @@ class Conclar::SessionSerializer < ActiveModel::Serializer
}
res << t
end
- #res.concat ['Note: Streamed'] if object.streamed
+
if object.streamed
t = {
value: "session_streamed",
From 66bfb243a0c17408d1c613735c7312559de90aa3 Mon Sep 17 00:00:00 2001
From: dcterman <105614148+dcterman@users.noreply.github.com>
Date: Thu, 11 Aug 2022 21:20:36 -0400
Subject: [PATCH 40/58] PLAN-693 tweak column headings
Sessions Streamed and Recorded: removed hyphen from Live-Streamed column heading, changed Time to Start Time
Daily Grid: changed Time to Start Time
---
app/controllers/reports/session_reports_controller.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/controllers/reports/session_reports_controller.rb b/app/controllers/reports/session_reports_controller.rb
index 771a32aca..bf536b40a 100644
--- a/app/controllers/reports/session_reports_controller.rb
+++ b/app/controllers/reports/session_reports_controller.rb
@@ -16,11 +16,11 @@ def streamed_and_recorded
worksheet.append_row(
[
'Session',
- 'Time',
+ 'Start Time',
'Room',
'Format',
'Environment',
- 'Live-Streamed',
+ 'Livestreamed',
'Recorded'
]
)
@@ -62,7 +62,7 @@ def daily_grid
'Session',
'Areas',
'Format',
- 'Time',
+ 'Start Time',
'Room'
]
)
From 24ac3aafecb06465777a0c4c4cd46f95c41644dc Mon Sep 17 00:00:00 2001
From: dcterman <105614148+dcterman@users.noreply.github.com>
Date: Thu, 11 Aug 2022 21:39:54 -0400
Subject: [PATCH 41/58] Add descriptions to new reports PLAN-683
Back of Badge
Scheduled Sessions Streamed and/or Recorded
---
app/javascript/reports/reports_screen.vue | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/app/javascript/reports/reports_screen.vue b/app/javascript/reports/reports_screen.vue
index be6fff17a..49547bb20 100644
--- a/app/javascript/reports/reports_screen.vue
+++ b/app/javascript/reports/reports_screen.vue
@@ -192,6 +192,11 @@
Scheduled Sessions Streamed and/or Recorded
+
+ Description : Information about livestreaming and recording, one line per session
+ Fields : Session title, session start time, session room, session format, session environment, is session livestreamed (y/n), is session recorded (y/n)
+ Session data included : all scheduled sessions
+
@@ -302,6 +307,12 @@
Back of Badge
+
+ Description : Participant schedule for mail merge, one line per person, with variable line length based on number of assigned sessions
+ Fields : Published name, Session 1 Title, Session 1 Start Time, Session 1 Duration, Session 1 Room, then repeat the 4 session columns as needed
+ Session data included : all published sessions
+ Person data included : moderators, participants, invisible participants
+
From 346f0485ea54fed65481c926ff686eb694c517f0 Mon Sep 17 00:00:00 2001
From: Henry
Date: Thu, 11 Aug 2022 23:00:03 -0400
Subject: [PATCH 42/58] fix saving signups (audience size)
---
app/controllers/sessions_controller.rb | 2 +-
app/models/session.rb | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index 9211e11c9..51953a6f2 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -303,7 +303,7 @@ def allowed_params
item_notes
tech_notes
pub_reference_number
- audience_size,
+ audience_size
participant_notes
is_break
start_time
diff --git a/app/models/session.rb b/app/models/session.rb
index 9ad5febb1..b2102e1bf 100644
--- a/app/models/session.rb
+++ b/app/models/session.rb
@@ -5,6 +5,7 @@ class Session < ApplicationRecord
validates_numericality_of :duration, allow_nil: true
validates_numericality_of :minimum_people, allow_nil: true
validates_numericality_of :maximum_people, allow_nil: true
+ validates_numericality_of :audience_size, allow_nil: true
# NOTE: when we have a config for default duration change to use a lambda
attribute :duration, default: 60
From c952fe8bacf11b7a995e19b315f9e4b5da5ab7da Mon Sep 17 00:00:00 2001
From: Henry
Date: Fri, 12 Aug 2022 07:24:27 -0400
Subject: [PATCH 43/58] adjust pub diffs so add and drops do not alos create
info about title and description
---
app/controllers/reports/schedule_reports_controller.rb | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/controllers/reports/schedule_reports_controller.rb b/app/controllers/reports/schedule_reports_controller.rb
index ba4efdb73..0e3095538 100644
--- a/app/controllers/reports/schedule_reports_controller.rb
+++ b/app/controllers/reports/schedule_reports_controller.rb
@@ -48,9 +48,11 @@ def schedule_diff
((!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)
+ next
else
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)
+ next
else
if change[:changes]['room_id']
session_room_change_row(session_room_changed, change)
From 46ae632b02cffb6ce55c39851389e2cf4a3e5c89 Mon Sep 17 00:00:00 2001
From: dcterman <105614148+dcterman@users.noreply.github.com>
Date: Fri, 12 Aug 2022 08:22:17 -0400
Subject: [PATCH 44/58] Insert missing strong tag
---
app/javascript/reports/reports_screen.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/javascript/reports/reports_screen.vue b/app/javascript/reports/reports_screen.vue
index 49547bb20..613746ac9 100644
--- a/app/javascript/reports/reports_screen.vue
+++ b/app/javascript/reports/reports_screen.vue
@@ -310,7 +310,7 @@
Description : Participant schedule for mail merge, one line per person, with variable line length based on number of assigned sessions
Fields : Published name, Session 1 Title, Session 1 Start Time, Session 1 Duration, Session 1 Room, then repeat the 4 session columns as needed
- Session data included : all published sessions
+ Session data included : all published sessions
Person data included : moderators, participants, invisible participants
From 5a5694b5d4dcf4892a99ba04fbbae206ebf50e4d Mon Sep 17 00:00:00 2001
From: Henry
Date: Fri, 12 Aug 2022 08:58:54 -0400
Subject: [PATCH 45/58] should use fetchall and on paged
---
app/javascript/sessions/assign_participants.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/javascript/sessions/assign_participants.vue b/app/javascript/sessions/assign_participants.vue
index 09bbe7704..58798c6dd 100644
--- a/app/javascript/sessions/assign_participants.vue
+++ b/app/javascript/sessions/assign_participants.vue
@@ -107,7 +107,7 @@ export default {
)
},
refreshAssignments(arg) {
- this.fetchPaged(false).then(
+ this.fetchAll(false).then(
() => {
this.refreshSession()
}
From 96e9ba4ee686d29dbce50810d43194f5bbb202e9 Mon Sep 17 00:00:00 2001
From: Gail Terman
Date: Fri, 12 Aug 2022 10:13:10 -0400
Subject: [PATCH 46/58] no-more-manual-versions
using shields.io to provide version information based off current releases
---
docs/index.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/index.md b/docs/index.md
index f043b9ca6..c583bae60 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: 2.0.0
+Production version: https://img.shields.io/github/v/release/ChicagoWorldcon/planorama?label=production
-Staging version: 2.0.0
+Staging version: https://img.shields.io/github/v/release/ChicagoWorldcon/planorama?include_prereleases&label=staging
From 53df4072e934c8216a9e53bc7de9dc92219cb929 Mon Sep 17 00:00:00 2001
From: Gail Terman
Date: Fri, 12 Aug 2022 10:22:42 -0400
Subject: [PATCH 47/58] Update index.md
---
docs/index.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/index.md b/docs/index.md
index c583bae60..669d1dd6d 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: https://img.shields.io/github/v/release/ChicagoWorldcon/planorama?label=production
+![Production version](https://img.shields.io/github/v/release/ChicagoWorldcon/planorama?label=production)
-Staging version: https://img.shields.io/github/v/release/ChicagoWorldcon/planorama?include_prereleases&label=staging
+![Staging version](https://img.shields.io/github/v/release/ChicagoWorldcon/planorama?include_prereleases&label=staging)
From 82c54177e43d717c65957baf1d36fd2e6390a01d Mon Sep 17 00:00:00 2001
From: Henry
Date: Fri, 12 Aug 2022 14:10:24 -0400
Subject: [PATCH 48/58] change date format for excel to be 12 hour add mins to
duration in back of badges
---
app/controllers/application_controller.rb | 2 ++
.../reports/conflict_reports_controller.rb | 16 ++++++++--------
.../reports/program_ops_reports_controller.rb | 4 ++--
.../reports/schedule_reports_controller.rb | 2 +-
.../reports/session_reports_controller.rb | 12 ++++++------
app/controllers/reports_controller.rb | 6 +++---
app/controllers/survey/submissions_controller.rb | 2 +-
app/lib/active_model/xls_array_serializer.rb | 2 +-
8 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 5b9dcaf6d..8ae0032ea 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -2,6 +2,8 @@ class ApplicationController < ActionController::Base
include Pundit::Authorization
include JSONAPI::Errors
+ EXCEL_NBR_FORMAT = "[$-409]d mmm yyyy h:mm AM/PM;@".freeze
+
skip_before_action :verify_authenticity_token
before_action :configure_permitted_parameters, if: :devise_controller?
diff --git a/app/controllers/reports/conflict_reports_controller.rb b/app/controllers/reports/conflict_reports_controller.rb
index e30c7ec82..89ac5e919 100644
--- a/app/controllers/reports/conflict_reports_controller.rb
+++ b/app/controllers/reports/conflict_reports_controller.rb
@@ -20,7 +20,7 @@ def all_ignored_conflicts
'Conflict Type'
]
)
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
styles = [
nil, nil, date_time_style, nil, nil
]
@@ -63,7 +63,7 @@ def all_conflicts
'Conflict Type'
]
)
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
styles = [
nil, nil, date_time_style, nil, nil, nil, nil
]
@@ -109,7 +109,7 @@ def multiple_sessions_in_room
'Start Time'
]
)
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
styles = [
nil, nil, nil, date_time_style,
]
@@ -175,7 +175,7 @@ def person_exclusion_conflicts
'Conflict Session Start Time'
]
)
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
styles = [
nil, nil, nil, nil, nil, date_time_style,
nil, nil, date_time_style
@@ -278,7 +278,7 @@ def back_to_back_to_back
'Conflict 2 Room'
]
)
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
styles = [
nil, nil, nil, nil, nil, date_time_style, nil, nil,
nil, nil, date_time_style, nil, nil,
@@ -376,7 +376,7 @@ def back_to_back
'Conflict Room'
]
)
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
styles = [nil, nil, nil, nil, nil, date_time_style, nil, nil, nil, nil, date_time_style, nil, nil]
conflicts.each do |conflict|
@@ -459,7 +459,7 @@ def people_double_booked
]
)
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
styles = [nil, nil, nil, date_time_style, nil, nil, nil, nil, nil]
conflicts.each do |conflict|
@@ -528,7 +528,7 @@ def people_outside_availability
'Availability'
]
)
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
styles = [nil, nil, nil, nil, nil, date_time_style, nil, nil]
conflicts.each do |conflict|
diff --git a/app/controllers/reports/program_ops_reports_controller.rb b/app/controllers/reports/program_ops_reports_controller.rb
index 92e6e8cfe..055ee14e3 100644
--- a/app/controllers/reports/program_ops_reports_controller.rb
+++ b/app/controllers/reports/program_ops_reports_controller.rb
@@ -11,7 +11,7 @@ def back_of_badge
workbook = FastExcel.open #(constant_memory: true)
worksheet = workbook.add_worksheet("Back of Badge")
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
worksheet.append_row([]) # For the header
@@ -27,7 +27,7 @@ def back_of_badge
row.concat [
assignment.session.title,
assignment.session.start_time ? FastExcel.date_num(assignment.session.start_time, assignment.session.start_time.in_time_zone.utc_offset) : nil,
- assignment.session.duration,
+ assignment.session.duration + 'mins',
assignment.session.room&.name,
]
styles.concat [
diff --git a/app/controllers/reports/schedule_reports_controller.rb b/app/controllers/reports/schedule_reports_controller.rb
index 0e3095538..e781a8ddb 100644
--- a/app/controllers/reports/schedule_reports_controller.rb
+++ b/app/controllers/reports/schedule_reports_controller.rb
@@ -23,7 +23,7 @@ def schedule_diff
to ||= Time.now
workbook = FastExcel.open(constant_memory: true)
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
session_time_changed = workbook.add_worksheet("Session Time Changed")
session_room_changed = workbook.add_worksheet("Session Room Changed")
diff --git a/app/controllers/reports/session_reports_controller.rb b/app/controllers/reports/session_reports_controller.rb
index bf536b40a..1a5ab7550 100644
--- a/app/controllers/reports/session_reports_controller.rb
+++ b/app/controllers/reports/session_reports_controller.rb
@@ -8,7 +8,7 @@ def streamed_and_recorded
workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("Sessions streamed and recorded")
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
styles = [
nil, date_time_style, nil, nil, nil, nil, nil
]
@@ -52,7 +52,7 @@ def daily_grid
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")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
styles = [
nil, nil, nil, date_time_style, nil
]
@@ -169,7 +169,7 @@ def scheduled_session_no_people
workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("Sched Sessions no Participants")
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
styles = [
nil, nil, date_time_style, nil
]
@@ -207,7 +207,7 @@ def session_with_no_moderator
workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("Sessions no Moderator")
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
styles = [
nil, nil, date_time_style, nil, nil, nil
]
@@ -421,7 +421,7 @@ def panels_with_too_few_people
workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("Panels with too Few People")
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
styles = [
nil, nil, date_time_style, nil, nil, nil, nil
]
@@ -467,7 +467,7 @@ def panels_with_too_many_people
workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("Panels with too Many People")
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
styles = [
nil, nil, date_time_style, nil, nil, nil
]
diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb
index 7e37b1e03..2d5c3cb07 100644
--- a/app/controllers/reports_controller.rb
+++ b/app/controllers/reports_controller.rb
@@ -8,7 +8,7 @@ def schedule_accpetance
workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("Approvals")
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
styles = [
nil, nil, nil, nil, nil,
nil, nil, date_time_style,
@@ -234,7 +234,7 @@ def schedule_by_room_then_time
'Assigned'
]
)
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
styles = [nil, nil, date_time_style, nil, nil, nil, nil]
moderator = SessionAssignmentRoleType.find_by(name: 'Moderator')
participant = SessionAssignmentRoleType.find_by(name: 'Participant')
@@ -322,7 +322,7 @@ def schedule_by_person
]
)
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
styles = [nil, nil, nil, nil, nil, date_time_style, nil, nil, nil]
people_sessions.each do |sa|
worksheet.append_row(
diff --git a/app/controllers/survey/submissions_controller.rb b/app/controllers/survey/submissions_controller.rb
index ac77cc121..413ef6648 100644
--- a/app/controllers/survey/submissions_controller.rb
+++ b/app/controllers/survey/submissions_controller.rb
@@ -106,7 +106,7 @@ def index
def collection_to_xls
workbook = FastExcel.open(constant_memory: true) # creates tmp file
worksheet = workbook.add_worksheet("Export")
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
styles = [date_time_style,date_time_style]
# Get the survey questions
submission = @collection.first
diff --git a/app/lib/active_model/xls_array_serializer.rb b/app/lib/active_model/xls_array_serializer.rb
index d1b94afa7..0d283801a 100644
--- a/app/lib/active_model/xls_array_serializer.rb
+++ b/app/lib/active_model/xls_array_serializer.rb
@@ -19,7 +19,7 @@ def to_xls
workbook = FastExcel.open(constant_memory: true) # creates tmp file
worksheet = workbook.add_worksheet("Export")
- date_time_style = workbook.number_format("d mmm yyyy h:mm")
+ date_time_style = workbook.number_format("[$-409]d mmm yyyy h:mm AM/PM;@")
date_style = workbook.number_format("d mmm yyyy")
time_style = workbook.number_format("h:mm")
From ec133f3a5d742c21352bd0ecfc61cd80aa74d382 Mon Sep 17 00:00:00 2001
From: Henry
Date: Fri, 12 Aug 2022 14:14:36 -0400
Subject: [PATCH 49/58] PLAN-700 add duration to daily grid
---
app/controllers/reports/session_reports_controller.rb | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/controllers/reports/session_reports_controller.rb b/app/controllers/reports/session_reports_controller.rb
index 1a5ab7550..194b97c2b 100644
--- a/app/controllers/reports/session_reports_controller.rb
+++ b/app/controllers/reports/session_reports_controller.rb
@@ -63,6 +63,7 @@ def daily_grid
'Areas',
'Format',
'Start Time',
+ 'Duration',
'Room'
]
)
@@ -74,6 +75,7 @@ def daily_grid
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.duration,
session.room&.name
],
styles
From 9d75e7e7d1a2f2a41d5d70c383596c87de87f305 Mon Sep 17 00:00:00 2001
From: Henry
Date: Fri, 12 Aug 2022 16:56:17 -0400
Subject: [PATCH 50/58] deal with dropped and draft session state changes
---
.../reports/schedule_reports_controller.rb | 13 +++++++++++++
app/models/published_session.rb | 2 +-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/app/controllers/reports/schedule_reports_controller.rb b/app/controllers/reports/schedule_reports_controller.rb
index 0e3095538..8fb2141ec 100644
--- a/app/controllers/reports/schedule_reports_controller.rb
+++ b/app/controllers/reports/schedule_reports_controller.rb
@@ -51,6 +51,7 @@ def schedule_diff
next
else
if (change[:changes]['room_id'] && !change[:changes]['room_id'][1]) || (change[:changes]['start_time'] && !change[:changes]['start_time'][1])|| change[:event] == 'destroy'
+ # Rails.logger.debug "******** removed because room or time"
session_removed_row(session_removed, change)
next
else
@@ -64,6 +65,18 @@ def schedule_diff
end
end
+ if change[:changes]['status']
+ if change[:changes]['status'][1] == 'draft' || change[:changes]['status'][1] == 'dropped'
+ # Rails.logger.debug "******** removed because draft"
+ session_removed_row(session_removed, change)
+ next
+ elsif change[:changes]['status'][0] == 'draft' || change[:changes]['status'][0] == 'dropped'
+ # Rails.logger.debug "******** added because state change"
+ session_added_row(session_added, change, date_time_style)
+ next
+ end
+ end
+
if change[:changes]['title']
session_title_change_row(session_title_changed, change)
end
diff --git a/app/models/published_session.rb b/app/models/published_session.rb
index 10b3ab459..73297072d 100644
--- a/app/models/published_session.rb
+++ b/app/models/published_session.rb
@@ -8,7 +8,7 @@ class PublishedSession < ApplicationRecord
ignore: [:updated_at, :created_at, :lock_version, :integrations],
limit: nil
- belongs_to :format
+ belongs_to :format, required: false
belongs_to :session
belongs_to :room, required: false
From 6ef19a578e3f5501f999d653fed48282a167d93a Mon Sep 17 00:00:00 2001
From: Leane Verhulst
Date: Fri, 12 Aug 2022 16:04:56 -0500
Subject: [PATCH 51/58] PLAN-702 Remove venue from data sent to conclar
---
app/serializers/conclar/session_serializer.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/serializers/conclar/session_serializer.rb b/app/serializers/conclar/session_serializer.rb
index 7ad4834bc..4d7b4c418 100644
--- a/app/serializers/conclar/session_serializer.rb
+++ b/app/serializers/conclar/session_serializer.rb
@@ -105,7 +105,8 @@ class Conclar::SessionSerializer < ActiveModel::Serializer
attribute :loc do
# [ "Some Room", "Some Area" ],
if object.room
- [object.room.name, object.room.venue.name]
+ # [object.room.name, object.room.venue.name]
+ [object.room.name]
else
[]
end
From aba977aa93187a01cb1fa5f3c930c1fe27e00cf0 Mon Sep 17 00:00:00 2001
From: Henry
Date: Fri, 12 Aug 2022 17:59:24 -0400
Subject: [PATCH 52/58] fix format change
---
.../reports/conflict_reports_controller.rb | 16 ++++++++--------
.../reports/session_reports_controller.rb | 10 +++++-----
app/controllers/reports_controller.rb | 6 +++---
app/controllers/survey/submissions_controller.rb | 2 +-
4 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/app/controllers/reports/conflict_reports_controller.rb b/app/controllers/reports/conflict_reports_controller.rb
index 89ac5e919..e30c7ec82 100644
--- a/app/controllers/reports/conflict_reports_controller.rb
+++ b/app/controllers/reports/conflict_reports_controller.rb
@@ -20,7 +20,7 @@ def all_ignored_conflicts
'Conflict Type'
]
)
- date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
+ date_time_style = workbook.number_format("d mmm yyyy h:mm")
styles = [
nil, nil, date_time_style, nil, nil
]
@@ -63,7 +63,7 @@ def all_conflicts
'Conflict Type'
]
)
- date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
+ date_time_style = workbook.number_format("d mmm yyyy h:mm")
styles = [
nil, nil, date_time_style, nil, nil, nil, nil
]
@@ -109,7 +109,7 @@ def multiple_sessions_in_room
'Start Time'
]
)
- date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
+ date_time_style = workbook.number_format("d mmm yyyy h:mm")
styles = [
nil, nil, nil, date_time_style,
]
@@ -175,7 +175,7 @@ def person_exclusion_conflicts
'Conflict Session Start Time'
]
)
- date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
+ date_time_style = workbook.number_format("d mmm yyyy h:mm")
styles = [
nil, nil, nil, nil, nil, date_time_style,
nil, nil, date_time_style
@@ -278,7 +278,7 @@ def back_to_back_to_back
'Conflict 2 Room'
]
)
- date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
+ date_time_style = workbook.number_format("d mmm yyyy h:mm")
styles = [
nil, nil, nil, nil, nil, date_time_style, nil, nil,
nil, nil, date_time_style, nil, nil,
@@ -376,7 +376,7 @@ def back_to_back
'Conflict Room'
]
)
- date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
+ date_time_style = workbook.number_format("d mmm yyyy h:mm")
styles = [nil, nil, nil, nil, nil, date_time_style, nil, nil, nil, nil, date_time_style, nil, nil]
conflicts.each do |conflict|
@@ -459,7 +459,7 @@ def people_double_booked
]
)
- date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
+ date_time_style = workbook.number_format("d mmm yyyy h:mm")
styles = [nil, nil, nil, date_time_style, nil, nil, nil, nil, nil]
conflicts.each do |conflict|
@@ -528,7 +528,7 @@ def people_outside_availability
'Availability'
]
)
- date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
+ date_time_style = workbook.number_format("d mmm yyyy h:mm")
styles = [nil, nil, nil, nil, nil, date_time_style, nil, nil]
conflicts.each do |conflict|
diff --git a/app/controllers/reports/session_reports_controller.rb b/app/controllers/reports/session_reports_controller.rb
index 1a5ab7550..6e58fbda3 100644
--- a/app/controllers/reports/session_reports_controller.rb
+++ b/app/controllers/reports/session_reports_controller.rb
@@ -8,7 +8,7 @@ def streamed_and_recorded
workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("Sessions streamed and recorded")
- date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
+ date_time_style = workbook.number_format("d mmm yyyy h:mm")
styles = [
nil, date_time_style, nil, nil, nil, nil, nil
]
@@ -169,7 +169,7 @@ def scheduled_session_no_people
workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("Sched Sessions no Participants")
- date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
+ date_time_style = workbook.number_format("d mmm yyyy h:mm")
styles = [
nil, nil, date_time_style, nil
]
@@ -207,7 +207,7 @@ def session_with_no_moderator
workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("Sessions no Moderator")
- date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
+ date_time_style = workbook.number_format("d mmm yyyy h:mm")
styles = [
nil, nil, date_time_style, nil, nil, nil
]
@@ -421,7 +421,7 @@ def panels_with_too_few_people
workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("Panels with too Few People")
- date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
+ date_time_style = workbook.number_format("d mmm yyyy h:mm")
styles = [
nil, nil, date_time_style, nil, nil, nil, nil
]
@@ -467,7 +467,7 @@ def panels_with_too_many_people
workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("Panels with too Many People")
- date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
+ date_time_style = workbook.number_format("d mmm yyyy h:mm")
styles = [
nil, nil, date_time_style, nil, nil, nil
]
diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb
index 2d5c3cb07..7e37b1e03 100644
--- a/app/controllers/reports_controller.rb
+++ b/app/controllers/reports_controller.rb
@@ -8,7 +8,7 @@ def schedule_accpetance
workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("Approvals")
- date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
+ date_time_style = workbook.number_format("d mmm yyyy h:mm")
styles = [
nil, nil, nil, nil, nil,
nil, nil, date_time_style,
@@ -234,7 +234,7 @@ def schedule_by_room_then_time
'Assigned'
]
)
- date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
+ date_time_style = workbook.number_format("d mmm yyyy h:mm")
styles = [nil, nil, date_time_style, nil, nil, nil, nil]
moderator = SessionAssignmentRoleType.find_by(name: 'Moderator')
participant = SessionAssignmentRoleType.find_by(name: 'Participant')
@@ -322,7 +322,7 @@ def schedule_by_person
]
)
- date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
+ date_time_style = workbook.number_format("d mmm yyyy h:mm")
styles = [nil, nil, nil, nil, nil, date_time_style, nil, nil, nil]
people_sessions.each do |sa|
worksheet.append_row(
diff --git a/app/controllers/survey/submissions_controller.rb b/app/controllers/survey/submissions_controller.rb
index 413ef6648..ac77cc121 100644
--- a/app/controllers/survey/submissions_controller.rb
+++ b/app/controllers/survey/submissions_controller.rb
@@ -106,7 +106,7 @@ def index
def collection_to_xls
workbook = FastExcel.open(constant_memory: true) # creates tmp file
worksheet = workbook.add_worksheet("Export")
- date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
+ date_time_style = workbook.number_format("d mmm yyyy h:mm")
styles = [date_time_style,date_time_style]
# Get the survey questions
submission = @collection.first
From 2c2f8b2d39a32b37c8bebd04e81ed97ca50d75c1 Mon Sep 17 00:00:00 2001
From: Henry
Date: Fri, 12 Aug 2022 18:04:40 -0400
Subject: [PATCH 53/58] add space before mins
---
app/controllers/reports/program_ops_reports_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/reports/program_ops_reports_controller.rb b/app/controllers/reports/program_ops_reports_controller.rb
index 055ee14e3..738980a53 100644
--- a/app/controllers/reports/program_ops_reports_controller.rb
+++ b/app/controllers/reports/program_ops_reports_controller.rb
@@ -27,7 +27,7 @@ def back_of_badge
row.concat [
assignment.session.title,
assignment.session.start_time ? FastExcel.date_num(assignment.session.start_time, assignment.session.start_time.in_time_zone.utc_offset) : nil,
- assignment.session.duration + 'mins',
+ assignment.session.duration + ' mins',
assignment.session.room&.name,
]
styles.concat [
From 7ed8054039c94525daa72c0a56c4145c2efea508 Mon Sep 17 00:00:00 2001
From: Henry
Date: Fri, 12 Aug 2022 19:00:19 -0400
Subject: [PATCH 54/58] can not concat string to int
---
app/controllers/reports/program_ops_reports_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/reports/program_ops_reports_controller.rb b/app/controllers/reports/program_ops_reports_controller.rb
index 738980a53..628123236 100644
--- a/app/controllers/reports/program_ops_reports_controller.rb
+++ b/app/controllers/reports/program_ops_reports_controller.rb
@@ -27,7 +27,7 @@ def back_of_badge
row.concat [
assignment.session.title,
assignment.session.start_time ? FastExcel.date_num(assignment.session.start_time, assignment.session.start_time.in_time_zone.utc_offset) : nil,
- assignment.session.duration + ' mins',
+ "#{assignment.session.duration} mins",
assignment.session.room&.name,
]
styles.concat [
From 252b1511d3ccaba066b0521764a2564037d73435 Mon Sep 17 00:00:00 2001
From: dcterman <105614148+dcterman@users.noreply.github.com>
Date: Fri, 12 Aug 2022 19:47:53 -0400
Subject: [PATCH 55/58] Daily Grid report description update for duration
New field duration was added and needed to be added to descriptive text.
---
app/javascript/reports/reports_screen.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/javascript/reports/reports_screen.vue b/app/javascript/reports/reports_screen.vue
index 613746ac9..669d09a9d 100644
--- a/app/javascript/reports/reports_screen.vue
+++ b/app/javascript/reports/reports_screen.vue
@@ -186,7 +186,7 @@
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
+ Fields : Session title, area(s) of session, session format, session start time, session duration, session room
Session data included : all scheduled sessions that are visible and published
From 37ab9e1ce473c5b07d164ef96be2e38e5f87e044 Mon Sep 17 00:00:00 2001
From: Henry
Date: Sat, 13 Aug 2022 07:17:58 -0400
Subject: [PATCH 56/58] fix condition and ensure nothing is done during a reset
---
app/controllers/publication_dates_controller.rb | 11 +++++++++--
.../reports/schedule_reports_controller.rb | 5 +++--
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/app/controllers/publication_dates_controller.rb b/app/controllers/publication_dates_controller.rb
index d451c4ad1..971d4b442 100644
--- a/app/controllers/publication_dates_controller.rb
+++ b/app/controllers/publication_dates_controller.rb
@@ -6,13 +6,20 @@ class PublicationDatesController < ResourceController
DEFAULT_ORDER = 'desc'.freeze
def reset
+ # Make sure that people can not publish etc while we clean up
+ PublicationStatus.last.update(status: 'inprogress')
+
+ # Get rid of published data first
PublishedSession.destroy_all
+
+ # Then get rid of the audit
+ Audit::PublishedSessionVersion.delete_all
+
+ # Then remove caches, dates, and status
PublishSnapshot.delete_all
PublicationDate.delete_all
PublicationStatus.delete_all
- Audit::PublishedSessionVersion.delete_all
-
render status: :ok,
json: { message: 'publication reset' }.to_json,
content_type: 'application/json'
diff --git a/app/controllers/reports/schedule_reports_controller.rb b/app/controllers/reports/schedule_reports_controller.rb
index fc25453d1..2e6da7dc0 100644
--- a/app/controllers/reports/schedule_reports_controller.rb
+++ b/app/controllers/reports/schedule_reports_controller.rb
@@ -39,6 +39,7 @@ def schedule_diff
# Rails.logger.debug "******** CHANGES: #{changes[:sessions]}"
+ # test
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]
@@ -66,11 +67,11 @@ def schedule_diff
end
if change[:changes]['status']
- if change[:changes]['status'][1] == 'draft' || change[:changes]['status'][1] == 'dropped'
+ if (change[:changes]['status'][1] == 'draft' || change[:changes]['status'][1] == 'dropped') && change[:object].start_time && change[:object].room_id
# Rails.logger.debug "******** removed because draft"
session_removed_row(session_removed, change)
next
- elsif change[:changes]['status'][0] == 'draft' || change[:changes]['status'][0] == 'dropped'
+ elsif (change[:changes]['status'][0] == 'draft' || change[:changes]['status'][0] == 'dropped') && change[:object].start_time && change[:object].room_id
# Rails.logger.debug "******** added because state change"
session_added_row(session_added, change, date_time_style)
next
From 29bb9cbfde160f5ca7055808b7669c373ffbd355 Mon Sep 17 00:00:00 2001
From: Henry
Date: Sat, 13 Aug 2022 10:13:41 -0400
Subject: [PATCH 57/58] adjust diff logic
---
.../reports/schedule_reports_controller.rb | 104 ++++++++++++------
1 file changed, 70 insertions(+), 34 deletions(-)
diff --git a/app/controllers/reports/schedule_reports_controller.rb b/app/controllers/reports/schedule_reports_controller.rb
index 2e6da7dc0..c47833857 100644
--- a/app/controllers/reports/schedule_reports_controller.rb
+++ b/app/controllers/reports/schedule_reports_controller.rb
@@ -13,11 +13,13 @@ def schedule_diff
pd_to = PublicationDate.find params[:to] if params[:to]
to = pd_to.timestamp if pd_to
+ live = false
# changes = ChangeService.published_changes(from: from, to: to)
changes = if to
ChangeService.published_changes(from: from, to: to)
else
+ live = true
ChangeService.session_changes(from: from)
end
@@ -37,11 +39,11 @@ 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]}"
+ Rails.logger.debug "******** CHANGES: #{changes[:sessions]}"
# test
changes[:sessions].values.sort{|a,b| (a[:object] ? a[:object].title : '') <=> (b[:object] ? b[:object].title : '')}.each do |change|
- # Rails.logger.debug "******** CHANGE: #{change}"
+ Rails.logger.debug "******** CHANGE: #{change}"
next unless change[:object]
if change[:changes]['room_id'] || change[:changes]['start_time']
@@ -49,11 +51,13 @@ def schedule_diff
((!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)
+ live_add(session: change[:object], sheet: participants_add_drop) if live
next
else
if (change[:changes]['room_id'] && !change[:changes]['room_id'][1]) || (change[:changes]['start_time'] && !change[:changes]['start_time'][1])|| change[:event] == 'destroy'
# Rails.logger.debug "******** removed because room or time"
session_removed_row(session_removed, change)
+ live_drop(session: change[:object], sheet: participants_add_drop) if live
next
else
if change[:changes]['room_id']
@@ -66,26 +70,31 @@ def schedule_diff
end
end
- if change[:changes]['status']
- if (change[:changes]['status'][1] == 'draft' || change[:changes]['status'][1] == 'dropped') && change[:object].start_time && change[:object].room_id
- # Rails.logger.debug "******** removed because draft"
- session_removed_row(session_removed, change)
- next
- elsif (change[:changes]['status'][0] == 'draft' || change[:changes]['status'][0] == 'dropped') && change[:object].start_time && change[:object].room_id
- # Rails.logger.debug "******** added because state change"
- session_added_row(session_added, change, date_time_style)
- next
+ if change[:object].start_time && change[:object].room_id
+ if change[:changes]['status']
+ if (change[:changes]['status'][1] == 'draft' || change[:changes]['status'][1] == 'dropped')
+ # Rails.logger.debug "******** removed because draft"
+ session_removed_row(session_removed, change)
+ live_drop(session: change[:object], sheet: participants_add_drop) if live
+ next
+ elsif (change[:changes]['status'][0] == 'draft' || change[:changes]['status'][0] == 'dropped')
+ # Rails.logger.debug "******** added because state change"
+ session_added_row(session_added, change, date_time_style)
+ live_add(session: change[:object], sheet: participants_add_drop) if live
+ next
+ 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)
+ 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
end
+ # Deal with the assignment changes
moderator = SessionAssignmentRoleType.find_by(name: 'Moderator')
participant = SessionAssignmentRoleType.find_by(name: 'Participant')
roles = [moderator.id, participant.id]
@@ -100,23 +109,25 @@ def schedule_diff
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(
- [
- session.title,
- '',
- change[:object].person.published_name
- ]
- )
- elsif (roles.include?(change[:changes]['session_assignment_role_type_id'][0]))
- participants_add_drop.append_row(
- [
- session.title,
- change[:object].person.published_name,
- ]
- )
- if change[:object].person.sessions.scheduled.count == 0
- fully_dropped.append [change[:object].person.published_name]
+ if session.start_time && session.room_id
+ if (roles.include?(change[:changes]['session_assignment_role_type_id'][1]))
+ participants_add_drop.append_row(
+ [
+ session.title,
+ '',
+ change[:object].person.published_name
+ ]
+ )
+ elsif (roles.include?(change[:changes]['session_assignment_role_type_id'][0]))
+ participants_add_drop.append_row(
+ [
+ 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
@@ -143,6 +154,29 @@ def tab_headers(session_time_changed, session_room_changed, session_title_change
participants_fully_dropped.append_row(['Participant Dropped'])
end
+ def live_add(session:, sheet:)
+ session.participant_assignments.each do |sa|
+ sheet.append_row(
+ [
+ session.title,
+ '',
+ sa.person.published_name,
+ ]
+ )
+ end
+ end
+
+ def live_drop(session:, sheet:)
+ session.participant_assignments.each do |sa|
+ sheet.append_row(
+ [
+ session.title,
+ sa.person.published_name,
+ ]
+ )
+ end
+ end
+
def session_description_change_row(sheet, change)
sheet.append_row(
[
@@ -204,6 +238,8 @@ def session_added_row(sheet, change, date_time_style)
moderator = SessionAssignmentRoleType.find_by(name: 'Moderator')
participant = SessionAssignmentRoleType.find_by(name: 'Participant')
+ # If this is Session and it is added then so are the people
+
sheet.append_row(
[
change[:object].title,
From b4f8f4903367f0b7115c25e00e081e2913816680 Mon Sep 17 00:00:00 2001
From: Henry
Date: Sun, 14 Aug 2022 11:06:10 -0400
Subject: [PATCH 58/58] plan-705, plan-706 fix diff report issues
---
.../reports/schedule_reports_controller.rb | 49 ++++++++++++++-----
1 file changed, 37 insertions(+), 12 deletions(-)
diff --git a/app/controllers/reports/schedule_reports_controller.rb b/app/controllers/reports/schedule_reports_controller.rb
index c47833857..a3811d346 100644
--- a/app/controllers/reports/schedule_reports_controller.rb
+++ b/app/controllers/reports/schedule_reports_controller.rb
@@ -39,11 +39,11 @@ 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]}"
+ # Rails.logger.debug "******** CHANGES: #{changes[:sessions]}"
- # test
+ state_change_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}"
+ # Rails.logger.debug "******** CHANGE: #{change}"
next unless change[:object]
if change[:changes]['room_id'] || change[:changes]['start_time']
@@ -75,12 +75,18 @@ def schedule_diff
if (change[:changes]['status'][1] == 'draft' || change[:changes]['status'][1] == 'dropped')
# Rails.logger.debug "******** removed because draft"
session_removed_row(session_removed, change)
- live_drop(session: change[:object], sheet: participants_add_drop) if live
+ if live
+ live_drop(session: change[:object], sheet: participants_add_drop)
+ state_change_sessions << change[:object].id
+ end
next
elsif (change[:changes]['status'][0] == 'draft' || change[:changes]['status'][0] == 'dropped')
# Rails.logger.debug "******** added because state change"
session_added_row(session_added, change, date_time_style)
- live_add(session: change[:object], sheet: participants_add_drop) if live
+ if live
+ live_add(session: change[:object], sheet: participants_add_drop)
+ state_change_sessions << change[:object].id
+ end
next
end
end
@@ -103,33 +109,52 @@ def schedule_diff
# TODO: sort .... ??? how
fully_dropped = []
changes[:assignments].each do |id, change|
- next unless change[:object]
+ # next unless change[:object]
+ changed_assignment = change[:object]
+ changed_assignment ||= SessionAssignment.find change[:session_assignment_id]
+ next if state_change_sessions.include? change[:object].session_id
+
+ session = changed_assignment.session if changed_assignment.session
+ session ||= Session.find changed_assignment.session_id
+
+ # Rails.logger.debug "******** Assignment changes #{change}"
# 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 change[:changes]['session_assignment_role_type_id'] && change[:event] != 'destroy'
if session.start_time && session.room_id
if (roles.include?(change[:changes]['session_assignment_role_type_id'][1]))
participants_add_drop.append_row(
[
session.title,
'',
- change[:object].person.published_name
+ changed_assignment.person.published_name
]
)
elsif (roles.include?(change[:changes]['session_assignment_role_type_id'][0]))
participants_add_drop.append_row(
[
session.title,
- change[:object].person.published_name,
+ changed_assignment.person.published_name,
]
)
- if change[:object].person.sessions.scheduled.count == 0
+ if changed_assignment.person.sessions.scheduled.count == 0
fully_dropped.append [change[:object].person.published_name]
end
end
end
+ else
+ # Rails.logger.debug "******** Assignment EVENT DROP ????"
+ if change[:event] == 'destroy'
+ participants_add_drop.append_row(
+ [
+ session.title,
+ changed_assignment.person.published_name,
+ ]
+ )
+ if changed_assignment.person.sessions.scheduled.count == 0
+ fully_dropped.append [changed_assignment.person.published_name]
+ end
+ end
end
end