diff --git a/app/controllers/reports/integrations_reports_controller.rb b/app/controllers/reports/integrations_reports_controller.rb index a8691f59a..aeb4ed565 100644 --- a/app/controllers/reports/integrations_reports_controller.rb +++ b/app/controllers/reports/integrations_reports_controller.rb @@ -33,10 +33,21 @@ def airmeet_magic_link def airmeet_diffs authorize Person, policy_class: ReportPolicy + AirmeetApiService.clear_room_hosts people = AirmeetApiService.virtual_people workbook = FastExcel.open(constant_memory: true) + add_worksheet = workbook.add_worksheet("Added People") + add_worksheet.append_row( + [ + 'Plano id', + 'Published Name', + 'Email', + 'Thing to paste gail' + ] + ) + worksheet = workbook.add_worksheet("Changed People") date_time_style = workbook.number_format("d mmm yyyy h:mm") @@ -59,45 +70,56 @@ def airmeet_diffs end integrations = person.integrations["airmeet"] || {} data = integrations["data"] || {} - if data["name"] != person.published_name - worksheet.append_row( - [ - integrations["synced"] && DateTime.iso8601(integrations["synced_at"]), - person.updated_at, - integrations["speaker_email"], - "name", - data["name"], - person.published_name - ], - styles - ) - end - if data["email"] != person.primary_email&.email - worksheet.append_row( - [ - integrations["synced"] && DateTime.iso8601(integrations["synced_at"]), - person.updated_at, - integrations["speaker_email"], - "email", - data["email"], - person.primary_email&.email - ], - styles - ) - end - bio = ActionView::Base.full_sanitizer.sanitize(person.bio) - if data["bio"] != bio - worksheet.append_row( + if !integrations["synced"] + add_worksheet.append_row( [ - integrations["synced"] && DateTime.iso8601(integrations["synced_at"]), - person.updated_at, - integrations["speaker_email"], - "bio", - data["bio"], - bio - ], - styles + person.id, + person.published_name, + person.primary_email&.email, + "AirmeetApiService.person_to_airmeet(Person.find(\"#{person.id}\"))" + ] ) + else + if data["name"] != person.published_name + worksheet.append_row( + [ + integrations["synced"] && DateTime.iso8601(integrations["synced_at"]), + person.updated_at, + integrations["speaker_email"], + "name", + data["name"], + person.published_name + ], + styles + ) + end + if data["email"] != person.primary_email&.email + worksheet.append_row( + [ + integrations["synced"] && DateTime.iso8601(integrations["synced_at"]), + person.updated_at, + integrations["speaker_email"], + "email", + data["email"], + person.primary_email&.email + ], + styles + ) + end + bio = ActionView::Base.full_sanitizer.sanitize(person.bio) + if data["bio"] != bio + worksheet.append_row( + [ + integrations["synced"] && DateTime.iso8601(integrations["synced_at"]), + person.updated_at, + integrations["speaker_email"], + "bio", + data["bio"], + bio + ], + styles + ) + end end end diff --git a/app/services/airmeet_api_service.rb b/app/services/airmeet_api_service.rb index 0e01b273b..911ebefdb 100644 --- a/app/services/airmeet_api_service.rb +++ b/app/services/airmeet_api_service.rb @@ -145,7 +145,7 @@ def self.session_to_airmeet(session, dont_send = false) p "ERROR with session #{session.title}. please check manually." return end - + participants = session.published_session_assignments.filter { |sa| (sa.session_assignment_role_type_id == moderator_id || sa.session_assignment_role_type_id == participant_id) && sa.person.registered }.map { |sa| sa.person } puts args if dont_send result = args @@ -194,6 +194,10 @@ def self.sync_to_airmeet puts "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA IT WORKED" end + def self.clear_room_hosts + @room_hosts = nil + end + def self.clear_participant_data Person.where.not(integrations: {}).update_all(integrations: {}) end