From aebf50ab61f35b8151f76c7a0112d97c56ddb1db Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 11 Aug 2022 09:32:40 -0400 Subject: [PATCH 01/50] participant social media report --- .../reports/people_reports_controller.rb | 46 +++++++++++++++++++ app/javascript/reports/reports_screen.vue | 3 ++ app/policies/report_policy.rb | 4 ++ config/routes.rb | 3 +- lib/tasks/rbac.rake | 6 ++- 5 files changed, 59 insertions(+), 3 deletions(-) diff --git a/app/controllers/reports/people_reports_controller.rb b/app/controllers/reports/people_reports_controller.rb index ab647654c..d25872f8b 100644 --- a/app/controllers/reports/people_reports_controller.rb +++ b/app/controllers/reports/people_reports_controller.rb @@ -1,6 +1,52 @@ class Reports::PeopleReportsController < ApplicationController around_action :set_timezone + def social_media + authorize Person, policy_class: ReportPolicy + + people = SessionService.live_people + + workbook = FastExcel.open(constant_memory: true) + worksheet = workbook.add_worksheet("Participant and Social Media") + + worksheet.append_row( + [ + 'Published Name', + 'Attendance Type', + 'Participant Status', + 'Bio', + 'Social Media' + ] + ) + + people.each do |person| + social = [] + social << "Twitter: https://twitter.com/#{person.twitter}" unless person.twitter.blank? + social << "Facebook: https://facebook.com/#{person.facebook}" unless person.facebook.blank? + social << "Website: #{person.website}" unless person.website.blank? + social << "Instagram: https://instagram.com/#{person.instagram}" unless person.instagram.blank? + social << "Twitch: https://twitch.tv/#{person.twitch}" unless person.twitch.blank? + social << "Youtube: https://youtube.com/#{person.youtube}" unless person.youtube.blank? + social << "TikTok: https://www.tiktok.com/@#{person.tiktok}" unless person.tiktok.blank? + social << "LinkedIn: https://linkedin.com/in/#{person.linkedin}" unless person.linkedin.blank? + social << "Other Social Media: #{person.othersocialmedia}" unless person.othersocialmedia.blank? + + worksheet.append_row( + [ + person.published_name, + person.attendance_type, + person.con_state, + person.bio, + social.join(",\n") + ] + ) + end + + send_data workbook.read_string, + filename: "ParticipantsSocialMedia-#{Time.now.strftime('%m-%d-%Y')}.xlsx", + disposition: 'attachment' + end + def moderators authorize Person, policy_class: ReportPolicy diff --git a/app/javascript/reports/reports_screen.vue b/app/javascript/reports/reports_screen.vue index 77eda70bb..6c71931d2 100644 --- a/app/javascript/reports/reports_screen.vue +++ b/app/javascript/reports/reports_screen.vue @@ -101,6 +101,9 @@
  • Participants Moderating at least one session
  • +
  • + Participants and Social Media +
  • Sessions
    diff --git a/app/policies/report_policy.rb b/app/policies/report_policy.rb index c7b52062f..cf4fe218f 100644 --- a/app/policies/report_policy.rb +++ b/app/policies/report_policy.rb @@ -1,5 +1,9 @@ class ReportPolicy < BasePolicy + def social_media? + allowed?(action: :social_media) + end + def moderators? allowed?(action: :moderators) end diff --git a/config/routes.rb b/config/routes.rb index 6c2e038f8..c68e68a17 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -70,7 +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/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' @@ -87,6 +87,7 @@ get 'report/people_reports/record_stream_permissions', to: 'reports/people_reports#record_stream_permissions' get 'report/people_reports/moderators', to: 'reports/people_reports#moderators' + get 'report/people_reports/social_media', to: 'reports/people_reports#social_media' get 'report/schedule_reports/schedule_diff(/:from)(/:to)', to: 'reports/schedule_reports#schedule_diff' resources :publication_dates, path: 'publication_date', only: [:index] diff --git a/lib/tasks/rbac.rake b/lib/tasks/rbac.rake index 637dfe2f0..6857653cb 100644 --- a/lib/tasks/rbac.rake +++ b/lib/tasks/rbac.rake @@ -528,7 +528,8 @@ namespace :rbac do "session_selections": true, "sessions_with_participants": true, "record_stream_permissions": true, - "moderators": true + "moderators": true, + "social_media": true }, "session_report": { "panels_with_too_few_people": true, @@ -832,7 +833,8 @@ namespace :rbac do "session_selections": true, "sessions_with_participants": true, "record_stream_permissions": true, - "moderators": true + "moderators": true, + "social_media": true }, "session_report": { "panels_with_too_few_people": true, From 7dae493a8c1073cbc79efd9a6eef2418c6125451 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 11 Aug 2022 09:58:49 -0400 Subject: [PATCH 02/50] plan=658 session needs report --- .../reports/session_reports_controller.rb | 50 +++++++++++++++++++ app/javascript/reports/reports_screen.vue | 3 ++ app/policies/reports/session_report_policy.rb | 4 ++ config/routes.rb | 1 + lib/tasks/rbac.rake | 6 ++- 5 files changed, 62 insertions(+), 2 deletions(-) diff --git a/app/controllers/reports/session_reports_controller.rb b/app/controllers/reports/session_reports_controller.rb index 9d35c3a2b..267159655 100644 --- a/app/controllers/reports/session_reports_controller.rb +++ b/app/controllers/reports/session_reports_controller.rb @@ -1,6 +1,56 @@ class Reports::SessionReportsController < ApplicationController around_action :set_timezone + def session_needs + authorize SessionAssignment, policy_class: Reports::SessionReportPolicy + + sessions = SessionService.live_sessions + + workbook = FastExcel.open(constant_memory: true) + worksheet = workbook.add_worksheet("Session Needs") + date_time_style = workbook.number_format("d mmm yyyy h:mm") + styles = [ + nil, date_time_style + ] + + worksheet.append_row( + [ + 'Session', + 'Time', + 'Room', + 'Environment', + 'Format', + 'Areas', + 'Required Room Features/Services', #room_notes + 'Tech/Hotel Notes', # + 'Room Setup' # room_set_id + ] + ) + + # require room features.services, tech/hotel notes, room setup + + sessions.each do |session| + worksheet.append_row( + [ + session.title, + session.start_time ? FastExcel.date_num(session.start_time, session.start_time.in_time_zone.utc_offset) : nil, + session.room&.name, + session.environment, + session.format&.name, + session.area_list.sort.join(';'), + session.room_notes, + session.tech_notes, + session.room_set&.name + ], + styles + ) + end + + send_data workbook.read_string, + filename: "SessionNeeds-#{Time.now.strftime('%m-%d-%Y')}.xlsx", + disposition: 'attachment' + end + def streamed_and_recorded authorize SessionAssignment, policy_class: Reports::SessionReportPolicy diff --git a/app/javascript/reports/reports_screen.vue b/app/javascript/reports/reports_screen.vue index be6fff17a..fba5cac95 100644 --- a/app/javascript/reports/reports_screen.vue +++ b/app/javascript/reports/reports_screen.vue @@ -303,6 +303,9 @@
  • Back of Badge
  • +
  • + Session Needs +
  • diff --git a/app/policies/reports/session_report_policy.rb b/app/policies/reports/session_report_policy.rb index 5ee2cf480..f86a96c91 100644 --- a/app/policies/reports/session_report_policy.rb +++ b/app/policies/reports/session_report_policy.rb @@ -46,4 +46,8 @@ def daily_grid? def streamed_and_recorded? allowed?(action: :streamed_and_recorded) end + + def session_needs? + allowed?(action: :session_needs) + end end diff --git a/config/routes.rb b/config/routes.rb index 15f70ee48..c8f12d072 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -72,6 +72,7 @@ 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/streamed_and_recorded', to: 'reports/session_reports#streamed_and_recorded' + get 'report/session_reports/session_needs', to: 'reports/session_reports#session_needs' 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 cd0a0811e..e475350a2 100644 --- a/lib/tasks/rbac.rake +++ b/lib/tasks/rbac.rake @@ -542,7 +542,8 @@ namespace :rbac do "assigned_sessions_not_scheduled": true, "session_copy_edit_status": true, "daily_grid": true, - "streamed_and_recorded": true + "streamed_and_recorded": true, + "session_needs": true }, "schedule_report": { "schedule_diff": true @@ -850,7 +851,8 @@ namespace :rbac do "assigned_sessions_not_scheduled": true, "session_copy_edit_status": true, "daily_grid": true, - "streamed_and_recorded": true + "streamed_and_recorded": true, + "session_needs": true }, "conflict_report": { "people_outside_availability": true, From d3c7495da11983038576284cee2510142802848d Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 11 Aug 2022 11:07:38 -0400 Subject: [PATCH 03/50] PLAN-661 mismatch report --- .../reports/people_reports_controller.rb | 57 +++++++++++++++++++ app/javascript/reports/reports_screen.vue | 3 + config/routes.rb | 1 + 3 files changed, 61 insertions(+) diff --git a/app/controllers/reports/people_reports_controller.rb b/app/controllers/reports/people_reports_controller.rb index ab647654c..d719a6103 100644 --- a/app/controllers/reports/people_reports_controller.rb +++ b/app/controllers/reports/people_reports_controller.rb @@ -1,6 +1,63 @@ class Reports::PeopleReportsController < ApplicationController around_action :set_timezone + def mis_matched_envs + # authorize Person, policy_class: ReportPolicy + + results = PersonSchedule + .joins(:person) + .where( + %q(case + when (person_schedules.environment = 'in_person') then (people.attendance_type != 'in person' and people.attendance_type != 'hybrid') + when (person_schedules.environment = 'hybrid') then (people.attendance_type != 'in person' and people.attendance_type != 'hybrid') + when (person_schedules.environment = 'virtual') then (people.attendance_type != 'virtual' and people.attendance_type != 'hybrid') + end + ) + ) + .order("published_name asc, start_time asc") + + # Sessions: only scheduled sessions, + # only when virtual people are on in-person or hybrid sessions, or in-person people are on virtual sessions + workbook = FastExcel.open(constant_memory: true) + worksheet = workbook.add_worksheet("Mis Matched Envs") + date_time_style = workbook.number_format("d mmm yyyy h:mm") + + worksheet.append_row( + [ + 'Published Name', + 'Primary Email', + 'Attendance Type', + 'Participant Status', + 'Session Title', + 'Room', + 'Time', + 'Session Environment' + ] + ) + + styles = [nil, nil, nil, nil, nil, nil, date_time_style, nil] + + results.each do |result| + worksheet.append_row( + [ + result.published_name, + result.person.primary_email&.email, + result.person.attendance_type, + result.person.con_state, + result.title, + result.room&.name, + result.session.start_time ? FastExcel.date_num(result.session.start_time, result.session.start_time.in_time_zone.utc_offset) : nil, + result.environment + ], + styles + ) + end + + send_data workbook.read_string, + filename: "PeopleOnMismatchedSessions-#{Time.now.strftime('%m-%d-%Y')}.xlsx", + disposition: 'attachment' + end + def moderators authorize Person, policy_class: ReportPolicy diff --git a/app/javascript/reports/reports_screen.vue b/app/javascript/reports/reports_screen.vue index be6fff17a..086e9af80 100644 --- a/app/javascript/reports/reports_screen.vue +++ b/app/javascript/reports/reports_screen.vue @@ -108,6 +108,9 @@ Person data included: moderators

    +
  • + Participants with Mis-Matching Sessions +
  • Sessions
    diff --git a/config/routes.rb b/config/routes.rb index 15f70ee48..404b35a43 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -88,6 +88,7 @@ get 'report/people_reports/record_stream_permissions', to: 'reports/people_reports#record_stream_permissions' get 'report/people_reports/moderators', to: 'reports/people_reports#moderators' + get 'report/people_reports/mis_matched_envs', to: 'reports/people_reports#mis_matched_envs' get 'report/program_ops_reports/back_of_badge', to: 'reports/program_ops_reports#back_of_badge' From 134e0ccb970a9e49e894bd12c20e4e088d2e6556 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 11 Aug 2022 11:09:14 -0400 Subject: [PATCH 04/50] PLAN-661 mis-matched people --- app/controllers/reports/people_reports_controller.rb | 2 +- app/policies/report_policy.rb | 4 ++++ lib/tasks/rbac.rake | 6 ++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/controllers/reports/people_reports_controller.rb b/app/controllers/reports/people_reports_controller.rb index d719a6103..585066c68 100644 --- a/app/controllers/reports/people_reports_controller.rb +++ b/app/controllers/reports/people_reports_controller.rb @@ -2,7 +2,7 @@ class Reports::PeopleReportsController < ApplicationController around_action :set_timezone def mis_matched_envs - # authorize Person, policy_class: ReportPolicy + authorize Person, policy_class: ReportPolicy results = PersonSchedule .joins(:person) diff --git a/app/policies/report_policy.rb b/app/policies/report_policy.rb index c7b52062f..cf399839d 100644 --- a/app/policies/report_policy.rb +++ b/app/policies/report_policy.rb @@ -1,5 +1,9 @@ class ReportPolicy < BasePolicy + def mis_matched_envs? + allowed?(action: :mis_matched_envs) + end + def moderators? allowed?(action: :moderators) end diff --git a/lib/tasks/rbac.rake b/lib/tasks/rbac.rake index cd0a0811e..20ce9eb22 100644 --- a/lib/tasks/rbac.rake +++ b/lib/tasks/rbac.rake @@ -528,7 +528,8 @@ namespace :rbac do "session_selections": true, "sessions_with_participants": true, "record_stream_permissions": true, - "moderators": true + "moderators": true, + "mis_matched_envs": true }, "session_report": { "panels_with_too_few_people": true, @@ -836,7 +837,8 @@ namespace :rbac do "session_selections": true, "sessions_with_participants": true, "record_stream_permissions": true, - "moderators": true + "moderators": true, + "mis_matched_envs": true }, "session_report": { "panels_with_too_few_people": true, From ce6efeaef028541dd4cb51565e923c317c39dda2 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 11 Aug 2022 11:51:47 -0400 Subject: [PATCH 05/50] plan-664 table tents --- .../reports/program_ops_reports_controller.rb | 39 +++++++++++++++++++ app/javascript/reports/reports_screen.vue | 5 +++ app/models/published_session.rb | 2 +- app/models/session.rb | 2 +- .../reports/program_ops_report_policy.rb | 4 ++ app/services/session_service.rb | 2 +- config/routes.rb | 1 + lib/tasks/rbac.rake | 6 ++- 8 files changed, 56 insertions(+), 5 deletions(-) diff --git a/app/controllers/reports/program_ops_reports_controller.rb b/app/controllers/reports/program_ops_reports_controller.rb index 92e6e8cfe..4a0ac8e86 100644 --- a/app/controllers/reports/program_ops_reports_controller.rb +++ b/app/controllers/reports/program_ops_reports_controller.rb @@ -1,6 +1,45 @@ class Reports::ProgramOpsReportsController < ApplicationController around_action :set_timezone + def table_tents + authorize SessionAssignment, policy_class: Reports::ProgramOpsReportPolicy + + sessions = SessionService.published_sessions + moderator = SessionAssignmentRoleType.find_by(name: 'Moderator') + participant = SessionAssignmentRoleType.find_by(name: 'Participant') + + workbook = FastExcel.open #(constant_memory: true) + worksheet = workbook.add_worksheet("Table Tents") + + worksheet.append_row( + [ + 'Session', + 'Published Name', + 'Description', + 'Participant Notes', + 'Moderators', + 'Participants' + ] + ) + + sessions.each do |session| + session.published_session_assignments.each do |pa| + worksheet.append_row [ + session.title, + pa.person.published_name, + session.description, + session.participant_notes, + session.published_session_assignments.role(moderator).collect{|p| "#{p.person.published_name} (#{p.person.pronouns})" }.join(",\n"), + session.published_session_assignments.role(participant).collect{|p| "#{p.person.published_name} (#{p.person.pronouns})" }.join(",\n") + ] + end + end + + send_data workbook.read_string, + filename: "TableTents-#{Time.now.strftime('%m-%d-%Y')}.xlsx", + disposition: 'attachment' + end + def back_of_badge authorize SessionAssignment, policy_class: Reports::ProgramOpsReportPolicy diff --git a/app/javascript/reports/reports_screen.vue b/app/javascript/reports/reports_screen.vue index be6fff17a..e81142309 100644 --- a/app/javascript/reports/reports_screen.vue +++ b/app/javascript/reports/reports_screen.vue @@ -304,6 +304,11 @@ Back of Badge + diff --git a/app/models/published_session.rb b/app/models/published_session.rb index 1b9d81cc7..499c27190 100644 --- a/app/models/published_session.rb +++ b/app/models/published_session.rb @@ -44,7 +44,7 @@ def roles(role_ids) .order("sart.sort_order, people.published_name asc") }, class_name: 'PublishedSessionAssignment' - has_many :participants, through: :participant_assignments, source: :person, class_name: 'Person' + # has_many :participants, through: :participant_assignments, source: :person, class_name: 'Person' enum visibility: { is_public: 'public', diff --git a/app/models/session.rb b/app/models/session.rb index 9ad5febb1..56ce98b07 100644 --- a/app/models/session.rb +++ b/app/models/session.rb @@ -88,7 +88,7 @@ def interests_for(person_id) .order("sart.sort_order, people.published_name asc") }, class_name: 'SessionAssignment' - has_many :participants, through: :participant_assignments, source: :person, class_name: 'Person' + # has_many :participants, through: :participant_assignments #, source: :person, class_name: 'Person' # TODO: Will also need a published versioon of the relationship has_many :session_areas, inverse_of: :session diff --git a/app/policies/reports/program_ops_report_policy.rb b/app/policies/reports/program_ops_report_policy.rb index d573b7655..aa8ec6482 100644 --- a/app/policies/reports/program_ops_report_policy.rb +++ b/app/policies/reports/program_ops_report_policy.rb @@ -2,4 +2,8 @@ class Reports::ProgramOpsReportPolicy < BasePolicy def back_of_badge? allowed?(action: :back_of_badge) end + + def table_tents? + allowed?(action: :table_tents) + end end diff --git a/app/services/session_service.rb b/app/services/session_service.rb index 88a798b49..ac0a62866 100644 --- a/app/services/session_service.rb +++ b/app/services/session_service.rb @@ -121,7 +121,7 @@ def self.published_people participant = SessionAssignmentRoleType.find_by(name: 'Participant') people = Person.includes( - {published_session_assignments: [:published_session, :session_assignment_role_type]} + {published_session_assignments: [:published_session, :session_assignment_role_type, :person]} ).references( {published_session_assignments: :published_session} ) diff --git a/config/routes.rb b/config/routes.rb index 15f70ee48..ab44bf30d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -90,6 +90,7 @@ get 'report/people_reports/moderators', to: 'reports/people_reports#moderators' get 'report/program_ops_reports/back_of_badge', to: 'reports/program_ops_reports#back_of_badge' + get 'report/program_ops_reports/table_tents', to: 'reports/program_ops_reports#table_tents' get 'report/schedule_reports/schedule_diff(/:from)(/:to)', to: 'reports/schedule_reports#schedule_diff' resources :publication_dates, path: 'publication_date', only: [:index] diff --git a/lib/tasks/rbac.rake b/lib/tasks/rbac.rake index cd0a0811e..f7527a737 100644 --- a/lib/tasks/rbac.rake +++ b/lib/tasks/rbac.rake @@ -548,7 +548,8 @@ namespace :rbac do "schedule_diff": true }, "program_ops_report": { - "back_of_badge": true + "back_of_badge": true, + "table_tents": true }, "conflict_report": { "people_outside_availability": true, @@ -866,7 +867,8 @@ namespace :rbac do "schedule_diff": true }, "program_ops_report": { - "back_of_badge": true + "back_of_badge": true, + "table_tents": true }, "session_conflict": { "conflicts_with": true, From bca2f03b43a2ceda0eec5a700c38c1d5ecce56c6 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 11 Aug 2022 12:35:36 -0400 Subject: [PATCH 06/50] ops session signup report --- .../reports/program_ops_reports_controller.rb | 47 +++++++++++++++++++ app/javascript/reports/reports_screen.vue | 3 ++ .../reports/program_ops_report_policy.rb | 4 ++ config/routes.rb | 1 + lib/tasks/rbac.rake | 6 ++- 5 files changed, 59 insertions(+), 2 deletions(-) diff --git a/app/controllers/reports/program_ops_reports_controller.rb b/app/controllers/reports/program_ops_reports_controller.rb index 92e6e8cfe..fc70ec286 100644 --- a/app/controllers/reports/program_ops_reports_controller.rb +++ b/app/controllers/reports/program_ops_reports_controller.rb @@ -1,6 +1,53 @@ class Reports::ProgramOpsReportsController < ApplicationController around_action :set_timezone + def sign_up_sessions + authorize SessionAssignment, policy_class: Reports::ProgramOpsReportPolicy + + sessions = SessionService.live_sessions.where('require_signup = true') + + workbook = FastExcel.open #(constant_memory: true) + worksheet = workbook.add_worksheet("Sessions requiring Signups") + date_time_style = workbook.number_format("d mmm yyyy h:mm") + + styles = [nil, nil, nil, date_time_style ] + + worksheet.append_row( + [ + 'Session', + 'Description', + 'Room', + 'Time', + 'Duration', + 'Format', + 'Participants', + 'Environment', + 'Max Signups' + ] + ) + + sessions.each do |session| + worksheet.append_row( + [ + session.title, + session.description, + session.room&.name, + session.start_time ? FastExcel.date_num(session.start_time, session.start_time.in_time_zone.utc_offset) : nil, + session.duration, + session.format&.name, + session.participant_assignments.collect{|pa| pa.person.published_name}.join(";\n"), + session.environment, + session.audience_size + ], + styles + ) + end + + send_data workbook.read_string, + filename: "SessionRequoringSignup-#{Time.now.strftime('%m-%d-%Y')}.xlsx", + disposition: 'attachment' + end + def back_of_badge authorize SessionAssignment, policy_class: Reports::ProgramOpsReportPolicy diff --git a/app/javascript/reports/reports_screen.vue b/app/javascript/reports/reports_screen.vue index be6fff17a..5478d2f89 100644 --- a/app/javascript/reports/reports_screen.vue +++ b/app/javascript/reports/reports_screen.vue @@ -303,6 +303,9 @@
  • Back of Badge
  • +
  • + Sessions Requiring Signup +
  • diff --git a/app/policies/reports/program_ops_report_policy.rb b/app/policies/reports/program_ops_report_policy.rb index d573b7655..f70f79c7e 100644 --- a/app/policies/reports/program_ops_report_policy.rb +++ b/app/policies/reports/program_ops_report_policy.rb @@ -2,4 +2,8 @@ class Reports::ProgramOpsReportPolicy < BasePolicy def back_of_badge? allowed?(action: :back_of_badge) end + + def sign_up_sessions? + allowed?(action: :sign_up_sessions) + end end diff --git a/config/routes.rb b/config/routes.rb index 15f70ee48..d49471d59 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -90,6 +90,7 @@ get 'report/people_reports/moderators', to: 'reports/people_reports#moderators' get 'report/program_ops_reports/back_of_badge', to: 'reports/program_ops_reports#back_of_badge' + get 'report/program_ops_reports/sign_up_sessions', to: 'reports/program_ops_reports#sign_up_sessions' get 'report/schedule_reports/schedule_diff(/:from)(/:to)', to: 'reports/schedule_reports#schedule_diff' resources :publication_dates, path: 'publication_date', only: [:index] diff --git a/lib/tasks/rbac.rake b/lib/tasks/rbac.rake index cd0a0811e..af4000169 100644 --- a/lib/tasks/rbac.rake +++ b/lib/tasks/rbac.rake @@ -548,7 +548,8 @@ namespace :rbac do "schedule_diff": true }, "program_ops_report": { - "back_of_badge": true + "back_of_badge": true, + "sign_up_sessions": true }, "conflict_report": { "people_outside_availability": true, @@ -866,7 +867,8 @@ namespace :rbac do "schedule_diff": true }, "program_ops_report": { - "back_of_badge": true + "back_of_badge": true, + "sign_up_sessions": true }, "session_conflict": { "conflicts_with": true, From f1d5be5f2e2f3039898cecab4fc53c50939862f1 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 11 Aug 2022 13:00:07 -0400 Subject: [PATCH 07/50] WIP --- .../reports/program_ops_reports_controller.rb | 17 +++++++++++++++++ app/services/session_service.rb | 7 +++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/controllers/reports/program_ops_reports_controller.rb b/app/controllers/reports/program_ops_reports_controller.rb index 92e6e8cfe..902bbd511 100644 --- a/app/controllers/reports/program_ops_reports_controller.rb +++ b/app/controllers/reports/program_ops_reports_controller.rb @@ -1,6 +1,23 @@ class Reports::ProgramOpsReportsController < ApplicationController around_action :set_timezone + def room_signs + authorize SessionAssignment, policy_class: Reports::ProgramOpsReportPolicy + + workbook = FastExcel.open(constant_memory: true) + worksheet = workbook.add_worksheet("Room Signs") + date_time_style = workbook.number_format("d mmm yyyy h:mm") + + # Need by room and time + sessions = SessionService + .published_sessions_unordered + .order("rooms.name asc, start_time asc") + + # Room name, Day of week, sessions (title, start time, description, participant list with moderator marker). + sessions.each do |session| + end + end + def back_of_badge authorize SessionAssignment, policy_class: Reports::ProgramOpsReportPolicy diff --git a/app/services/session_service.rb b/app/services/session_service.rb index 88a798b49..b7372702f 100644 --- a/app/services/session_service.rb +++ b/app/services/session_service.rb @@ -94,14 +94,17 @@ def self.scheduled_people end end - def self.published_sessions + def self.published_sessions_unordered PublishedSession.select( ::PublishedSession.arel_table[Arel.star], 'areas_list.area_list' ) .includes(:format, :room, {participant_assignments: :person}) .joins(self.area_subquery(clazz: PublishedSession)) - .order(:start_time) + end + + def self.published_sessions + self.published_sessions_unordered.order(:start_time) end def self.live_sessions From 78023be0cfb2d6e90fec70ceb50cde2330ff17e8 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 11 Aug 2022 14:00:50 -0400 Subject: [PATCH 08/50] ensure draft sessions are used in social media report --- .../reports/people_reports_controller.rb | 2 +- app/services/session_service.rb | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/controllers/reports/people_reports_controller.rb b/app/controllers/reports/people_reports_controller.rb index 210dec0af..bb47e71f8 100644 --- a/app/controllers/reports/people_reports_controller.rb +++ b/app/controllers/reports/people_reports_controller.rb @@ -4,7 +4,7 @@ class Reports::PeopleReportsController < ApplicationController def social_media authorize Person, policy_class: ReportPolicy - people = SessionService.live_people + people = SessionService.draft_people workbook = FastExcel.open(constant_memory: true) worksheet = workbook.add_worksheet("Participant and Social Media") diff --git a/app/services/session_service.rb b/app/services/session_service.rb index 5951878e7..b80781e1e 100644 --- a/app/services/session_service.rb +++ b/app/services/session_service.rb @@ -159,6 +159,22 @@ def self.live_people .order("people.published_name") end + def self.draft_people + moderator = SessionAssignmentRoleType.find_by(name: 'Moderator') + participant = SessionAssignmentRoleType.find_by(name: 'Participant') + + 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, participant.id]) + .where("sessions.start_time is not null and sessions.room_id is not null") + .where("sessions.status != 'dropped'") + .where("people.con_state not in (?)", ['declined', 'rejected']) #.distinct + .order("people.published_name") + end + def self.draft_moderators moderator = SessionAssignmentRoleType.find_by(name: 'Moderator') From eb6b0815ce02a0a0f90b69f9780688ecead91787 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 11 Aug 2022 14:02:12 -0400 Subject: [PATCH 09/50] ensure draft sessions are included --- app/controllers/reports/session_reports_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/reports/session_reports_controller.rb b/app/controllers/reports/session_reports_controller.rb index aff343d8f..f36dd75fc 100644 --- a/app/controllers/reports/session_reports_controller.rb +++ b/app/controllers/reports/session_reports_controller.rb @@ -4,7 +4,7 @@ class Reports::SessionReportsController < ApplicationController def session_needs authorize SessionAssignment, policy_class: Reports::SessionReportPolicy - sessions = SessionService.live_sessions + sessions = SessionService.draft_sessions workbook = FastExcel.open(constant_memory: true) worksheet = workbook.add_worksheet("Session Needs") From dd87912a46201858c000e34e9de479a4d5044152 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 11 Aug 2022 14:05:14 -0400 Subject: [PATCH 10/50] include draft --- 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 fc70ec286..84d91f090 100644 --- a/app/controllers/reports/program_ops_reports_controller.rb +++ b/app/controllers/reports/program_ops_reports_controller.rb @@ -4,7 +4,7 @@ class Reports::ProgramOpsReportsController < ApplicationController def sign_up_sessions authorize SessionAssignment, policy_class: Reports::ProgramOpsReportPolicy - sessions = SessionService.live_sessions.where('require_signup = true') + sessions = SessionService.draft_sessions.where('require_signup = true') workbook = FastExcel.open #(constant_memory: true) worksheet = workbook.add_worksheet("Sessions requiring Signups") From 0c14c71e3bc8c263032aaeed6d7dafa48374a364 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 11 Aug 2022 14:12:11 -0400 Subject: [PATCH 11/50] WIP --- app/javascript/reports/reports_screen.vue | 6 +++++- app/policies/reports/program_ops_report_policy.rb | 4 ++++ config/routes.rb | 1 + lib/tasks/rbac.rake | 6 ++++-- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/javascript/reports/reports_screen.vue b/app/javascript/reports/reports_screen.vue index be6fff17a..93a368972 100644 --- a/app/javascript/reports/reports_screen.vue +++ b/app/javascript/reports/reports_screen.vue @@ -304,7 +304,11 @@ Back of Badge - + diff --git a/app/policies/reports/program_ops_report_policy.rb b/app/policies/reports/program_ops_report_policy.rb index d573b7655..09bc40978 100644 --- a/app/policies/reports/program_ops_report_policy.rb +++ b/app/policies/reports/program_ops_report_policy.rb @@ -2,4 +2,8 @@ class Reports::ProgramOpsReportPolicy < BasePolicy def back_of_badge? allowed?(action: :back_of_badge) end + + def room_signs? + allowed?(action: :room_signs) + end end diff --git a/config/routes.rb b/config/routes.rb index 15f70ee48..4ab1be625 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -90,6 +90,7 @@ get 'report/people_reports/moderators', to: 'reports/people_reports#moderators' get 'report/program_ops_reports/back_of_badge', to: 'reports/program_ops_reports#back_of_badge' + get 'report/program_ops_reports/room_signs', to: 'reports/program_ops_reports#room_signs' get 'report/schedule_reports/schedule_diff(/:from)(/:to)', to: 'reports/schedule_reports#schedule_diff' resources :publication_dates, path: 'publication_date', only: [:index] diff --git a/lib/tasks/rbac.rake b/lib/tasks/rbac.rake index cd0a0811e..58b2aedab 100644 --- a/lib/tasks/rbac.rake +++ b/lib/tasks/rbac.rake @@ -548,7 +548,8 @@ namespace :rbac do "schedule_diff": true }, "program_ops_report": { - "back_of_badge": true + "back_of_badge": true, + "room_signs": true }, "conflict_report": { "people_outside_availability": true, @@ -866,7 +867,8 @@ namespace :rbac do "schedule_diff": true }, "program_ops_report": { - "back_of_badge": true + "back_of_badge": true, + "room_signs": true }, "session_conflict": { "conflicts_with": true, From 313de8a7249c919e01cdb2cd41f808e1cf3ab948 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 11 Aug 2022 14:38:39 -0400 Subject: [PATCH 12/50] plan-666 room signs --- .../reports/program_ops_reports_controller.rb | 47 ++++++++++++++++--- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/app/controllers/reports/program_ops_reports_controller.rb b/app/controllers/reports/program_ops_reports_controller.rb index 902bbd511..fe00a2c90 100644 --- a/app/controllers/reports/program_ops_reports_controller.rb +++ b/app/controllers/reports/program_ops_reports_controller.rb @@ -4,18 +4,53 @@ class Reports::ProgramOpsReportsController < ApplicationController def room_signs authorize SessionAssignment, policy_class: Reports::ProgramOpsReportPolicy - workbook = FastExcel.open(constant_memory: true) - worksheet = workbook.add_worksheet("Room Signs") - date_time_style = workbook.number_format("d mmm yyyy h:mm") - # Need by room and time sessions = SessionService .published_sessions_unordered - .order("rooms.name asc, start_time asc") + # .order("rooms.name asc, start_time asc") # Room name, Day of week, sessions (title, start time, description, participant list with moderator marker). - sessions.each do |session| + grouped_sessions = sessions.group_by {|s| s.room} + moderator = SessionAssignmentRoleType.find_by(name: 'Moderator') + participant = SessionAssignmentRoleType.find_by(name: 'Participant') + + workbook = FastExcel.open(constant_memory: true) + worksheet = workbook.add_worksheet("Room Signs") + date_time_style = workbook.number_format("d mmm yyyy h:mm") + styles = [nil, nil, nil, date_time_style] + + worksheet.append_row( + [ + 'Room', + 'Day', + 'Session', + 'Time', + 'Description', + 'Moderators', + 'Participants' + ] + ) + + grouped_sessions.each do |room, sessions| + sessions.sort{|a,b| a.start_time <=> b.start_time}.each do |session| + worksheet.append_row( + [ + room.name, + session.start_time.strftime('%A'), + session.title, + session.start_time ? FastExcel.date_num(session.start_time, session.start_time.in_time_zone.utc_offset) : nil, + session.description, + session.published_session_assignments.select{|a| a.session_assignment_role_type_id == moderator.id}.collect{|a| a.person.published_name}.join(";\n"), + session.published_session_assignments.select{|a| a.session_assignment_role_type_id == participant.id}.collect{|a| a.person.published_name}.join(";\n"), + ], + styles + ) + end end + + send_data workbook.read_string, + filename: "RoomSigns#{Time.now.strftime('%m-%d-%Y')}.xlsx", + disposition: 'attachment' end def back_of_badge From 389cc90ff771e0c0741d529b3b1157426cea7bd8 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 11 Aug 2022 15:51:53 -0400 Subject: [PATCH 13/50] change to one line per room per day --- .../reports/program_ops_reports_controller.rb | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/app/controllers/reports/program_ops_reports_controller.rb b/app/controllers/reports/program_ops_reports_controller.rb index fe00a2c90..3095e9945 100644 --- a/app/controllers/reports/program_ops_reports_controller.rb +++ b/app/controllers/reports/program_ops_reports_controller.rb @@ -10,44 +10,47 @@ def room_signs # .order("rooms.name asc, start_time asc") # Room name, Day of week, sessions (title, start time, description, participant list with moderator marker). - grouped_sessions = sessions.group_by {|s| s.room} + grouped_sessions = sessions.group_by {|s| [s.room, s.start_time.strftime('%A'), s.start_time.strftime('%Y%j')]} moderator = SessionAssignmentRoleType.find_by(name: 'Moderator') participant = SessionAssignmentRoleType.find_by(name: 'Participant') + max_sessions = 0 - workbook = FastExcel.open(constant_memory: true) + workbook = FastExcel.open #(constant_memory: true) worksheet = workbook.add_worksheet("Room Signs") date_time_style = workbook.number_format("d mmm yyyy h:mm") styles = [nil, nil, nil, date_time_style] - worksheet.append_row( - [ - 'Room', - 'Day', - 'Session', - 'Time', - 'Description', - 'Moderators', - 'Participants' - ] - ) + worksheet.append_row([]) # For the header + + # one line per room per day + grouped_sessions.sort{|a,b| (a[0][0].name + a[0][2]) <=> (b[0][0].name + b[0][2]) }.each do |grp, sessions| + row = [grp[0].name, grp[1]] + styles = [nil, nil] - grouped_sessions.each do |room, sessions| sessions.sort{|a,b| a.start_time <=> b.start_time}.each do |session| - worksheet.append_row( - [ - room.name, - session.start_time.strftime('%A'), - session.title, - session.start_time ? FastExcel.date_num(session.start_time, session.start_time.in_time_zone.utc_offset) : nil, - session.description, - session.published_session_assignments.select{|a| a.session_assignment_role_type_id == moderator.id}.collect{|a| a.person.published_name}.join(";\n"), - session.published_session_assignments.select{|a| a.session_assignment_role_type_id == participant.id}.collect{|a| a.person.published_name}.join(";\n"), - ], - styles - ) + row.concat [ + # session.start_time.strftime('%A'), + session.title, + session.start_time ? FastExcel.date_num(session.start_time, session.start_time.in_time_zone.utc_offset) : nil, + session.description, + session.published_session_assignments.select{|a| a.session_assignment_role_type_id == moderator.id}.collect{|a| a.person.published_name}.join("; "), + session.published_session_assignments.select{|a| a.session_assignment_role_type_id == participant.id}.collect{|a| a.person.published_name}.join("; "), + ] + styles.concat [ + nil, date_time_style, nil, nil, nil + ] end + max_sessions = sessions.size if sessions.size > max_sessions + + worksheet.append_row(row, styles) end + header = ['Room', 'Day'] + (0..max_sessions).each do |n| + header.concat ["Title #{n+1}", "Start Time #{n+1}", "Description #{n+1}", "Moderators #{n+1}", "Participants #{n+1}"] + end + worksheet.write_row(0, header) + send_data workbook.read_string, filename: "RoomSigns#{Time.now.strftime('%m-%d-%Y')}.xlsx", disposition: 'attachment' From a4cd588ac2936af6974b0bbfbe88736715b7dbfa Mon Sep 17 00:00:00 2001 From: dcterman <105614148+dcterman@users.noreply.github.com> Date: Fri, 12 Aug 2022 09:16:16 -0400 Subject: [PATCH 14/50] Update version to 2.1.0 --- docs/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.md b/docs/index.md index f043b9ca6..73119d306 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: 2.1.0 -Staging version: 2.0.0 +Staging version: 2.1.0 From 008fe394f4e556f161bea967d4e6009412690a2a Mon Sep 17 00:00:00 2001 From: Gail Terman Date: Fri, 12 Aug 2022 10:21:15 -0400 Subject: [PATCH 15/50] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 969778243..b6f81a408 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ # Worldcon Programme Planning System +![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) # Getting Started From c8cfbe643f0d754480b5d0a02022194cebca9bed Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 12 Aug 2022 11:14:42 -0400 Subject: [PATCH 16/50] PLAN-656 user priv report --- .../reports/program_ops_reports_controller.rb | 36 +++++++++++++++++++ app/javascript/reports/reports_screen.vue | 5 +-- .../reports/program_ops_report_policy.rb | 4 +++ config/routes.rb | 9 ++--- lib/tasks/rbac.rake | 6 ++-- 5 files changed, 52 insertions(+), 8 deletions(-) diff --git a/app/controllers/reports/program_ops_reports_controller.rb b/app/controllers/reports/program_ops_reports_controller.rb index 61ed43fd9..785fcedc4 100644 --- a/app/controllers/reports/program_ops_reports_controller.rb +++ b/app/controllers/reports/program_ops_reports_controller.rb @@ -1,6 +1,42 @@ class Reports::ProgramOpsReportsController < ApplicationController around_action :set_timezone + def user_privileges + authorize Person, policy_class: Reports::ProgramOpsReportPolicy + + people = Person.includes(:convention_roles, :application_roles, :primary_email).order(:published_name) + + workbook = FastExcel.open(constant_memory: true) + worksheet = workbook.add_worksheet("People and Roles") + date_time_style = workbook.number_format("d mmm yyyy h:mm") + + worksheet.append_row( + [ + 'Email', + 'Published Name', + 'Convention Roles', + 'Recently Logged In At' + # 'Applicaion Roles' + ] + ) + people.each do |person| + worksheet.append_row( + [ + person.primary_email, + person.published_name, + person.convention_roles.collect{|r| r.role}.join(', '), + person.current_sign_in_at ? FastExcel.date_num(person.current_sign_in_at, person.current_sign_in_at.in_time_zone.utc_offset) : nil, + # person.convention_roles.collect{|r| r.application_roles.collect{|r| r.name}}.concat(person.application_roles.collect{|r| r.name}).join(', ') + ], + [nil, nil, nil, date_time_style] + ) + end + + send_data workbook.read_string, + filename: "UserPrivlages-#{Time.now.strftime('%m-%d-%Y')}.xlsx", + disposition: 'attachment' + end + def room_signs authorize SessionAssignment, policy_class: Reports::ProgramOpsReportPolicy diff --git a/app/javascript/reports/reports_screen.vue b/app/javascript/reports/reports_screen.vue index b71187180..4d9fd344e 100644 --- a/app/javascript/reports/reports_screen.vue +++ b/app/javascript/reports/reports_screen.vue @@ -318,11 +318,12 @@
  • Table Tents
  • - - diff --git a/app/policies/reports/program_ops_report_policy.rb b/app/policies/reports/program_ops_report_policy.rb index 330228ef0..933bce725 100644 --- a/app/policies/reports/program_ops_report_policy.rb +++ b/app/policies/reports/program_ops_report_policy.rb @@ -14,4 +14,8 @@ def sign_up_sessions? def table_tents? allowed?(action: :table_tents) end + + def user_privileges? + allowed?(action: :user_privileges) + end end diff --git a/config/routes.rb b/config/routes.rb index 08c251017..7e6551b84 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -72,7 +72,7 @@ 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/streamed_and_recorded', to: 'reports/session_reports#streamed_and_recorded' - get 'report/session_reports/session_needs', to: 'reports/session_reports#session_needs' + get 'report/session_reports/session_needs', to: 'reports/session_reports#session_needs' 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' @@ -89,13 +89,14 @@ get 'report/people_reports/record_stream_permissions', to: 'reports/people_reports#record_stream_permissions' get 'report/people_reports/moderators', to: 'reports/people_reports#moderators' - get 'report/people_reports/mis_matched_envs', to: 'reports/people_reports#mis_matched_envs' + get 'report/people_reports/mis_matched_envs', to: 'reports/people_reports#mis_matched_envs' get 'report/people_reports/social_media', to: 'reports/people_reports#social_media' get 'report/program_ops_reports/back_of_badge', to: 'reports/program_ops_reports#back_of_badge' get 'report/program_ops_reports/room_signs', to: 'reports/program_ops_reports#room_signs' - get 'report/program_ops_reports/sign_up_sessions', to: 'reports/program_ops_reports#sign_up_sessions' - get 'report/program_ops_reports/table_tents', to: 'reports/program_ops_reports#table_tents' + get 'report/program_ops_reports/sign_up_sessions', to: 'reports/program_ops_reports#sign_up_sessions' + get 'report/program_ops_reports/table_tents', to: 'reports/program_ops_reports#table_tents' + get 'report/program_ops_reports/user_privileges', to: 'reports/program_ops_reports#user_privileges' get 'report/schedule_reports/schedule_diff(/:from)(/:to)', to: 'reports/schedule_reports#schedule_diff' get 'publication_date/reset', to: 'publication_dates#reset' diff --git a/lib/tasks/rbac.rake b/lib/tasks/rbac.rake index f4d36459a..088ddccbf 100644 --- a/lib/tasks/rbac.rake +++ b/lib/tasks/rbac.rake @@ -554,7 +554,8 @@ namespace :rbac do "back_of_badge": true, "room_signs": true, "sign_up_sessions": true, - "table_tents": true + "table_tents": true, + "user_privileges": false }, "conflict_report": { "people_outside_availability": true, @@ -878,7 +879,8 @@ namespace :rbac do "back_of_badge": true, "room_signs": true, "sign_up_sessions": true, - "table_tents": true + "table_tents": true, + "user_privileges": true }, "session_conflict": { "conflicts_with": true, From 8e52c225bec0ba7291ec5112e37353bab9d0fafa Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 12 Aug 2022 11:43:40 -0400 Subject: [PATCH 17/50] PLAN-657 session report minor info --- .../reports/program_ops_reports_controller.rb | 43 +++++++++++++++++++ app/javascript/reports/reports_screen.vue | 5 ++- .../reports/program_ops_report_policy.rb | 4 ++ config/routes.rb | 7 +-- lib/tasks/rbac.rake | 6 ++- 5 files changed, 58 insertions(+), 7 deletions(-) diff --git a/app/controllers/reports/program_ops_reports_controller.rb b/app/controllers/reports/program_ops_reports_controller.rb index 61ed43fd9..50234b059 100644 --- a/app/controllers/reports/program_ops_reports_controller.rb +++ b/app/controllers/reports/program_ops_reports_controller.rb @@ -1,6 +1,49 @@ class Reports::ProgramOpsReportsController < ApplicationController around_action :set_timezone + def session_minors + authorize Session, policy_class: Reports::ProgramOpsReportPolicy + + sessions = SessionService + .draft_sessions + .includes(:age_restriction) + + + workbook = FastExcel.open(constant_memory: true) + worksheet = workbook.add_worksheet("Session and Minor Info") + date_time_style = workbook.number_format("d mmm yyyy h:mm") + styles = [nil, nil, date_time_style] + + worksheet.append_row( + [ + 'Session Title', + 'Description', + 'Time', + 'Room', + 'Age Restriction', + 'Minor Participant' + ] + ) + + sessions.each do |session| + worksheet.append_row( + [ + session.title, + session.description, + session.start_time ? FastExcel.date_num(session.start_time, session.start_time.in_time_zone.utc_offset) : nil, + session.room&.name, + session.age_restriction&.name, + (session.minors_participation && session.minors_participation.size > 0) ? session.minors_participation.join(', ') : nil + ], + styles + ) + end + + send_data workbook.read_string, + filename: "SessionAndMinors-#{Time.now.strftime('%m-%d-%Y')}.xlsx", + disposition: 'attachment' + end + def room_signs authorize SessionAssignment, policy_class: Reports::ProgramOpsReportPolicy diff --git a/app/javascript/reports/reports_screen.vue b/app/javascript/reports/reports_screen.vue index b71187180..560bf2ff7 100644 --- a/app/javascript/reports/reports_screen.vue +++ b/app/javascript/reports/reports_screen.vue @@ -318,11 +318,12 @@
  • Table Tents
  • - - diff --git a/app/policies/reports/program_ops_report_policy.rb b/app/policies/reports/program_ops_report_policy.rb index 330228ef0..cbf7edaad 100644 --- a/app/policies/reports/program_ops_report_policy.rb +++ b/app/policies/reports/program_ops_report_policy.rb @@ -14,4 +14,8 @@ def sign_up_sessions? def table_tents? allowed?(action: :table_tents) end + + def session_minors? + allowed?(action: :session_minors) + end end diff --git a/config/routes.rb b/config/routes.rb index 08c251017..78254f574 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -72,7 +72,7 @@ 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/streamed_and_recorded', to: 'reports/session_reports#streamed_and_recorded' - get 'report/session_reports/session_needs', to: 'reports/session_reports#session_needs' + get 'report/session_reports/session_needs', to: 'reports/session_reports#session_needs' 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' @@ -89,13 +89,14 @@ get 'report/people_reports/record_stream_permissions', to: 'reports/people_reports#record_stream_permissions' get 'report/people_reports/moderators', to: 'reports/people_reports#moderators' - get 'report/people_reports/mis_matched_envs', to: 'reports/people_reports#mis_matched_envs' + get 'report/people_reports/mis_matched_envs', to: 'reports/people_reports#mis_matched_envs' get 'report/people_reports/social_media', to: 'reports/people_reports#social_media' get 'report/program_ops_reports/back_of_badge', to: 'reports/program_ops_reports#back_of_badge' get 'report/program_ops_reports/room_signs', to: 'reports/program_ops_reports#room_signs' + get 'report/program_ops_reports/session_minors', to: 'reports/program_ops_reports#session_minors' get 'report/program_ops_reports/sign_up_sessions', to: 'reports/program_ops_reports#sign_up_sessions' - get 'report/program_ops_reports/table_tents', to: 'reports/program_ops_reports#table_tents' + get 'report/program_ops_reports/table_tents', to: 'reports/program_ops_reports#table_tents' get 'report/schedule_reports/schedule_diff(/:from)(/:to)', to: 'reports/schedule_reports#schedule_diff' get 'publication_date/reset', to: 'publication_dates#reset' diff --git a/lib/tasks/rbac.rake b/lib/tasks/rbac.rake index f4d36459a..c24683136 100644 --- a/lib/tasks/rbac.rake +++ b/lib/tasks/rbac.rake @@ -554,7 +554,8 @@ namespace :rbac do "back_of_badge": true, "room_signs": true, "sign_up_sessions": true, - "table_tents": true + "table_tents": true, + "session_minors": true }, "conflict_report": { "people_outside_availability": true, @@ -878,7 +879,8 @@ namespace :rbac do "back_of_badge": true, "room_signs": true, "sign_up_sessions": true, - "table_tents": true + "table_tents": true, + "session_minors": true }, "session_conflict": { "conflicts_with": true, From 7f749ae01e7a012e32486a182bd0ce3dd5b5e1d9 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 12 Aug 2022 18:44:13 -0400 Subject: [PATCH 18/50] comment out 2.1 reports --- app/javascript/reports/reports_screen.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/javascript/reports/reports_screen.vue b/app/javascript/reports/reports_screen.vue index 1342f0fd1..35e5130d9 100644 --- a/app/javascript/reports/reports_screen.vue +++ b/app/javascript/reports/reports_screen.vue @@ -108,12 +108,12 @@ Person data included: moderators

    -
  • + +
    Sessions
    @@ -320,7 +320,7 @@ Person data included: moderators, participants, invisible participants

  • -
  • + From 2db9f7205980ddc4ee32bd5670b673b20caa22d5 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 12 Aug 2022 18:55:42 -0400 Subject: [PATCH 19/50] fix comments --- app/javascript/reports/reports_screen.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/javascript/reports/reports_screen.vue b/app/javascript/reports/reports_screen.vue index 35e5130d9..1f08b69be 100644 --- a/app/javascript/reports/reports_screen.vue +++ b/app/javascript/reports/reports_screen.vue @@ -322,15 +322,15 @@
  • + + -
      + - +
    Sessions
    @@ -320,21 +320,19 @@ Person data included: moderators, participants, invisible participants

    - - - - - + From 9f9fd77419d9e2d65d61c661e21863a17ea455cf Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 16 Aug 2022 08:53:57 -0400 Subject: [PATCH 22/50] WIP --- app/lib/migration_helpers/plano_views.rb | 1 + app/services/mail_service.rb | 5 +++++ app/workers/mailing_worker.rb | 1 + 3 files changed, 7 insertions(+) diff --git a/app/lib/migration_helpers/plano_views.rb b/app/lib/migration_helpers/plano_views.rb index 868c26572..3d2fe6f2d 100644 --- a/app/lib/migration_helpers/plano_views.rb +++ b/app/lib/migration_helpers/plano_views.rb @@ -43,6 +43,7 @@ def self.create_person_schedules sessions.participant_notes, sessions.description, sessions.environment, + sessions.status, case when sa.updated_at > sessions.updated_at then sa.updated_at diff --git a/app/services/mail_service.rb b/app/services/mail_service.rb index d4d6b2e21..66b13bbea 100644 --- a/app/services/mail_service.rb +++ b/app/services/mail_service.rb @@ -1,4 +1,9 @@ module MailService + # + # generate email content needs a helper that takes the person and puts in their schedule + # + # person. + # person.scheduled_sessions (type PersonSchedule) def self.send_mailing( person:, mailing:, diff --git a/app/workers/mailing_worker.rb b/app/workers/mailing_worker.rb index 4b889c52b..baed74be3 100644 --- a/app/workers/mailing_worker.rb +++ b/app/workers/mailing_worker.rb @@ -18,6 +18,7 @@ def perform(mailing_id, send_test = false, test_address = nil, tester_id = nil) end end + # TODO: check def send_mailing(mailing:) # TODO - if test run then send to the requestor return unless mailing.mailing_state == Mailing.mailing_states[:submitted] # Check just in case this is a dup From 225ddf56a0eae068328689474a36dc05f7735526 Mon Sep 17 00:00:00 2001 From: Gail Terman Date: Wed, 17 Aug 2022 22:51:38 -0400 Subject: [PATCH 23/50] PLAN-707 pubs table updates round 1 --- .../publication_dates_controller.rb | 8 ++++++++ app/javascript/schedule/schedule_settings.vue | 19 +++++++++++++------ .../publication_date_serializer.rb | 3 ++- config/routes.rb | 2 +- ..._add_sent_external_to_publication_dates.rb | 5 +++++ db/structure.sql | 6 ++++-- 6 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 db/migrate/20220818022629_add_sent_external_to_publication_dates.rb diff --git a/app/controllers/publication_dates_controller.rb b/app/controllers/publication_dates_controller.rb index 3048de63e..cbfa9d152 100644 --- a/app/controllers/publication_dates_controller.rb +++ b/app/controllers/publication_dates_controller.rb @@ -30,4 +30,12 @@ def reset def paginate false end + + def allowed_params + %i[ + id + lock_version + sent_external + ] + end end diff --git a/app/javascript/schedule/schedule_settings.vue b/app/javascript/schedule/schedule_settings.vue index f257563b7..7f57c2d82 100644 --- a/app/javascript/schedule/schedule_settings.vue +++ b/app/javascript/schedule/schedule_settings.vue @@ -12,7 +12,7 @@ {{firmScheduledAtText}}
    - Reset for Testing + Reset for Testing THIS DELETES THE SNAPSHOT AND YOU CAN'T EVER GET IT BACK
    @@ -23,10 +23,10 @@ - + Show difference - + Create a publish snapshot @@ -34,7 +34,7 @@ + +
    - Reset Publish for Testing + Reset Publish for Testing THIS DELETES ALL THE PUBLISHED DATA AND YOU CAN'T EVER GET IT BACK
    @@ -183,7 +190,7 @@ export default { this.pubsLoading = true; 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 = Object.values(filteredData); this.snapshots.sort((a, b) => DateTime.fromISO(b.timestamp) - DateTime.fromISO(a.timestamp)); this.pubsDiff = [false, ...Object.keys(filteredData).map(s => false)]; this.pubsLoading = false; diff --git a/app/serializers/publication_date_serializer.rb b/app/serializers/publication_date_serializer.rb index fcdf55852..7986e5a93 100644 --- a/app/serializers/publication_date_serializer.rb +++ b/app/serializers/publication_date_serializer.rb @@ -3,5 +3,6 @@ class PublicationDateSerializer attributes :id, :created_at, :updated_at, :timestamp, :new_sessions, :updated_sessions, :dropped_sessions, - :new_assignments, :updated_assignments, :dropped_assignments + :new_assignments, :updated_assignments, :dropped_assignments, + :sent_external end diff --git a/config/routes.rb b/config/routes.rb index 102e71c5e..def96c4f9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -101,7 +101,7 @@ get 'report/schedule_reports/schedule_diff(/:from)(/:to)', to: 'reports/schedule_reports#schedule_diff' get 'publication_date/reset', to: 'publication_dates#reset' - resources :publication_dates, path: 'publication_date', only: [:index] + resources :publication_dates, path: 'publication_date', only: [:index, :update] resources :availabilities, path: 'availability', except: [:index] resources :person_exclusions, path: 'person_exclusion', except: [:index] diff --git a/db/migrate/20220818022629_add_sent_external_to_publication_dates.rb b/db/migrate/20220818022629_add_sent_external_to_publication_dates.rb new file mode 100644 index 000000000..6825fb7e2 --- /dev/null +++ b/db/migrate/20220818022629_add_sent_external_to_publication_dates.rb @@ -0,0 +1,5 @@ +class AddSentExternalToPublicationDates < ActiveRecord::Migration[6.1] + def change + add_column :publication_dates, :sent_external, :boolean, default: false, null: false + end +end diff --git a/db/structure.sql b/db/structure.sql index 34656c4e2..4a576aa92 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1351,7 +1351,8 @@ CREATE TABLE public.publication_dates ( dropped_sessions integer DEFAULT 0, new_assignments integer DEFAULT 0, updated_assignments integer DEFAULT 0, - dropped_assignments integer DEFAULT 0 + dropped_assignments integer DEFAULT 0, + sent_external boolean DEFAULT false NOT NULL ); @@ -3373,6 +3374,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20220726130346'), ('20220801152151'), ('20220801173704'), -('20220801195644'); +('20220801195644'), +('20220818022629'); From 9141b355151fd2ea74847519485da9aa1275c359 Mon Sep 17 00:00:00 2001 From: Gail Terman Date: Thu, 18 Aug 2022 08:44:56 -0400 Subject: [PATCH 24/50] PLAN-707 wire up the external attribute --- app/javascript/schedule/schedule_settings.vue | 24 +++++++++++++------ app/javascript/store/model.mixin.js | 5 +++- app/javascript/store/model.store.js | 5 ++++ .../store/publication_dates.store.js | 11 +++++++++ .../publication_date_serializer.rb | 2 +- ..._add_sent_external_to_publication_dates.rb | 1 + db/structure.sql | 3 ++- 7 files changed, 41 insertions(+), 10 deletions(-) create mode 100644 app/javascript/store/publication_dates.store.js diff --git a/app/javascript/schedule/schedule_settings.vue b/app/javascript/schedule/schedule_settings.vue index 7f57c2d82..833b756ba 100644 --- a/app/javascript/schedule/schedule_settings.vue +++ b/app/javascript/schedule/schedule_settings.vue @@ -56,7 +56,7 @@
    {{item.timestamp}}
    @@ -94,13 +94,16 @@ import { scheduleWorkflowMixin } from '@/store/schedule_workflow'; import settingsMixin from "@/store/settings.mixin"; import { DateTime } from 'luxon'; import IconButton from '@/components/icon_button.vue'; +import { modelMixinNoProp } from '@/store/model.mixin'; +import { publicationDatesModel as model } from '@/store/publication_dates.store' export default { name: "ScheduleSettings", mixins: [ toastMixin, scheduleWorkflowMixin, - settingsMixin + settingsMixin, + modelMixinNoProp ], components: { PlanoModal, @@ -114,9 +117,9 @@ export default { SCHEDULE_DRAFT_CONFIRM_MESSAGE, SCHEDULE_FIRM_CONFIRM_MESSAGE, NODE_ENV, - snapshots: [ ], pubsDiff: [], pubsLoading: false, + model }), computed: { pubSnapshots() { @@ -133,6 +136,11 @@ export default { }, firmScheduledAtText() { return this.firmScheduleConfirmed ? this.firmScheduledAt : "Pending"; + }, + snapshots() { + const snaps = this.collection; + snaps.sort((a, b) => DateTime.fromISO(b.timestamp) - DateTime.fromISO(a.timestamp)); + return snaps; } }, methods: { @@ -188,13 +196,15 @@ export default { }, fetchPublicationDates() { this.pubsLoading = true; - this.$store.dispatch('jv/get', '/publication_date').then((data) => { - const {_jv, ...filteredData} = data; - this.snapshots = Object.values(filteredData); + this.fetch().then((_) => { + this.snapshots = this.collection; this.snapshots.sort((a, b) => DateTime.fromISO(b.timestamp) - DateTime.fromISO(a.timestamp)); - this.pubsDiff = [false, ...Object.keys(filteredData).map(s => false)]; + this.pubsDiff = [false, ...this.collection.map(s => false)]; this.pubsLoading = false; }) + }, + patchSentExternal(item, sent_external) { + this.patch(item, {sent_external}, false, "Successfully updated the publication metadata.", "Failed to update the publication metadata") } }, watch: { diff --git a/app/javascript/store/model.mixin.js b/app/javascript/store/model.mixin.js index 5c16cc74b..b93c6fc9d 100644 --- a/app/javascript/store/model.mixin.js +++ b/app/javascript/store/model.mixin.js @@ -45,13 +45,16 @@ export const modelMixinNoProp = { return this.toastPromise(this.$store.dispatch(SAVE, {model: this.model, item: this.selected}), MODEL_SAVE_SUCCESS(this.model), MODEL_SAVE_ERROR(this.model)); }, patchSelected(data, selected = false, success_text = undefined, error_text = undefined) { + return this.patch(this.selected, data, selected, success_text, error_text); + }, + patch(instance, data, selected = false, success_text = undefined, error_text = undefined) { if (!success_text) { success_text = MODEL_SAVE_SUCCESS(this.model) } if (!error_text) { error_text = MODEL_SAVE_ERROR(this.model) } - return this.toastPromise(this.$store.dispatch(PATCH_FIELDS, {model: this.model, item: {...this.selected, ...data}, fields: Object.keys(data), selected}), success_text, error_text); + return this.toastPromise(this.$store.dispatch(PATCH_FIELDS, {model: this.model, item: {...instance, ...data}, fields: Object.keys(data), selected}), success_text, error_text); }, // need a save instance save(instance) { diff --git a/app/javascript/store/model.store.js b/app/javascript/store/model.store.js index 677963979..a5172f227 100644 --- a/app/javascript/store/model.store.js +++ b/app/javascript/store/model.store.js @@ -83,6 +83,9 @@ import { appStore } from './app.store'; import { scheduleWorkflowStore, scheduleWorkflowEndpoints } from './schedule_workflow/schedule_workflow.store'; import { personScheduleApprovalStore, personScheduleApprovalEndpoints } from './person_schedule_approval/person_schedule_approval.store'; +// publication dates +import { publicationDatesEndpoints, publicationDatesStore } from './publication_dates.store'; + import merge from 'lodash.merge' const endpoints = { @@ -106,6 +109,7 @@ const endpoints = { // ...personExclusionEndpoints, ...scheduleWorkflowEndpoints, ...personScheduleApprovalEndpoints, + ...publicationDatesEndpoints, } // NOTE: this is really the store @@ -142,6 +146,7 @@ export const store = new Vuex.Store({ ...sessionConflictStore.selected, ...formatStore.selected, ...personScheduleApprovalStore.selected, + ...publicationDatesStore.selected, }, ...personSessionStore.state, ...settingsStore.state, diff --git a/app/javascript/store/publication_dates.store.js b/app/javascript/store/publication_dates.store.js new file mode 100644 index 000000000..74fe1a5be --- /dev/null +++ b/app/javascript/store/publication_dates.store.js @@ -0,0 +1,11 @@ +export const publicationDatesModel = 'publication_date' + +export const publicationDatesEndpoints = { + [publicationDatesModel]: 'publication_date' +} + +export const publicationDatesStore = { + selected: { + [publicationDatesModel]: undefined + } +} diff --git a/app/serializers/publication_date_serializer.rb b/app/serializers/publication_date_serializer.rb index 7986e5a93..cb27f1a69 100644 --- a/app/serializers/publication_date_serializer.rb +++ b/app/serializers/publication_date_serializer.rb @@ -4,5 +4,5 @@ class PublicationDateSerializer attributes :id, :created_at, :updated_at, :timestamp, :new_sessions, :updated_sessions, :dropped_sessions, :new_assignments, :updated_assignments, :dropped_assignments, - :sent_external + :sent_external, :lock_version end diff --git a/db/migrate/20220818022629_add_sent_external_to_publication_dates.rb b/db/migrate/20220818022629_add_sent_external_to_publication_dates.rb index 6825fb7e2..8abc20eb7 100644 --- a/db/migrate/20220818022629_add_sent_external_to_publication_dates.rb +++ b/db/migrate/20220818022629_add_sent_external_to_publication_dates.rb @@ -1,5 +1,6 @@ class AddSentExternalToPublicationDates < ActiveRecord::Migration[6.1] def change add_column :publication_dates, :sent_external, :boolean, default: false, null: false + add_column :publication_dates, :lock_version, :integer, default: 0 end end diff --git a/db/structure.sql b/db/structure.sql index 4a576aa92..22972f3fa 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1352,7 +1352,8 @@ CREATE TABLE public.publication_dates ( new_assignments integer DEFAULT 0, updated_assignments integer DEFAULT 0, dropped_assignments integer DEFAULT 0, - sent_external boolean DEFAULT false NOT NULL + sent_external boolean DEFAULT false NOT NULL, + lock_version integer DEFAULT 0 ); From 708550a9e8593abe5dd6f3cde0e4407f37d98960 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 18 Aug 2022 16:07:17 -0400 Subject: [PATCH 25/50] update structure for view --- db/structure.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/db/structure.sql b/db/structure.sql index 22972f3fa..3e56449a7 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1124,6 +1124,7 @@ CREATE VIEW public.person_schedules AS sessions.participant_notes, sessions.description, sessions.environment, + sessions.status, CASE WHEN (sa.updated_at > sessions.updated_at) THEN sa.updated_at ELSE sessions.updated_at From 11b90fcab1f8793cceeb1fb8ffdd9ea684323e06 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 18 Aug 2022 16:54:58 -0400 Subject: [PATCH 26/50] WIP --- app/lib/formatter/person_schedule.rb | 13 +++++++++++++ app/models/person.rb | 6 +++++- app/services/mail_service.rb | 4 ++-- public/ckeditor/plugins/planobuttons/plugin.js | 5 +++++ 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 app/lib/formatter/person_schedule.rb diff --git a/app/lib/formatter/person_schedule.rb b/app/lib/formatter/person_schedule.rb new file mode 100644 index 000000000..ac011ef39 --- /dev/null +++ b/app/lib/formatter/person_schedule.rb @@ -0,0 +1,13 @@ +module Formatter + module PersonSchedule + + def schedule_to_html(person:) + html = "

    TEEST TEST

    " + + return html + end + + end +end + +# html:'<%= survey_to_html(args[:survey],args[:respondentDetails]) %>', diff --git a/app/models/person.rb b/app/models/person.rb index 5ce603be9..6536e8ba2 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -68,7 +68,11 @@ def publishable where("person_schedules.start_time is not null and person_schedules.room_id is not null") .where("person_schedules.session_assignment_name in (?)",['Moderator', 'Participant', 'Invisible']) }, - class_name: 'PersonSchedule' + class_name: 'PersonSchedule' do + def not_draft + where("person_schedules.status != 'draft' AND person_schedules.status != 'dropped'") + end + end # We let the publish mechanism do the destroy so that the update service knows what is happening has_many :published_session_assignments diff --git a/app/services/mail_service.rb b/app/services/mail_service.rb index 66b13bbea..753d95944 100644 --- a/app/services/mail_service.rb +++ b/app/services/mail_service.rb @@ -1,9 +1,9 @@ module MailService + extend Formatter::PersonSchedule + # # generate email content needs a helper that takes the person and puts in their schedule # - # person. - # person.scheduled_sessions (type PersonSchedule) def self.send_mailing( person:, mailing:, diff --git a/public/ckeditor/plugins/planobuttons/plugin.js b/public/ckeditor/plugins/planobuttons/plugin.js index c380261c4..4fa020f5d 100644 --- a/public/ckeditor/plugins/planobuttons/plugin.js +++ b/public/ckeditor/plugins/planobuttons/plugin.js @@ -155,6 +155,11 @@ CKEDITOR.config.planobuttons = [ name:'login_url', html:'<%= login_url %>', title:'Login URL' + }, + { + name:'participant_schedule', + html:'<%= schedule_to_html(person: person) %>', + title:'Participant Schedule' } ] } From fa56d72c51256ab82a1f6080fb1d98b858c9114b Mon Sep 17 00:00:00 2001 From: Gail Terman Date: Thu, 18 Aug 2022 18:27:29 -0400 Subject: [PATCH 27/50] PLAN-707 fix the settings tab --- app/javascript/schedule/schedule_settings.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/javascript/schedule/schedule_settings.vue b/app/javascript/schedule/schedule_settings.vue index 833b756ba..b103442ec 100644 --- a/app/javascript/schedule/schedule_settings.vue +++ b/app/javascript/schedule/schedule_settings.vue @@ -56,7 +56,7 @@
    {{item.timestamp}}
    @@ -197,8 +197,6 @@ export default { fetchPublicationDates() { this.pubsLoading = true; this.fetch().then((_) => { - this.snapshots = this.collection; - this.snapshots.sort((a, b) => DateTime.fromISO(b.timestamp) - DateTime.fromISO(a.timestamp)); this.pubsDiff = [false, ...this.collection.map(s => false)]; this.pubsLoading = false; }) From 6df2f4ecfad89ee3730262ee88ba1d0d6a781bc9 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 18 Aug 2022 18:28:13 -0400 Subject: [PATCH 28/50] PLAN-449 schedule mailing --- app/lib/formatter/person_schedule.rb | 10 ++- app/services/mail_service.rb | 75 +++++++++++-------- app/workers/mailing_worker.rb | 1 - .../ckeditor/plugins/planobuttons/plugin.js | 2 +- 4 files changed, 51 insertions(+), 37 deletions(-) diff --git a/app/lib/formatter/person_schedule.rb b/app/lib/formatter/person_schedule.rb index ac011ef39..287c9d6b6 100644 --- a/app/lib/formatter/person_schedule.rb +++ b/app/lib/formatter/person_schedule.rb @@ -2,12 +2,16 @@ module Formatter module PersonSchedule def schedule_to_html(person:) - html = "

    TEEST TEST

    " + html = "" + + sessions = person.scheduled_sessions.not_draft.order('start_time asc') + + sessions.each do |session| + html += "

    #{session.title} #{session.room.name}, #{session.start_time.strftime('%A, %B %-d, %l:%M %P %Z')}

    " + end return html end end end - -# html:'<%= survey_to_html(args[:survey],args[:respondentDetails]) %>', diff --git a/app/services/mail_service.rb b/app/services/mail_service.rb index 753d95944..ef4d50b48 100644 --- a/app/services/mail_service.rb +++ b/app/services/mail_service.rb @@ -10,43 +10,49 @@ def self.send_mailing( participant_schedule_url:, tester: nil ) - survey = mailing.survey - content = self.generate_email_content( - mailing.content, - { - person: person, - survey: survey, - participant_schedule_url: participant_schedule_url, - survey_url: self.generate_survey_url(survey: survey, person: person), - login_url: self.generate_login_url(person: person) - } - ) + self.set_timezone do + survey = mailing.survey + content = self.generate_email_content( + mailing.content, + { + person: person, + survey: survey, + participant_schedule_url: participant_schedule_url, + survey_url: self.generate_survey_url(survey: survey, person: person), + login_url: self.generate_login_url(person: person), + schedule_to_html: self.schedule_to_html(person: person) + } + ) - self.send_email( - to: tester ? tester.primary_email.email : person.primary_email.email, - subject: mailing.subject, - title: mailing.title, - content: content, - is_test: tester != nil, - person: person, - mailing: mailing - ) + self.send_email( + to: tester ? tester.primary_email.email : person.primary_email.email, + subject: mailing.subject, + title: mailing.title, + content: content, + is_test: tester != nil, + person: person, + mailing: mailing + ) - self.post_mail_transition(person: person, mailing: mailing) unless tester - self.post_mail_assign_survey(person: person, survey: survey) unless tester + self.post_mail_transition(person: person, mailing: mailing) unless tester + self.post_mail_assign_survey(person: person, survey: survey) unless tester + end end def self.preview_email_content(person:, mailing:, participant_schedule_url:) - self.generate_email_content( - mailing.content, - { - person: person, - survey: mailing.survey, - participant_schedule_url: participant_schedule_url, - survey_url: self.generate_survey_url(survey: mailing.survey, person: person), - login_url: self.generate_login_url(person: person) - } - ) + self.set_timezone do + self.generate_email_content( + mailing.content, + { + person: person, + survey: mailing.survey, + participant_schedule_url: participant_schedule_url, + survey_url: self.generate_survey_url(survey: mailing.survey, person: person), + login_url: self.generate_login_url(person: person), + schedule_to_html: self.schedule_to_html(person: person) + } + ) + end end def self.send_email( @@ -190,4 +196,9 @@ def self.generate_email_content(content, arguments) 0, "%<>" ).result(namespace.get_binding) # pass in a context with the parameters i.e. ruby binding end + + def self.set_timezone(&block) + timezone = ConfigService.value('convention_timezone') + Time.use_zone(timezone, &block) + end end diff --git a/app/workers/mailing_worker.rb b/app/workers/mailing_worker.rb index baed74be3..4b889c52b 100644 --- a/app/workers/mailing_worker.rb +++ b/app/workers/mailing_worker.rb @@ -18,7 +18,6 @@ def perform(mailing_id, send_test = false, test_address = nil, tester_id = nil) end end - # TODO: check def send_mailing(mailing:) # TODO - if test run then send to the requestor return unless mailing.mailing_state == Mailing.mailing_states[:submitted] # Check just in case this is a dup diff --git a/public/ckeditor/plugins/planobuttons/plugin.js b/public/ckeditor/plugins/planobuttons/plugin.js index 4fa020f5d..c45349530 100644 --- a/public/ckeditor/plugins/planobuttons/plugin.js +++ b/public/ckeditor/plugins/planobuttons/plugin.js @@ -158,7 +158,7 @@ CKEDITOR.config.planobuttons = [ }, { name:'participant_schedule', - html:'<%= schedule_to_html(person: person) %>', + html:'<%= schedule_to_html %>', title:'Participant Schedule' } ] From 34f29f573ffa4663a3bfe7d2a5b29af6f0f206fe Mon Sep 17 00:00:00 2001 From: Gail Terman Date: Thu, 18 Aug 2022 19:08:18 -0400 Subject: [PATCH 29/50] PLAN-729 fix mailing modals --- app/javascript/mailings/mailing_editor.vue | 40 ++++++++------------- app/javascript/mailings/mailing_preview.vue | 36 +++++-------------- 2 files changed, 22 insertions(+), 54 deletions(-) diff --git a/app/javascript/mailings/mailing_editor.vue b/app/javascript/mailings/mailing_editor.vue index d633d9176..0246aae8e 100644 --- a/app/javascript/mailings/mailing_editor.vue +++ b/app/javascript/mailings/mailing_editor.vue @@ -1,31 +1,19 @@