Skip to content

Commit

Permalink
Merge pull request #720 from ChicagoWorldcon/staging
Browse files Browse the repository at this point in the history
2.1.4
  • Loading branch information
balen authored Aug 29, 2022
2 parents 80da5af + 5ce5160 commit 4cbae56
Show file tree
Hide file tree
Showing 8 changed files with 308 additions and 75 deletions.
19 changes: 18 additions & 1 deletion app/controllers/published_sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -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
165 changes: 165 additions & 0 deletions app/controllers/reports/integrations_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down
26 changes: 18 additions & 8 deletions app/controllers/reports/program_ops_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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

Expand Down
11 changes: 9 additions & 2 deletions app/javascript/sessions/session_summary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,22 @@
</b-form-select-option>
</b-form-select>
</b-form-group>
<b-button v-if="currentUserIsAdmin" variant="warning" :disabled="!session.streamed" @click="resyncAirmeet" class="mt-2">Airmeet re-sync completed</b-button>
</div>
</div>
</div>
</template>

<script>
import { sessionModel } from '@/store/session.store'
import { sessionEndpoints, sessionModel } from '@/store/session.store'
import modelUtilsMixin from '@/store/model_utils.mixin';
import { scheduledMixin } from './session_fields.mixin';
import { SESSION_STATUS, SESSION_MUST_UNSCHEDULE } from '@/constants/strings';
import settingsMixin from "@/store/settings.mixin";
import PlanoEditor from '../components/plano_editor';
import { personSessionMixin } from '@/mixins';
import { publishedSessionEndpoints, publishedSessionModel } from '@/store/published_session.store';
export default {
name: "SessionSummary",
Expand All @@ -128,7 +131,8 @@ export default {
mixins: [
modelUtilsMixin,
scheduledMixin,
settingsMixin
settingsMixin,
personSessionMixin
],
data: () => ({
SESSION_STATUS,
Expand All @@ -154,6 +158,9 @@ export default {
methods: {
saveSession() {
return this.save_model(sessionModel, this.session).then()
},
resyncAirmeet() {
this.toastPromise(this.$store.dispatch('jv/get', `${publishedSessionEndpoints[publishedSessionModel]}/${this.session.id}/resync_airmeet`), "Successfully updated airmeet sync data.")
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions app/policies/published_session_policy.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
class PublishedSessionPolicy < PlannerPolicy
def resync_airmeet?
allowed?(action: :resync_airmeet)
end

class Scope < PlannerPolicy::Scope
def resolve
scope.all
Expand Down
Loading

0 comments on commit 4cbae56

Please sign in to comment.