Skip to content

Commit

Permalink
Merge pull request #677 from ChicagoWorldcon/staging
Browse files Browse the repository at this point in the history
2.0.1
  • Loading branch information
Gailbear authored Aug 21, 2022
2 parents fecc2d2 + a525038 commit d01f812
Show file tree
Hide file tree
Showing 45 changed files with 1,163 additions and 202 deletions.
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ gem 'rails', '~> 6.1' #, '>= 6.0.3.2'
gem 'pg', '>= 0.18', '< 2.0'

gem 'activerecord-postgres_enum'
gem 'actionpack-action_caching'

# Use Puma as the app server
gem 'puma', '>= 5.0'
Expand Down Expand Up @@ -63,6 +64,10 @@ gem 'truemail'
# This is needed to run the migrations from id to uuid for primary keys
gem 'webdack-uuid_migration'

# for integrations!
gem "httparty"
gem "json-diff"

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
Expand Down
59 changes: 36 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
aasm (5.2.0)
aasm (5.3.0)
concurrent-ruby (~> 1.0)
actioncable (6.1.6.1)
actionpack (= 6.1.6.1)
Expand Down Expand Up @@ -29,6 +29,8 @@ GEM
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionpack-action_caching (1.2.2)
actionpack (>= 4.0.0)
actiontext (6.1.6.1)
actionpack (= 6.1.6.1)
activerecord (= 6.1.6.1)
Expand Down Expand Up @@ -77,9 +79,9 @@ GEM
ast (2.4.2)
bcrypt (3.1.18)
bindex (0.8.1)
bootsnap (1.12.0)
bootsnap (1.13.0)
msgpack (~> 1.2)
brakeman (5.2.3)
brakeman (5.3.1)
builder (3.2.4)
bundler-audit (0.9.1)
bundler (>= 1.2.0, < 3)
Expand Down Expand Up @@ -115,7 +117,7 @@ GEM
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
erubi (1.10.0)
erubi (1.11.0)
et-orbi (1.2.7)
tzinfo
eventmachine (1.2.7)
Expand All @@ -124,7 +126,7 @@ GEM
factory_bot_rails (6.2.0)
factory_bot (~> 6.2.0)
railties (>= 5.0.0)
faker (2.21.0)
faker (2.22.0)
i18n (>= 1.8.11, < 2)
fast_excel (0.4.0)
ffi (> 1.9, < 2)
Expand All @@ -151,13 +153,17 @@ GEM
guard-compat (~> 1.0)
multi_json (~> 1.8)
http_parser.rb (0.8.0)
httparty (0.20.0)
mime-types (~> 3.0)
multi_xml (>= 0.5.2)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
io-wait (0.2.3)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
json (2.6.2)
json-diff (0.4.1)
jsonapi-renderer (0.2.2)
jsonapi-serializer (2.2.0)
activesupport (>= 4.2)
Expand Down Expand Up @@ -188,34 +194,38 @@ GEM
marcel (1.0.2)
matrix (0.4.2)
method_source (1.0.0)
mime-types (3.4.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2022.0105)
mini_mime (1.1.2)
mini_portile2 (2.8.0)
minitest (5.16.2)
msgpack (1.5.3)
minitest (5.16.3)
msgpack (1.5.4)
multi_json (1.15.0)
multi_xml (0.6.0)
nenv (0.3.0)
nilify_blanks (1.4.0)
activerecord (>= 4.0.0)
activesupport (>= 4.0.0)
nio4r (2.5.8)
nokogiri (1.13.7)
nokogiri (1.13.8)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
nokogiri (1.13.7-x86_64-darwin)
nokogiri (1.13.8-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.13.7-x86_64-linux)
nokogiri (1.13.8-x86_64-linux)
racc (~> 1.4)
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
orm_adapter (0.5.0)
paper_trail (12.3.0)
paper_trail (13.0.0)
activerecord (>= 5.2)
request_store (~> 1.1)
parallel (1.22.1)
parser (3.1.2.0)
parser (3.1.2.1)
ast (~> 2.4.1)
pg (1.4.1)
pg (1.4.3)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
Expand Down Expand Up @@ -304,17 +314,17 @@ GEM
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (3.11.0)
rubocop (1.31.2)
rubocop (1.35.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.0.0)
parser (>= 3.1.2.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.18.0, < 2.0)
rubocop-ast (>= 1.20.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.19.1)
rubocop-ast (1.21.0)
parser (>= 3.1.1.0)
ruby-progressbar (1.11.0)
ruby_audit (2.1.0)
Expand All @@ -334,17 +344,17 @@ GEM
tilt
seedbank (0.5.0)
rake (>= 10.0)
selenium-webdriver (4.3.0)
selenium-webdriver (4.4.0)
childprocess (>= 0.5, < 5.0)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
semantic_range (3.0.0)
shellany (0.0.1)
sidekiq (6.5.1)
sidekiq (6.5.4)
connection_pool (>= 2.2.2)
rack (~> 2.0)
redis (>= 4.2.0)
redis (>= 4.5.0)
sidekiq-scheduler (4.0.2)
redis (>= 4.2.0)
rufus-scheduler (~> 3.2)
Expand All @@ -364,10 +374,10 @@ GEM
activesupport (>= 5.2)
sprockets (>= 3.0.0)
thor (1.2.1)
tilt (2.0.10)
truemail (2.7.3)
tilt (2.0.11)
truemail (2.7.4)
simpleidn (~> 0.2.1)
tzinfo (2.0.4)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
unf (0.1.4)
unf_ext
Expand Down Expand Up @@ -407,6 +417,7 @@ PLATFORMS

