Skip to content

Commit

Permalink
Merge branch 'master' into edit-rounds-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
jfly authored Sep 17, 2017
2 parents 9bd85b8 + 948d5e7 commit 2810de6
Show file tree
Hide file tree
Showing 14 changed files with 140 additions and 56 deletions.
4 changes: 2 additions & 2 deletions WcaOnRails/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Lint/UnusedBlockArgument:
Lint/UnusedMethodArgument:
Enabled: false

Style/AccessorMethodName:
Naming/AccessorMethodName:
Enabled: false

Style/Alias:
Expand Down Expand Up @@ -173,7 +173,7 @@ Style/WordArray:
Style/SymbolProc:
Enabled: false

Style/PredicateName:
Naming/PredicateName:
Enabled: false

Style/YodaCondition:
Expand Down
4 changes: 2 additions & 2 deletions WcaOnRails/.rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# Offense count: 4
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: snake_case, camelCase
Style/MethodName:
Naming/MethodName:
Exclude:
- 'app/controllers/users_controller.rb'
- 'app/models/light_result.rb'
Expand All @@ -23,7 +23,7 @@ Style/MethodName:
# Offense count: 16
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: snake_case, camelCase
Style/VariableName:
Naming/VariableName:
Enabled: false
###
### End camelCase stuff
Expand Down
12 changes: 6 additions & 6 deletions WcaOnRails/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ GEM
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jquery-slick-rails (1.7.1)
jquery-slick-rails (1.8.0)
railties (>= 3.1)
json (1.8.6)
json-schema (2.8.0)
Expand Down Expand Up @@ -374,7 +374,7 @@ GEM
rainbow (2.2.2)
rake
raindrops (0.19.0)
rake (12.0.0)
rake (12.1.0)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
Expand Down Expand Up @@ -407,17 +407,17 @@ GEM
rspec-mocks (~> 3.6.0)
rspec-support (~> 3.6.0)
rspec-support (3.6.0)
rubocop (0.49.1)
rubocop (0.50.0)
parallel (~> 1.10)
parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
rainbow (>= 2.2.2, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-ll (2.1.2)
ansi
ast
ruby-progressbar (1.8.1)
ruby-progressbar (1.8.3)
ruby_dep (1.5.0)
sass (3.4.25)
sass-rails (5.0.6)
Expand Down Expand Up @@ -461,7 +461,7 @@ GEM
therubyracer (0.12.3)
libv8 (~> 3.16.14.15)
ref
thor (0.19.4)
thor (0.20.0)
thread (0.2.2)
thread_safe (0.3.6)
tilt (2.0.8)
Expand Down
6 changes: 0 additions & 6 deletions WcaOnRails/app/controllers/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,6 @@ def process_payment
rescue Stripe::CardError => e
flash[:danger] = 'Unsuccessful payment: ' + e.message
redirect_to competition_register_path
rescue => e
flash[:danger] = 'Something went wrong: ' + e.message
redirect_to competition_register_path
end

def refund_payment
Expand All @@ -269,9 +266,6 @@ def refund_payment

flash[:success] = 'Payment was refunded'
redirect_to edit_registration_path(registration)
rescue => e
flash[:danger] = 'Something went wrong with the refund: ' + e.message
redirect_to edit_registration_path(registration)
end

def create
Expand Down
2 changes: 1 addition & 1 deletion WcaOnRails/app/controllers/server_status_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def index
raw = File.read(CERTIFICATE_PATH)
certificate = OpenSSL::X509::Certificate.new(raw)
@expires_in = (certificate.not_after.to_date - Time.now.to_date).to_i
rescue
rescue Errno::ENOENT
@expires_in = nil
end
# If we're in test or development, we don't want to go red on the SSL certificate.
Expand Down
2 changes: 1 addition & 1 deletion WcaOnRails/app/helpers/markdown_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def table(header, body)
def postprocess(full_document)
# Support embed Google Maps
full_document.gsub!(/map\(([^)]*)\)/) do
google_maps_url = "https://www.google.com/maps/embed/v1/place?key=#{ENVied.GOOGLE_MAPS_API_KEY}&q=#{URI.escape(CGI.unescapeHTML($1))}"
google_maps_url = "https://www.google.com/maps/embed/v1/place?key=#{ENVied.GOOGLE_MAPS_API_KEY}&q=#{URI.encode_www_form_component(CGI.unescapeHTML($1))}"
"<iframe width='600' height='450' frameborder='0' style='border:0' src=\"#{google_maps_url}\"></iframe>"
end

Expand Down
11 changes: 5 additions & 6 deletions WcaOnRails/app/models/competition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def build_clone
Competition.new(attributes.slice(*CLONEABLE_ATTRIBUTES)).tap do |clone|
clone.being_cloned_from_id = id

