Skip to content

Commit

Permalink
Merge pull request #329 from snap-cloud/ruby-3.2.2
Browse files Browse the repository at this point in the history
Lots of Little Updates
  • Loading branch information
cycomachead authored Jul 17, 2023
2 parents 52a03c9 + 839adb9 commit 1d13597
Show file tree
Hide file tree
Showing 19 changed files with 85 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/next-rails.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
echo "BUNDLE_CACHE_PATH=vendor/cache.next" >> $GITHUB_ENV
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.3
ruby-version: 3.2.2
bundler-cache: true
- name: Prepare spec
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.3
ruby-version: 3.2.2
bundler-cache: true
# - name: Run Pronto
# run: bundle exec pronto run
Expand All @@ -37,7 +37,7 @@ jobs:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.3
ruby-version: 3.2.2
bundler-cache: true
- name: Use Node.js
uses: actions/setup-node@v1
Expand Down
2 changes: 2 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Metrics/AbcSize:
# IgnoredMethods: refine
Metrics/BlockLength:
Max: 226
Exclude:
- 'config/routes.rb'

# Offense count: 14
# Configuration parameters: CountComments, CountAsOne.
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.3
3.2.2
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ruby 3.1.3
ruby 3.2.2
nodejs latest:12
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ end

source 'https://rubygems.org'

ruby ENV.fetch('OSEM_RUBY_VERSION', '3.1.3')
ruby ENV.fetch('OSEM_RUBY_VERSION', '3.2.2')

# rails-assets requires >= 1.8.4
abort 'Bundler version >= 1.8.4 is required' if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('1.8.4')
Expand Down Expand Up @@ -290,8 +290,8 @@ end
group :development, :test, :linters do
# as debugger
gem 'byebug'
gem 'pry'
gem 'pry-byebug'
# gem 'pry'
# gem 'pry-byebug'

# Linters and static analysis.
gem 'faraday-retry', require: false
Expand Down
33 changes: 14 additions & 19 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ GEM
awesome_nested_set (>= 3.0)
acts_as_list (1.0.4)
activerecord (>= 4.2)
addressable (2.8.1)
addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0)
afm (0.2.2)
ajax-datatables-rails (1.3.1)
Expand Down Expand Up @@ -141,7 +141,7 @@ GEM
uniform_notifier (~> 1.11)
byebug (11.1.3)
cancancan (3.3.0)
capybara (3.37.1)
capybara (3.39.2)
addressable
matrix
mini_mime (>= 0.1.3)
Expand Down Expand Up @@ -427,12 +427,12 @@ GEM
netrc (0.11.0)
next_rails (1.1.0)
colorize (>= 0.8.1)
nio4r (2.5.8)
nokogiri (1.14.3-arm64-darwin)
nio4r (2.5.9)
nokogiri (1.15.3-arm64-darwin)
racc (~> 1.4)
nokogiri (1.14.3-x86_64-darwin)
nokogiri (1.15.3-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.14.3-x86_64-linux)
nokogiri (1.15.3-x86_64-linux)
racc (~> 1.4)
notiffany (0.1.3)
nenv (~> 0.1)
Expand Down Expand Up @@ -517,20 +517,17 @@ GEM
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
public_suffix (5.0.1)
puma (5.6.4)
public_suffix (5.0.3)
puma (6.3.0)
nio4r (~> 2.0)
racc (1.6.2)
rack (2.2.6.4)
racc (1.7.1)
rack (2.2.7)
rack-openid (1.4.2)
rack (>= 1.1.0)
ruby-openid (>= 2.1.8)
rack-protection (2.2.0)
rack
rack-test (2.0.2)
rack-test (2.1.0)
rack (>= 1.3)
rails (7.0.4.2)
actioncable (= 7.0.4.2)
Expand Down Expand Up @@ -574,7 +571,7 @@ GEM
json
redcarpet (3.5.1)
redis (4.7.1)
regexp_parser (2.5.0)
regexp_parser (2.8.1)
request_store (1.5.1)
rack (>= 1.4)
responders (3.0.1)
Expand Down Expand Up @@ -752,7 +749,7 @@ GEM
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.7.0)
webrick (1.8.1)
websocket (1.2.9)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
Expand Down Expand Up @@ -844,8 +841,6 @@ DEPENDENCIES
pronto
pronto-haml
pronto-rubocop
pry
pry-byebug
puma
rails (~> 7.0)
rails-assets-bootstrap!
Expand Down Expand Up @@ -900,7 +895,7 @@ DEPENDENCIES
whenever

RUBY VERSION
ruby 3.1.3
ruby 3.2.2

BUNDLED WITH
2.3.26
2 changes: 1 addition & 1 deletion Gemfile.next.lock
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ DEPENDENCIES
whenever

RUBY VERSION
ruby 3.1.3p185
ruby 3.2.2p185

BUNDLED WITH
2.3.26
10 changes: 8 additions & 2 deletions app/controllers/admin/ticket_scannings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@ module Admin
class TicketScanningsController < Admin::BaseController
before_action :authenticate_user!
load_resource :physical_ticket, find_by: :token
# We authorize manually in these actions
skip_authorize_resource only: [:create]

def create
if !@physical_ticket && params[:physical_ticket]
@physical_ticket = PhysicalTicket.find_by(token: params[:physical_ticket][:token])
end
@ticket_scanning = TicketScanning.new(physical_ticket: @physical_ticket)
authorize! :create, @ticket_scanning
@ticket_scanning.save
redirect_to conferences_path,
dest_path = conferences_path
if request.referer&.match?(%r{admin/conferences})
dest_path = admin_conference_physical_tickets_path(@conference)
end
redirect_to dest_path,
notice: "Ticket with token #{@physical_ticket.token} successfully scanned."
end
end
Expand Down
8 changes: 8 additions & 0 deletions app/controllers/ticket_purchases_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ def index
@unpaid_ticket_purchases = current_user.ticket_purchases.by_conference(@conference).unpaid
end