DEPENDENCIES
aasm
actionpack-action_caching
active_model_serializers (~> 0.10.0)
activerecord-postgres_enum
acts-as-taggable-on (~> 9.0)
Expand All @@ -423,8 +434,10 @@ DEPENDENCIES
fast_excel
guard
guard-livereload
httparty
io-wait
jbuilder (~> 2.7)
json-diff
jsonapi-serializer
jsonapi.rb
kaminari
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ def configure_permitted_parameters

def render_jsonapi_internal_server_error(exception)
# Rails.logger.error "**** INTERNAL ERROR #{exception.class}"
Rails.logger.error exception.message if Rails.env.development?
Rails.logger.error exception.backtrace.join("\n\t") if Rails.env.development?
Rails.logger.error exception.message #if Rails.env.development?
Rails.logger.error exception.backtrace.join("\n\t") #if Rails.env.development?
# NOTE: if we have a central log put it in here
super(exception)
end
Expand Down
28 changes: 28 additions & 0 deletions app/controllers/integrations_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
class IntegrationsController < ResourceController
SERIALIZER_CLASS = 'IntegrationSerializer'.freeze
POLICY_CLASS = 'IntegrationPolicy'.freeze

def airmeet
authorize model_class, policy_class: policy_class

airmeet = Integration.find_by({name: 'airmeet'})

render json: serializer_class.new(airmeet,
{
include: serializer_includes,
params: {domain: "#{request.base_url}"}
}
).serializable_hash(),
content_type: 'application/json'
end

def allowed_params
%i[
id
name
lock_version
config
]
end

end
20 changes: 11 additions & 9 deletions app/controllers/publication_dates_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ class PublicationDatesController < ResourceController

def reset
# Make sure that people can not publish etc while we clean up
PublicationStatus.last.update(status: 'inprogress')
if PublicationStatus.last
PublicationStatus.last.update(status: 'inprogress')

# Get rid of published data first
PublishedSession.destroy_all
# Get rid of published data first
PublishedSession.destroy_all

# Then get rid of the audit
Audit::PublishedSessionVersion.delete_all
# Then get rid of the audit
Audit::PublishedSessionVersion.delete_all

# Then remove caches, dates, and status
PublishSnapshot.delete_all
PublicationDate.delete_all
PublicationStatus.delete_all
# Then remove caches, dates, and status
PublishSnapshot.delete_all
PublicationDate.delete_all
PublicationStatus.delete_all
end

render status: :ok,
json: { message: 'publication reset' }.to_json,
Expand Down
4 changes: 3 additions & 1 deletion app/controllers/published_sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
class PublishedSessionsController < ResourceController
# TBD
SERIALIZER_CLASS = 'PublishedSessionSerializer'.freeze
POLICY_CLASS = 'PublishedSessionPolicy'.freeze
#
end
48 changes: 47 additions & 1 deletion app/controllers/reports/program_ops_reports_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,52 @@
class Reports::ProgramOpsReportsController < ApplicationController
around_action :set_timezone

def virtual_people
authorize SessionAssignment, policy_class: Reports::ProgramOpsReportPolicy

moderator = SessionAssignmentRoleType.find_by(name: 'Moderator')
participant = SessionAssignmentRoleType.find_by(name: 'Participant')

assignments = PublishedSessionAssignment
.includes(:person, :session_assignment_role_type, :published_session)
.where("session_assignment_role_type_id in (?)", [moderator.id, participant.id])
.order("people.published_name")

workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("Virtual Participants")

worksheet.append_row(
[
'Published Name',
'Name',
'Is Virtual',
'Primary Email'
]
)

group_assignments = assignments.group_by {|a| a.person}
group_assignments.each do |person, grouped|
row = [
person.published_name,
person.name,
grouped.reduce(false){|res, a| res || (a.published_session.environment == 'virtual')} ? 'Yes' : 'No', # grouped contains virtual
person.primary_email.email
]

person.email_addresses.each do |addr|
next if addr == person.primary_email

row.concat [addr.email]
end

worksheet.append_row(row)
end

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

def back_of_badge
authorize SessionAssignment, policy_class: Reports::ProgramOpsReportPolicy

Expand All @@ -27,7 +73,7 @@ def back_of_badge
row.concat [
assignment.session.title,
assignment.session.start_time ? FastExcel.date_num(assignment.session.start_time, assignment.session.start_time.in_time_zone.utc_offset) : nil,
"#{assignment.session.duration} mins",
"#{assignment.session.duration}m",
assignment.session.room&.name,
]
styles.concat [
Expand Down
Loading

0 comments on commit d01f812

Please sign in to comment.