diff --git a/app/controllers/published_sessions_controller.rb b/app/controllers/published_sessions_controller.rb index 615a3c781..9dd726d58 100644 --- a/app/controllers/published_sessions_controller.rb +++ b/app/controllers/published_sessions_controller.rb @@ -1,5 +1,22 @@ class PublishedSessionsController < ResourceController SERIALIZER_CLASS = 'PublishedSessionSerializer'.freeze POLICY_CLASS = 'PublishedSessionPolicy'.freeze -# + + def resync_airmeet + authorize current_person, policy_class: policy_class + + + #TODO stop mixing up published session and session for integration purposes + session = PublishedSession.find params[:published_session_id] + + # makes the information in the airmeet sync record match the current session record + # NOTE: DOES NOT ACTUALLY DO A SYNC TO AIRMEET + if session + AirmeetApiService.session_to_airmeet(session, true); + # clumsily reload person after they are updated + session = PublishedSession.find params[:published_session_id] + end + + render_object(session) + end end diff --git a/app/controllers/reports/integrations_reports_controller.rb b/app/controllers/reports/integrations_reports_controller.rb index ecc5499da..a8691f59a 100644 --- a/app/controllers/reports/integrations_reports_controller.rb +++ b/app/controllers/reports/integrations_reports_controller.rb @@ -54,6 +54,9 @@ def airmeet_diffs styles = [date_time_style, date_time_style, nil, nil, nil, nil] people.each do |person| + if !person.registered + next + end integrations = person.integrations["airmeet"] || {} data = integrations["data"] || {} if data["name"] != person.published_name @@ -96,10 +99,172 @@ def airmeet_diffs styles ) end + end + sessions = AirmeetApiService.virtual_sessions + add_worksheet = workbook.add_worksheet("Added Sessions") + add_worksheet.append_row( + [ + 'Plano session id', + 'Session title', + 'Session start time', + 'Session duration', + 'Thing to paste gail' + ] + ) + + add_styles = [nil, nil, date_time_style, nil, nil] + + worksheet = workbook.add_worksheet("Changed Sessions") + worksheet.append_row ( + [ + 'Synced At (UTC)', + 'Session Last Updated (UTC)', + 'Session title (before)', + 'Session start time (before, UTC)', + 'Field changed', + 'From what', + 'To what' + ] + ) + + styles = [date_time_style, date_time_style, nil, date_time_style, nil, nil, nil] + + sessions.each do |session| + integrations = session.integrations["airmeet"] || {} + old_data = integrations["data"] || {} + new_data = AirmeetApiService.serialize_session(session) + if old_data == new_data + # nothing has changed, can stop checking + next + elsif old_data == {} + # this is a new session + add_worksheet.append_row( + [ + session.id, + new_data[:sessionTitle], + new_data[:sessionStartTime], + new_data[:sessionDuration], + "AirmeetApiService.session_to_airmeet(PublishedSession.find(\"#{session.id}\"))" + ], + add_styles + ) + else + p old_data + p new_data + old_start_time = DateTime.iso8601(old_data["sessionStartTime"]) + if old_data["sessionTitle"] != new_data[:sessionTitle] + worksheet.append_row( + [ + integrations["synced"] && DateTime.iso8601(integrations["synced_at"]), + session.updated_at, + old_data["sessionTitle"], + old_start_time, + "title", + old_data["sessionTitle"], + new_data[:sessionTitle] + ], + styles + ) + end + if old_data["sessionSummary"] != new_data[:sessionSummary] + worksheet.append_row( + [ + integrations["synced"] && DateTime.iso8601(integrations["synced_at"]), + session.updated_at, + old_data["sessionTitle"], + old_start_time, + "summary", + old_data["sessionSummary"], + new_data[:sessionSummary] + ], + styles + ) + end + if old_start_time != new_data[:sessionStartTime] + worksheet.append_row( + [ + integrations["synced"] && DateTime.iso8601(integrations["synced_at"]), + session.updated_at, + old_data["sessionTitle"], + old_start_time, + "start time", + old_start_time, + new_data[:sessionStartTime] + ], + [date_time_style, date_time_style, nil, date_time_style, nil, date_time_style, date_time_style] + ) + end + if old_data["sessionDuration"] != new_data[:sessionDuration] + worksheet.append_row( + [ + integrations["synced"] && DateTime.iso8601(integrations["synced_at"]), + session.updated_at, + old_data["sessionTitle"], + old_start_time, + "duration", + old_data["sessionDuration"], + new_data[:sessionDuration] + ], + styles + ) + end + if old_data["hostEmail"] != new_data[:hostEmail] + worksheet.append_row( + [ + integrations["synced"] && DateTime.iso8601(integrations["synced_at"]), + session.updated_at, + old_data["sessionTitle"], + old_start_time, + "room (host email)", + old_data["hostEmail"], + new_data[:hostEmail] + ], + styles + ) + end + old_cohost_emails = old_data["cohostEmails"] || [] + new_cohost_emails = new_data[:cohostEmails] || [] + if old_cohost_emails.sort != new_cohost_emails.sort + worksheet.append_row( + [ + integrations["synced"] && DateTime.iso8601(integrations["synced_at"]), + session.updated_at, + old_data["sessionTitle"], + old_start_time, + "moderator (co-host email)", + old_cohost_emails.join(", "), + new_cohost_emails.join(", ") + ], + styles + ) + end + old_speaker_data = old_data["speakerEmails"] || [] + new_speaker_data = new_data[:speakerEmails] || [] + if old_speaker_data.sort != new_speaker_data.sort + (old_speaker_data | new_speaker_data).each do |sp| + old_speaker = old_speaker_data.include? sp + if !old_speaker || !new_speaker_data.include?(sp) + worksheet.append_row( + [ + integrations["synced"] && DateTime.iso8601(integrations["synced_at"]), + session.updated_at, + old_data["sessionTitle"], + old_start_time, + old_speaker ? "drop speaker" : "add speaker", + old_speaker ? sp : '', + old_speaker ? '' : sp + ], + styles + ) + end + end + end + end end + send_data workbook.read_string, filename: "AirmeetPersonDiffs-#{Time.now.strftime('%b-%d-%Y-%H.%M')}.xlsx", disposition: 'attachment' diff --git a/app/controllers/reports/program_ops_reports_controller.rb b/app/controllers/reports/program_ops_reports_controller.rb index 64aef2854..b91c0bcae 100644 --- a/app/controllers/reports/program_ops_reports_controller.rb +++ b/app/controllers/reports/program_ops_reports_controller.rb @@ -237,10 +237,15 @@ def table_tents workbook = FastExcel.open #(constant_memory: true) worksheet = workbook.add_worksheet("Table Tents") + date_time_style = workbook.number_format("d mmm yyyy h:mm") + + styles = [nil, nil, date_time_style, nil, nil, nil, nil, nil,] worksheet.append_row( [ 'Session', + 'Room', + 'Start Time', 'Published Name', 'Description', 'Participant Notes', @@ -251,14 +256,19 @@ def table_tents sessions.each do |session| session.published_session_assignments.each do |pa| - worksheet.append_row [ - session.title, - pa.person.published_name, - ActionView::Base.full_sanitizer.sanitize(session.description), - session.participant_notes, - session.published_session_assignments.role(moderator).collect{|p| "#{p.person.published_name}#{p.person.pronouns && !p.person.pronouns.empty? ? ' (' + p.person.pronouns + ')' : ''}" }.join(",\n"), - session.published_session_assignments.role(participant).collect{|p| "#{p.person.published_name}#{p.person.pronouns && !p.person.pronouns.empty? ? ' (' + p.person.pronouns + ')' : ''}" }.join(",\n") - ] + worksheet.append_row( + [ + session.title, + session.room&.name, + FastExcel.date_num(session.start_time, session.start_time.in_time_zone.utc_offset), + pa.person.published_name, + ActionView::Base.full_sanitizer.sanitize(session.description), + session.participant_notes, + session.published_session_assignments.role(moderator).collect{|p| "#{p.person.published_name}#{p.person.pronouns && !p.person.pronouns.empty? ? ' (' + p.person.pronouns + ')' : ''}" }.join(",\n"), + session.published_session_assignments.role(participant).collect{|p| "#{p.person.published_name}#{p.person.pronouns && !p.person.pronouns.empty? ? ' (' + p.person.pronouns + ')' : ''}" }.join(",\n") + ], + styles + ) end end diff --git a/app/javascript/sessions/session_summary.vue b/app/javascript/sessions/session_summary.vue index f2a1d8573..eb73a7f4e 100644 --- a/app/javascript/sessions/session_summary.vue +++ b/app/javascript/sessions/session_summary.vue @@ -106,19 +106,22 @@ + Airmeet re-sync completed