Skip to content

Commit

Permalink
Merge pull request #464 from ChicagoWorldcon/staging
Browse files Browse the repository at this point in the history
1.6.0
  • Loading branch information
Gailbear authored Jul 21, 2022
2 parents 91d3fa0 + 494c00e commit 69350e4
Show file tree
Hide file tree
Showing 82 changed files with 2,062 additions and 279 deletions.
152 changes: 77 additions & 75 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,40 @@ GEM
specs:
aasm (5.2.0)
concurrent-ruby (~> 1.0)
actioncable (6.1.6)
actionpack (= 6.1.6)
activesupport (= 6.1.6)
actioncable (6.1.6.1)
actionpack (= 6.1.6.1)
activesupport (= 6.1.6.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.6)
actionpack (= 6.1.6)
activejob (= 6.1.6)
activerecord (= 6.1.6)
activestorage (= 6.1.6)
activesupport (= 6.1.6)
actionmailbox (6.1.6.1)
actionpack (= 6.1.6.1)
activejob (= 6.1.6.1)
activerecord (= 6.1.6.1)
activestorage (= 6.1.6.1)
activesupport (= 6.1.6.1)
mail (>= 2.7.1)
actionmailer (6.1.6)
actionpack (= 6.1.6)
actionview (= 6.1.6)
activejob (= 6.1.6)
activesupport (= 6.1.6)
actionmailer (6.1.6.1)
actionpack (= 6.1.6.1)
actionview (= 6.1.6.1)
activejob (= 6.1.6.1)
activesupport (= 6.1.6.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.1.6)
actionview (= 6.1.6)
activesupport (= 6.1.6)
actionpack (6.1.6.1)
actionview (= 6.1.6.1)
activesupport (= 6.1.6.1)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.6)
actionpack (= 6.1.6)
activerecord (= 6.1.6)
activestorage (= 6.1.6)
activesupport (= 6.1.6)
actiontext (6.1.6.1)
actionpack (= 6.1.6.1)
activerecord (= 6.1.6.1)
activestorage (= 6.1.6.1)
activesupport (= 6.1.6.1)
nokogiri (>= 1.8.5)
actionview (6.1.6)
activesupport (= 6.1.6)
actionview (6.1.6.1)
activesupport (= 6.1.6.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
Expand All @@ -46,25 +46,25 @@ GEM
activemodel (>= 4.1, < 7.1)
case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
activejob (6.1.6)
activesupport (= 6.1.6)
activejob (6.1.6.1)
activesupport (= 6.1.6.1)
globalid (>= 0.3.6)
activemodel (6.1.6)
activesupport (= 6.1.6)
activerecord (6.1.6)
activemodel (= 6.1.6)
activesupport (= 6.1.6)
activemodel (6.1.6.1)
activesupport (= 6.1.6.1)
activerecord (6.1.6.1)
activemodel (= 6.1.6.1)
activesupport (= 6.1.6.1)
activerecord-postgres_enum (2.0.1)
activerecord (>= 5.2)
pg
activestorage (6.1.6)
actionpack (= 6.1.6)
activejob (= 6.1.6)
activerecord (= 6.1.6)
activesupport (= 6.1.6)
activestorage (6.1.6.1)
actionpack (= 6.1.6.1)
activejob (= 6.1.6.1)
activerecord (= 6.1.6.1)
activesupport (= 6.1.6.1)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.6)
activesupport (6.1.6.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand Down Expand Up @@ -151,12 +151,13 @@ GEM
guard-compat (~> 1.0)
multi_json (~> 1.8)
http_parser.rb (0.8.0)
i18n (1.10.0)
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)
jsonapi-renderer (0.2.2)
jsonapi-serializer (2.2.0)
activesupport (>= 4.2)
Expand Down Expand Up @@ -189,20 +190,20 @@ GEM
method_source (1.0.0)
mini_mime (1.1.2)
mini_portile2 (2.8.0)
minitest (5.15.0)
msgpack (1.5.2)
minitest (5.16.2)
msgpack (1.5.3)
multi_json (1.15.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.6)
nokogiri (1.13.7)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
nokogiri (1.13.6-x86_64-darwin)
nokogiri (1.13.7-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.13.6-x86_64-linux)
nokogiri (1.13.7-x86_64-linux)
racc (~> 1.4)
notiffany (0.1.3)
nenv (~> 0.1)
Expand All @@ -214,7 +215,7 @@ GEM
parallel (1.22.1)
parser (3.1.2.0)
ast (~> 2.4.1)
pg (1.3.5)
pg (1.4.1)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
Expand All @@ -225,38 +226,38 @@ GEM
activesupport (>= 3.0.0)
raabro (1.4.0)
racc (1.6.0)
rack (2.2.3.1)
rack (2.2.4)
rack-cors (1.1.1)
rack (>= 2.0.0)
rack-livereload (0.3.17)
rack
rack-proxy (0.7.2)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.1.6)
actioncable (= 6.1.6)
actionmailbox (= 6.1.6)
actionmailer (= 6.1.6)
actionpack (= 6.1.6)
actiontext (= 6.1.6)
actionview (= 6.1.6)
activejob (= 6.1.6)
activemodel (= 6.1.6)
activerecord (= 6.1.6)
activestorage (= 6.1.6)
activesupport (= 6.1.6)
rack-test (2.0.2)
rack (>= 1.3)
rails (6.1.6.1)
actioncable (= 6.1.6.1)
actionmailbox (= 6.1.6.1)
actionmailer (= 6.1.6.1)
actionpack (= 6.1.6.1)
actiontext (= 6.1.6.1)
actionview (= 6.1.6.1)
activejob (= 6.1.6.1)
activemodel (= 6.1.6.1)
activerecord (= 6.1.6.1)
activestorage (= 6.1.6.1)
activesupport (= 6.1.6.1)
bundler (>= 1.15.0)
railties (= 6.1.6)
railties (= 6.1.6.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.2)
rails-html-sanitizer (1.4.3)
loofah (~> 2.3)
railties (6.1.6)
actionpack (= 6.1.6)
activesupport (= 6.1.6)
railties (6.1.6.1)
actionpack (= 6.1.6.1)
activesupport (= 6.1.6.1)
method_source
rake (>= 12.2)
thor (~> 1.0)
Expand All @@ -271,7 +272,7 @@ GEM
rb-fsevent (0.11.1)
rb-inotify (0.10.1)
ffi (~> 1.0)
redis (4.6.0)
redis (4.7.1)
regexp_parser (2.5.0)
request_store (1.5.1)
rack (>= 1.4)
Expand Down Expand Up @@ -303,7 +304,8 @@ GEM
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (3.11.0)
rubocop (1.30.0)
rubocop (1.31.2)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0)
Expand All @@ -312,13 +314,13 @@ GEM
rubocop-ast (>= 1.18.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.18.0)
rubocop-ast (1.19.1)
parser (>= 3.1.1.0)
ruby-progressbar (1.11.0)
ruby_audit (2.1.0)
bundler-audit (~> 0.9.0)
rubyzip (2.3.2)
rufus-scheduler (3.8.1)
rufus-scheduler (3.8.2)
fugit (~> 1.1, >= 1.1.6)
sass-rails (6.0.0)
sassc-rails (~> 2.1, >= 2.1.1)
Expand All @@ -332,18 +334,18 @@ GEM
tilt
seedbank (0.5.0)
rake (>= 10.0)
selenium-webdriver (4.2.0)
selenium-webdriver (4.3.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.4.2)
sidekiq (6.5.1)
connection_pool (>= 2.2.2)
rack (~> 2.0)
redis (>= 4.2.0)
sidekiq-scheduler (4.0.0)
sidekiq-scheduler (4.0.2)
redis (>= 4.2.0)
rufus-scheduler (~> 3.2)
sidekiq (>= 4)
Expand All @@ -354,7 +356,7 @@ GEM
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (4.0.3)
sprockets (4.1.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.4.2)
Expand All @@ -363,14 +365,14 @@ GEM
sprockets (>= 3.0.0)
thor (1.2.1)
tilt (2.0.10)
truemail (2.7.2)
truemail (2.7.3)
simpleidn (~> 0.2.1)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (2.1.0)
unicode-display_width (2.2.0)
warden (1.2.9)
rack (>= 2.0.9)
web-console (4.2.0)
Expand All @@ -395,7 +397,7 @@ GEM
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.5.4)
zeitwerk (2.6.0)