Competition.reflections.keys.each do |association_name|
Competition.reflections.each_key do |association_name|
case association_name
when 'registrations',
'results',
Expand Down Expand Up @@ -286,7 +286,6 @@ def build_clone

alias_attribute :latitude_microdegrees, :latitude
alias_attribute :longitude_microdegrees, :longitude
attr_accessor :longitude_degrees, :latitude_degrees
before_validation :compute_coordinates

before_validation :create_id_and_cell_name
Expand Down Expand Up @@ -731,15 +730,15 @@ def organizers_or_delegates

def psych_sheet_event(event, sort_by, sort_by_second)
competition_event = competition_events.find_by!(event_id: event.id)
joinsql = <<-ENDSQL
joinsql = <<-SQL
JOIN registration_competition_events ON registration_competition_events.registration_id = registrations.id
JOIN users ON users.id = registrations.user_id
JOIN Countries ON Countries.iso2 = users.country_iso2
LEFT JOIN RanksSingle ON RanksSingle.personId = users.wca_id AND RanksSingle.eventId = '#{event.id}'
LEFT JOIN RanksAverage ON RanksAverage.personId = users.wca_id AND RanksAverage.eventId = '#{event.id}'
ENDSQL
SQL

selectsql = <<-ENDSQL
selectsql = <<-SQL
registrations.id,
users.name select_name,
users.wca_id select_wca_id,
Expand All @@ -751,7 +750,7 @@ def psych_sheet_event(event, sort_by, sort_by_second)
ifnull(RanksAverage.best, 0) average_best,
RanksSingle.worldRank single_rank,
ifnull(RanksSingle.best, 0) single_best
ENDSQL
SQL

sort_clause = "-#{sort_by}_rank desc, -#{sort_by_second}_rank desc, users.name"

Expand Down
2 changes: 1 addition & 1 deletion WcaOnRails/app/models/delegate_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class DelegateReport < ApplicationRecord

before_create :set_discussion_url
def set_discussion_url
self.discussion_url = "https://groups.google.com/forum/#!topicsearchin/wca-delegates/" + URI.encode(competition.name)
self.discussion_url = "https://groups.google.com/forum/#!topicsearchin/wca-delegates/" + URI.encode_www_form_component(competition.name)
end

before_create :equipment_default
Expand Down
1 change: 0 additions & 1 deletion WcaOnRails/app/models/light_result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class LightResult
:average,
:personName,
:event,
:event,
:format,
:round_type,
:pos,
Expand Down
2 changes: 1 addition & 1 deletion WcaOnRails/app/models/merge_people.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class MergePeople
include ActiveModel::Model

attr_accessor :person1_wca_id, :person2_wca_id
attr_reader :person1_wca_id, :person2_wca_id
attr_reader :person1, :person2

def person1_wca_id=(wca_id)
Expand Down
2 changes: 1 addition & 1 deletion WcaOnRails/app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def cannot_demote_senior_delegate_with_subordinate_delegates
end
end

attr_accessor :claiming_wca_id
attr_reader :claiming_wca_id
def claiming_wca_id=(claiming_wca_id)
@claiming_wca_id = ActiveRecord::Type::Boolean.new.cast(claiming_wca_id)
end
Expand Down
6 changes: 3 additions & 3 deletions WcaOnRails/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2",
"glob": "^7.1.2",
"js-yaml": "^3.9.0",
"js-yaml": "^3.10.0",
"node-sass": "^4.5.3",
"path-complete-extname": "^0.1.0",
"postcss-loader": "^2.0.6",
Expand All @@ -35,11 +35,11 @@
"simplemde": "^1.11.2",
"style-loader": "^0.18.2",
"webpack": "^3.5.6",
"webpack-manifest-plugin": "^1.2.1",
"webpack-manifest-plugin": "^1.3.2",
"webpack-merge": "^4.1.0",
"whatwg-fetch": "^2.0.3"
},
"devDependencies": {
"webpack-dev-server": "^2.7.1"
"webpack-dev-server": "^2.8.2"
}
}
2 changes: 1 addition & 1 deletion WcaOnRails/spec/models/delegate_report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

it "discussion_url is set on creation" do
dr = FactoryGirl.create :delegate_report
expect(dr.discussion_url).to eq "https://groups.google.com/forum/#!topicsearchin/wca-delegates/" + URI.encode(dr.competition.name)
expect(dr.discussion_url).to eq "https://groups.google.com/forum/#!topicsearchin/wca-delegates/" + URI.encode_www_form_component(dr.competition.name)
end

context "can_view_delegate_report?" do
Expand Down
Loading

0 comments on commit 2810de6

Please sign in to comment.