def destroy
@ticket_purchase = TicketPurchase.find(params[:id])
authorize! :delete, @ticket_purchase
@ticket_purchase.delete
redirect_to admin_conference_ticket_path(@conference, @ticket_purchase.ticket.id),
notice: "Ticket for user #{@ticket_purchase.user.name} successfully removed."
end

private

def ticket_purchase_params
Expand Down
8 changes: 8 additions & 0 deletions app/helpers/date_time_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,17 @@ def length_timestamp(length)
def format_datetime(obj)
return unless obj

obj = DateTime.parse(obj) unless obj.respond_to?(:strftime)

obj.strftime('%Y-%m-%d %H:%M')
end

def format_all_timestamps(lst, conference)
lst.map do |ts|
"#{format_datetime(ts.in_time_zone(conference.timezone))} #{timezone_text(conference)}"
end.to_sentence
end

def show_time(length)
return '0 h 0 min' if length.blank?

Expand Down
2 changes: 1 addition & 1 deletion app/models/conference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ def get_events_per_week_by_state
next unless %i[confirmed unconfirmed].include?(state)

result[state.to_s.capitalize] = {} unless result[state.to_s.capitalize]
result[state.to_s.capitalize][week.strftime('%W').to_i] = value
result[state.to_s.capitalize][DateTime.parse(week).strftime('%W').to_i] = value
end
end

Expand Down
13 changes: 11 additions & 2 deletions app/views/admin/physical_tickets/_physical_ticket.html.haml
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
%tr
%td= physical_ticket.id
%td= physical_ticket.ticket.title
%td= physical_ticket.user.email
%td= physical_ticket.ticket.registration_ticket? ? 'Yes' : 'No'
%td= physical_ticket.user&.email
%td= humanized_money_with_symbol physical_ticket.ticket_purchase.amount_paid
%td
- if physical_ticket.ticket_scannings.present?
%span Checked in:
%br
= format_all_timestamps(physical_ticket.ticket_scannings.pluck(:created_at), conference)
= form_for(physical_ticket, url: admin_ticket_scanning_path, method: :post) do |f|
= f.hidden_field 'token'
= f.submit "Mark Present", { class: 'btn btn-success' }
%td
.btn-group
= link_to 'Show',
Expand All @@ -13,4 +22,4 @@
conference_physical_ticket_path(conference.short_title,
physical_ticket.token,
format: :pdf),
class: 'button btn btn-default btn-info'
class: 'button btn btn-info'
2 changes: 2 additions & 0 deletions app/views/admin/physical_tickets/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
%thead
%th ID
%th Type
%th Registration?
%th User
%th Paid
%th Attedance
%th Actions
%tbody
- @physical_tickets.each do |physical_ticket|
Expand Down
6 changes: 6 additions & 0 deletions app/views/admin/tickets/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
%th Affiliation
%th Paid
%th Date
%th
%span.sr-only Delete
%tbody
- @ticket.buyers.each_with_index do |buyer, index|
- purchases = buyer.ticket_purchases.where(ticket_id: @ticket.id)
Expand All @@ -45,6 +48,9 @@
= @ticket.tickets_paid(buyer)
%td
= purchases.first.created_at
%td
- if purchases.length == 1
= button_to("Delete", conference_ticket_purchase_path(@conference, purchases.first.id), method: :delete, data: {confirm: "Are you sure?"}, class: 'btn btn-danger btn-sm')

- content_for :modals do
.modal.fade{ id: "modal-give-ticket-#{@ticket.id}" }
Expand Down
4 changes: 4 additions & 0 deletions app/views/layouts/_admin_sidebar.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@
- if can? :update, @conference.tickets.build
%li{class: active_nav_li(admin_conference_tickets_path(@conference.short_title)) }
= link_to 'Tickets', admin_conference_tickets_path(@conference.short_title)
- if can? :update, @conference.tickets.build
%li{class: active_nav_li(admin_conference_physical_tickets_path(@conference.short_title)) }
= link_to 'Ticket Purchases', admin_conference_physical_tickets_path(@conference.short_title)

- if can? :manage, @conference.booths.build
%li
= link_to admin_conference_booths_path(@conference.short_title) do
Expand Down
6 changes: 6 additions & 0 deletions app/views/proposals/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@
.col-md-12
%dt Type:
%dd= @event.event_type&.title
- if @event.presentation_mode
.col-md-12
%dt Presented via:
%dd
%span.fa-solid.fa-person-chalkboard
= @event.presentation_mode.humanize
- if @event.track
.col-md-12
%dt Track:
Expand Down
5 changes: 5 additions & 0 deletions app/views/schedules/_event.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
%span.fa-solid.fa-road
.label{ style: css_background_color(event.track.color) }
= event.track.name
- if event.presentation_mode
-# TODO: Use fa-podium pro icon
%span.fa-solid.fa-person-chalkboard
.label.label-info
= event.presentation_mode.humanize
- if event.superevent && event.subevents.present?
%br
%br
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
post :give
end
end
resources :physical_tickets, only: %i[delete]
resources :sponsors, except: [:show]
resources :lodgings, except: [:show]
resources :emails, only: %i[show update index]
Expand Down

0 comments on commit 1d13597

Please sign in to comment.