Skip to content

Commit

Permalink
Merge pull request #715 from ChicagoWorldcon/staging
Browse files Browse the repository at this point in the history
2.1.2
  • Loading branch information
balen authored Aug 27, 2022
2 parents c2d82dd + 37bec2c commit 80da5af
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 17 deletions.
25 changes: 13 additions & 12 deletions app/javascript/reports/reports_screen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@
<p class="ml-2">
<strong><em>Description</em></strong>: Session information for daily grid, one line per session<br />
<strong><em>Fields</em></strong>: Session title, area(s) of session, session format, session start time, session duration, session room<br />
<strong><em>Session data included</em></strong>: all scheduled sessions that are visible and published
<strong><em>Session data included</em></strong>: all published sessions in the most recent publish
</p>
</li>
<li>
Expand All @@ -338,15 +338,15 @@
<p class="ml-2">
<strong><em>Description</em></strong>: Maximum number of attendees in sessions requiring signup, one line per session<br />
<strong><em>Fields</em></strong>: Session title, session description, session room, session start time, session duration, session format, participants, session environment, max number of attendees<br />
<strong><em>Session data included</em></strong>: all published sessions<br />
<strong><em>Session data included</em></strong>: all published sessions in the most recent publish<br />
</p>
</li>
<li>
<a href="/report/session_reports/session_needs" target="_blank">Session Needs</a>
<p class="ml-2">
<strong><em>Description</em></strong>: Session setup requirements, one line per session<br />
<strong><em>Fields</em></strong>: Session title, session start time, session room, session environment, session format, session area(s), required room features&#8725;services, tech&#8725;hotel notes, room setup<br />
<strong><em>Session data included</em></strong>: all published sessions<br />
<strong><em>Session data included</em></strong>: all published sessions in the most recent publish<br />
</p>
</li>
<li>
Expand All @@ -362,7 +362,7 @@
<p class="ml-2">
<strong><em>Description</em></strong>: Room sign data for mail merge, one line per room and day of week<br />
<strong><em>Fields</em></strong>: Room, day of week, sessions (title, start time, description, moderators, participants)<br />
<strong><em>Session data included</em></strong>: all published sessions<br />
<strong><em>Session data included</em></strong>: all published sessions in the most recent publish<br />
<strong><em>Person data included</em></strong>: moderators, participants
</p>
</li>
Expand All @@ -371,7 +371,7 @@
<p class="ml-2">
<strong><em>Description</em></strong>: Table tent data for mail merge, one line per session and participant<br />
<strong><em>Fields</em></strong>: Session title, published name, session description, scheduled participant notes, moderators and their pronouns, participants and their pronouns<br />
<strong><em>Session data included</em></strong>: published sessions with environment of &quot;in person&quot; or &quot;hybrid&quot;<br />
<strong><em>Session data included</em></strong>: published sessions in the most recent publish, with environment of &quot;in person&quot; or &quot;hybrid&quot;<br />
<strong><em>Person data included</em></strong>: moderators, participants
</p>
</li>
Expand All @@ -380,24 +380,25 @@
<p class="ml-2">
<strong><em>Description</em></strong>: List of emails for moderators and participants of published sessions, with indicator about whether they are assigned to any session(s) of environment virtual, one line per participant<br />
<strong><em>Fields</em></strong>: Published name, name, whether person is assigned to a virtual session (y &#8725; n), primary email, other emails<br />
<strong><em>Session data included</em></strong>: all published sessions<br />
<strong><em>Session data included</em></strong>: all published sessions in the most recent publish<br />
<strong><em>Person data included</em></strong>: moderators and participants
</p>
</li>
<li>
<a href="/report/integrations_reports/airmeet_magic_link" target="_blank">Airmeet Magic Links</a>
<p class="ml-2">
<strong><em>Description</em></strong>: Links that get you into the program airmeet as each speaker in the system. For emergency customer service use.<br />
<strong><em>Fields</em></strong>: Published name, primary email, airmeet magic link<br />
<strong><em>Person data included</em></strong>: all moderators and participants on virtual panels
<strong><em>Description</em></strong>: Links to get each participant (speaker) into Airmeet, one line per person. For emergency customer service use.<br />
<strong><em>Fields</em></strong>: Published name, primary email, Airmeet magic link<br />
<strong><em>Person data included</em></strong>: all moderators and participants assigned to virtual sessions
</p>
</li>
<li>
<a href="/report/integrations_reports/airmeet_diffs" target="_blank">Airmeet Diffs</a>
<p class="ml-2">
<strong><em>Description</em></strong>: People data that has changed for airmeet people since they were last synced (manually or automatically)<br />
<strong><em>Fields</em></strong>: Last sync, person last updated, airmeet email, what changed, from what, to what<br />
<strong><em>Person data included</em></strong>: all moderators and participants on virtual panels who have changed since their last sync to airmeet
<strong><em>Description</em></strong>: Changes to person information since the last sync (manual or automatic) with Airmeet, one line per change<br />
<strong><em>Fields</em></strong>: Time of last sync, time when person last updated, Airmeet email, what changed, from what, to what<br />
<strong><em>Session data included</em></strong>: all published sessions with environment of &quot;virtual&quot;, in the most recent publish<br />
<strong><em>Person data included</em></strong>: moderators and participants assigned to published virtual sessions, whose published name, email, or bio has changed since their last sync to Airmeet
</p>
</li>
</ul>
Expand Down
14 changes: 9 additions & 5 deletions app/services/airmeet_api_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def self.create_speaker(name:, email:, organisation: "", designation: "", imageU
end

def self.person_to_airmeet(person, dont_send = false)
if !person.registered
p "skipping #{person.primary_email.email} - they are not registered"
return
end
speaker_email = person.primary_email.email
country = nil
city = nil
Expand Down Expand Up @@ -103,7 +107,7 @@ def self.person_to_airmeet(person, dont_send = false)
end
puts result
newly_created = result["status"] == "SPEAKER_CREATED" || dont_send
person.update({integrations: person.integrations.merge({airmeet: {speaker_email: speaker_email, synced: newly_created || (person.integrations["airmeet"] || {})["synced"], data: newly_created ? args : (person.integrations["airmeet"] || {})["data"], synced_at: newly_created ? Time.now.iso8601 : (person.integrations["airmeet"] || {})["synced_at"] }})})
person.update({integrations: person.integrations.merge({airmeet: (person.integrations["airmeet"] || {}).merge({speaker_email: speaker_email, synced: newly_created || (person.integrations["airmeet"] || {})["synced"], data: newly_created ? args : (person.integrations["airmeet"] || {})["data"], synced_at: newly_created ? Time.now.iso8601 : (person.integrations["airmeet"] || {})["synced_at"] })})})
end

def self.session_to_airmeet(session, dont_send = false)
Expand All @@ -113,10 +117,10 @@ def self.session_to_airmeet(session, dont_send = false)
sessionStartTime: session.start_time,
hostEmail: room_hosts[session.room_id]
};
participants = session.published_session_assignments.filter { |sa| sa.session_assignment_role_type_id == moderator_id || sa.session_assignment_role_type_id == participant_id }.map { |sa| sa.person }
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 }
if session.environment == "virtual"
args[:speakerEmails] = participants.map{|p| p.integrations["airmeet"]["speaker_email"]}
args[:cohostEmails] = session.published_session_assignments.filter { |sa| sa.session_assignment_role_type_id == moderator_id }.map { |sa| sa.person.integrations["airmeet"]["speaker_email"] }
args[:cohostEmails] = session.published_session_assignments.filter { |sa| sa.session_assignment_role_type_id == moderator_id && sa.person.registered }.map { |sa| sa.person.integrations["airmeet"]["speaker_email"] }
end
if session.id === "e3e249ee-2800-40cc-a245-f462187833b9"
args[:sessionTitle] = "Never Give Up, Never Surrender! The Art of Eric Wilkerson: Scifi Illustrator and Visual Afrofuturist"
Expand All @@ -131,9 +135,9 @@ def self.session_to_airmeet(session, dont_send = false)
success = result["uid"] || dont_send
old_airmeet_data = session.integrations["airmeet"] || {}
session.update({integrations: session.integrations.merge({airmeet: {session_id: result["uid"] || old_airmeet_data["session_id"], synced: success || old_airmeet_data["synced"] , synced_at: success ? Time.now() : old_airmeet_data["synced_at"] , data: success ? args : old_airmeet_data["data"]}})})
if session.environment == "virtual" && !dont_send
if session.environment == "virtual" && success && !dont_send
people_tokens = (result["token"] || []).inject({}) {|p,c| p[c["email"]] = c["token"]; p}
participants.each { |p| p.update({integrations: p.integrations.merge({airmeet: (p.integrations["airmeet"] || {}).merge({token: people_tokens[(p.integrations["airmeet"] || {})["speaker_email"]] || (p.integrations["airmeet"] || {})["token"]})})})}
participants.each { |p| p.update({integrations: p.integrations.merge({airmeet: (p.integrations["airmeet"] || {}).merge({token: people_tokens[(p.integrations["airmeet"] || {})["speaker_email"]] || (p.integrations["airmeet"] || {})[:token]})})})}
end
end

