Skip to content

Commit

Permalink
Merge pull request #723 from ChicagoWorldcon/PLAN-765-airmeet-session…
Browse files Browse the repository at this point in the history
…-diff

PLAN-765 airmeet session diff improvements
  • Loading branch information
Gailbear authored Aug 30, 2022
2 parents fa3017d + ba83eca commit 083e797
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 38 deletions.
96 changes: 59 additions & 37 deletions app/controllers/reports/integrations_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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

Expand Down
6 changes: 5 additions & 1 deletion app/services/airmeet_api_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 083e797

Please sign in to comment.