Skip to content

Commit

Permalink
Merge pull request #692 from ChicagoWorldcon/staging
Browse files Browse the repository at this point in the history
v2.0.2
  • Loading branch information
balen authored Aug 23, 2022
2 parents d01f812 + 0df68ee commit 9f1ce0c
Show file tree
Hide file tree
Showing 35 changed files with 764 additions and 167 deletions.
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ GEM
zeitwerk (~> 2.3)
acts-as-taggable-on (9.0.1)
activerecord (>= 6.0, < 7.1)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
bcrypt (3.1.18)
bindex (0.8.1)
Expand Down Expand Up @@ -229,7 +229,7 @@ GEM
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (4.0.7)
public_suffix (5.0.0)
puma (5.6.4)
nio4r (~> 2.0)
pundit (2.2.0)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Worldcon Programme Planning System
![Production version](https://img.shields.io/github/v/release/ChicagoWorldcon/planorama?label=production)
![Staging version](https://img.shields.io/github/v/release/ChicagoWorldcon/planorama?include_prereleases&label=staging)

# Getting Started

Expand Down
8 changes: 8 additions & 0 deletions app/controllers/publication_dates_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,12 @@ def reset
def paginate
false
end

def allowed_params
%i[
id
lock_version
sent_external
]
end
end
102 changes: 102 additions & 0 deletions app/controllers/reports/people_reports_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,107 @@
class Reports::PeopleReportsController < ApplicationController
around_action :set_timezone
def social_media
authorize Person, policy_class: ReportPolicy

people = SessionService.draft_people

workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("Participant and Social Media")

worksheet.append_row(
[
'Published Name',
'Attendance Type',
'Participant Status',
'Bio',
'Social Media'
]
)

people.each do |person|
social = []
social << "Twitter: https://twitter.com/#{person.twitter}" unless person.twitter.blank?
social << "Facebook: https://facebook.com/#{person.facebook}" unless person.facebook.blank?
social << "Website: #{person.website}" unless person.website.blank?
social << "Instagram: https://instagram.com/#{person.instagram}" unless person.instagram.blank?
social << "Twitch: https://twitch.tv/#{person.twitch}" unless person.twitch.blank?
social << "Youtube: https://youtube.com/#{person.youtube}" unless person.youtube.blank?
social << "TikTok: https://www.tiktok.com/@#{person.tiktok}" unless person.tiktok.blank?
social << "LinkedIn: https://linkedin.com/in/#{person.linkedin}" unless person.linkedin.blank?
social << "Other Social Media: #{person.othersocialmedia}" unless person.othersocialmedia.blank?

worksheet.append_row(
[
person.published_name,
person.attendance_type,
person.con_state,
person.bio,
social.join(",\n")
]
)
end

send_data workbook.read_string,
filename: "ParticipantsSocialMedia-#{Time.now.strftime('%m-%d-%Y')}.xlsx",
disposition: 'attachment'
end

def mis_matched_envs
authorize Person, policy_class: ReportPolicy

results = PersonSchedule
.joins(:person)
.where(
%q(case
when (person_schedules.environment = 'in_person') then (people.attendance_type != 'in person' and people.attendance_type != 'hybrid')
when (person_schedules.environment = 'hybrid') then (people.attendance_type != 'in person' and people.attendance_type != 'hybrid')
when (person_schedules.environment = 'virtual') then (people.attendance_type != 'virtual' and people.attendance_type != 'hybrid')
end
)
)
.order("published_name asc, start_time asc")

# Sessions: only scheduled sessions,
# only when virtual people are on in-person or hybrid sessions, or in-person people are on virtual sessions
workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("Mismatched Envs")
date_time_style = workbook.number_format("d mmm yyyy h:mm")

worksheet.append_row(
[
'Published Name',
'Primary Email',
'Attendance Type',
'Participant Status',
'Session',
'Room',
'Start Time',
'Session Environment'
]
)

styles = [nil, nil, nil, nil, nil, nil, date_time_style, nil]

results.each do |result|
worksheet.append_row(
[
result.published_name,
result.person.primary_email&.email,
result.person.attendance_type,
result.person.con_state,
result.title,
result.room&.name,
result.session.start_time ? FastExcel.date_num(result.session.start_time, result.session.start_time.in_time_zone.utc_offset) : nil,
result.environment
],
styles
)
end

send_data workbook.read_string,
filename: "PeopleOnMismatchedSessions-#{Time.now.strftime('%m-%d-%Y')}.xlsx",
disposition: 'attachment'
end

def moderators
authorize Person, policy_class: ReportPolicy
Expand Down
Loading

0 comments on commit 9f1ce0c

Please sign in to comment.