Expand Down
30 changes: 30 additions & 0 deletions lib/tasks/import.rake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,36 @@ strip_converter = proc {|field| field ? field.strip : field}
CSV::Converters[:strip] = strip_converter

namespace :import do
task :airmeet_people, [:filename] => :environment do |t, args|
if !args[:filename]
p "You need to add the filename as an argument: rake import:filename[/path/to/file]"
end

File.open(args[:filename]) do |file|
parsed_output = CSV.read(file, headers: true, header_converters: :symbol, converters: :strip)
count = 0
parsed_output.each do |o|
email = o[:primary_email]
paid = o[:is_paid]&.downcase == "yes"
city = o[:city]
country = o[:country]
person = Person.joins(:primary_email).find_by(email_addresses: {email: email});
if !person
p "Skipping because can't find person with email #{email}"
next
end
person.update({
registered: paid,
integrations: person.integrations.merge({airmeet: (person.integrations["airmeet"] || {}).merge({city: city, country: country})})
})
p person
count += 1
end
p "Imported #{count} users country & city, skipped #{parsed_output.length - count}"
end
end


task :users, [:filename] => :environment do |t, args|
if !args[:filename]
p "You need to add the filename as an argument: rake import:users[/path/to/file]"
Expand Down

0 comments on commit 80da5af

Please sign in to comment.