PLATFORMS
ruby
Expand Down
8 changes: 7 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ApplicationController < ActionController::Base
# before_action :remove_cookies_action

# Secure the application
before_action :authenticate_person!
before_action :check_up, :authenticate_person!

# based on current_user
before_action :set_paper_trail_whodunnit
Expand All @@ -30,6 +30,12 @@ def application_time_zone(&block)
Time.use_zone(app_time_zone, &block)
end

def check_up
if ScheduleSnapshot.where("status = 'in_progress'").count > 0
redirect_to '/maintenance.html', status: 503
end
end

def prevent_cache
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0"
response.headers["Pragma"] = "no-cache"
Expand Down
12 changes: 8 additions & 4 deletions app/controllers/concerns/resource_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,14 @@ def query_part(filter:)
# change to allowd limiting to named cols?, pass in list of cols to include based in what is displayed ...
model_class.columns.each do |col|
next unless [:text, :string].include?(col.type)
query_part = get_query_part(table: col_table, column: col.name, operation: 'like', value: value)
query_part = get_query_part(table: col_table, column: col.name, operation: 'like', value: value, key: key)
part = part ? part.or(query_part) : query_part
end
# This for survey submissions ....
if model_class == Survey::Submission
Survey::Response.columns.each do |col|
next unless [:text, :string].include?(col.type)
query_part = get_query_part(table: Arel::Table.new('survey_responses'), column: col.name, operation: 'like', value: value)
query_part = get_query_part(table: Arel::Table.new('survey_responses'), column: col.name, operation: 'like', value: value, key: key)
part = part ? part.or(query_part) : query_part
end
end
Expand All @@ -320,7 +320,7 @@ def query_part(filter:)
if array_col?(col_name: col)
col_table = array_table(col_name: col)
end
part = get_query_part(table: col_table, column: col, operation: operation, value: value, top: true)
part = get_query_part(table: col_table, column: col, operation: operation, value: value, top: true, key: key)

if (key.include?('responses.'))
key.slice! "responses."
Expand Down Expand Up @@ -365,7 +365,7 @@ def get_column(column:)
return col
end

def get_query_part(table:, column:, operation:, value:, top: false)
def get_query_part(table:, column:, operation:, value:, top: false, key: nil)
op = translate_operator(operation: operation)

return nil if value.kind_of?(String) && value.blank?
Expand All @@ -380,6 +380,10 @@ def get_query_part(table:, column:, operation:, value:, top: false)
::Arel.sql("(cardinality(#{table}.#{column}) = 0)")
when 'is not empty'
::Arel.sql("(cardinality(#{table}.#{column}) > 0)")
when 'is only'
::Arel.sql("('#{value}' = ALL(#{table}.#{column}) AND cardinality(#{table}.#{column}) != 0)")
when 'is not only'
::Arel.sql("('#{value}' = ANY(#{table}.#{column}) AND cardinality(#{table}.#{column}) > 1)")
end

# This is crappy, but I do not see a way round it. If the first query part is a array literal one
Expand Down
Loading

0 comments on commit 69350e4

Please sign in to comment.