Skip to content

Commit

Permalink
Fix things I broke in the previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
feliciaan committed May 23, 2017
1 parent 3d3a872 commit 64eb841
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 18 deletions.
8 changes: 4 additions & 4 deletions app/models/club.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ def name
full_name ? full_name : display_name
end

def ordered_clubs
def self.ordered_clubs
# improve speed
zeus = Club.find(:internal_name => 'zeus')
ugent = Club.find(:internal_name => 'ugent')
zeus = Club.where(internal_name: 'zeus').first
ugent = Club.where(internal_name: 'ugent').first

# ordering like it's 1999
clubs = Club.all_except([zeus, ugent]).sort_by {|c| c.internal_name}
clubs = Club.except(zeus.id, ugent.id).sort_by {|c| c.internal_name}
[zeus, ugent] + clubs
end
end
2 changes: 1 addition & 1 deletion app/views/registrations/_basic.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<% end %>
<% if @registration.event.can_add_club%>
<p><%= t('event.registration.club.info')%></p>
<%= form_collection_select f, :club, Club.find_each, :id, :name %>
<%= form_collection_select f, :club_id, Club.ordered_clubs, :id, :name %>
<%end%>
<%= f.submit t('event.register', default: 'Register'), class: 'btn btn-group btn-primary' %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class AddClubToRegistrationAndRegisterClubsToEvent < ActiveRecord::Migration
def change
add_column :events, :can_add_club, :bool
add_column :registrations, :club, :Club
add_column :events, :can_add_club, :boolean
add_reference :registrations, :club
end
end
63 changes: 59 additions & 4 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,37 @@
add_index "enrolled_clubs_members", ["club_id"], name: "index_enrolled_clubs_members_on_club_id"
add_index "enrolled_clubs_members", ["user_id"], name: "index_enrolled_clubs_members_on_user_id"

# Could not dump table "events" because of following NoMethodError
# undefined method `[]' for nil:NilClass
create_table "events", force: :cascade do |t|
t.string "name"
t.datetime "start_date"
t.datetime "end_date"
t.string "location"
t.string "website"
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "registration_open_date"
t.datetime "registration_close_date"
t.string "bank_number"
t.boolean "show_ticket_count", default: true
t.string "contact_email"
t.string "export_file_name"
t.string "export_content_type"
t.integer "export_file_size"
t.datetime "export_updated_at"
t.boolean "show_statistics"
t.string "export_status"
t.integer "club_id"
t.boolean "registration_open", default: true
t.text "signature"
t.boolean "registration_cancelable"
t.string "phone_number_state", default: "optional"
t.boolean "extra_info", default: false
t.string "comment_title"
t.boolean "show_telephone_disclaimer", default: false
t.boolean "allow_plus_one"
t.boolean "can_add_club"
end

create_table "included_zones", force: :cascade do |t|
t.integer "zone_id"
Expand Down Expand Up @@ -140,8 +169,34 @@

add_index "promos", ["event_id"], name: "index_promos_on_event_id"

# Could not dump table "registrations" because of following NoMethodError
# undefined method `[]' for nil:NilClass
create_table "registrations", force: :cascade do |t|
t.string "barcode"
t.string "lastname"
t.string "email"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "event_id"
t.integer "paid"
t.string "student_number"
t.integer "price"
t.datetime "checked_in_at"
t.text "comment"
t.string "barcode_data"
t.string "payment_code"
t.string "phone_number"
t.string "title"
t.string "job_function"
t.string "admin_note"
t.string "firstname"
t.boolean "has_plus_one"
t.string "plus_one_title"
t.string "plus_one_firstname"
t.string "plus_one_lastname"
t.integer "club_id"
end

add_index "registrations", ["event_id"], name: "index_registrations_on_event_id"
add_index "registrations", ["payment_code"], name: "index_registrations_on_payment_code", unique: true

create_table "users", force: :cascade do |t|
t.string "username", default: "", null: false
Expand Down
7 changes: 0 additions & 7 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@
club.save
end

# Zeus peoples
#club = Club.new do |c|
# c.internal_name = 'zeus'
# c.display_name = 'Zeus WPI'
# c.full_name = nil
#end
#club.save

#ugent = Club.new do |c|
# c.internal_name = 'ugent'
Expand Down

0 comments on commit 64eb841

Please sign in to comment.