From 2cad596494fed338f45b3ffd9c078dde728050cb Mon Sep 17 00:00:00 2001 From: Christian Flach Date: Sat, 2 Jun 2018 10:24:57 +0200 Subject: [PATCH 1/5] Better translation for welcome message --- config/locales/de.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/de.yml b/config/locales/de.yml index 4d13b970..8b849bb7 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -47,7 +47,7 @@ de: remember_me: "Eingeloggt bleiben" midnight: "Mitternacht" start_page: - welcome_to: "Herzlich Willkommen im" + welcome_to: "Herzlich Willkommen beim" workshop_portal_hpi_html: "Workshop
Portal des HPI." register_now: "Registrieren" place_request: "Anfrage stellen" From ad488efefbb21a6cfdf8ab5321225d1ee8a85bae Mon Sep 17 00:00:00 2001 From: Christian Flach Date: Sat, 2 Jun 2018 10:37:56 +0200 Subject: [PATCH 2/5] Let Rails auto-update docblocks --- Gemfile.lock | 13 +- app/models/agreement_letter.rb | 4 +- app/models/application_letter.rb | 20 +-- app/models/application_note.rb | 2 +- app/models/date_range.rb | 4 +- app/models/email_template.rb | 4 +- app/models/event.rb | 20 +-- app/models/participant_group.rb | 4 +- app/models/profile.rb | 18 +-- app/models/request.rb | 26 ++-- app/models/user.rb | 18 +-- db/schema.rb | 208 +++++++++++-------------- lib/tasks/auto_annotate_models.rake | 76 ++++----- spec/factories/agreement_letters.rb | 18 ++- spec/factories/application_letters.rb | 28 +++- spec/factories/application_notes.rb | 15 ++ spec/factories/date_ranges.rb | 17 +- spec/factories/email_templates.rb | 11 +- spec/factories/events.rb | 25 +-- spec/factories/participant_groups.rb | 15 ++ spec/factories/profiles.rb | 22 ++- spec/factories/requests.rb | 27 ++-- spec/factories/users.rb | 21 ++- spec/models/agreement_letter_spec.rb | 17 ++ spec/models/application_letter_spec.rb | 26 +++- spec/models/application_note_spec.rb | 15 ++ spec/models/date_range_spec.rb | 16 ++ spec/models/email_template_spec.rb | 10 +- spec/models/event_spec.rb | 23 ++- spec/models/participant_group_spec.rb | 15 ++ spec/models/profile_spec.rb | 22 ++- spec/models/request_spec.rb | 26 ++-- spec/models/user_spec.rb | 21 ++- 33 files changed, 493 insertions(+), 314 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index db790040..9f57bfcb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -57,7 +57,7 @@ GEM airbrake-ruby (~> 2.3, >= 2.3.1) airbrake-ruby (2.3.2) american_date (1.1.1) - annotate (2.7.2) + annotate (2.7.3) activerecord (>= 3.2, < 6.0) rake (>= 10.4, < 13.0) arel (8.0.0) @@ -129,7 +129,8 @@ GEM activesupport (>= 4.1, < 5.2) hashery (2.1.2) hashie (3.5.6) - i18n (0.8.6) + i18n (0.9.5) + concurrent-ruby (~> 1.0) icalendar (2.4.1) jquery-rails (4.3.1) rails-dom-testing (>= 1, < 3) @@ -160,7 +161,7 @@ GEM mini_magick (4.8.0) mini_mime (0.1.4) mini_portile2 (2.2.0) - minitest (5.10.3) + minitest (5.11.3) nio4r (2.1.0) nokogiri (1.8.0) mini_portile2 (~> 2.2.0) @@ -241,7 +242,7 @@ GEM thor (>= 0.18.1, < 2.0) rainbow (2.2.2) rake - rake (12.0.0) + rake (12.3.1) redcarpet (3.4.0) ref (2.0.0) responders (2.4.0) @@ -314,7 +315,7 @@ GEM execjs (>= 2.2.2, >= 2.2) less-rails (>= 2.5.0) railties (>= 3.1) - tzinfo (1.2.3) + tzinfo (1.2.5) thread_safe (~> 0.1) unicode-display_width (1.3.0) warden (1.2.7) @@ -399,4 +400,4 @@ RUBY VERSION ruby 2.2.2p95 BUNDLED WITH - 1.14.6 + 1.16.2 diff --git a/app/models/agreement_letter.rb b/app/models/agreement_letter.rb index 60723b2e..fdaab1eb 100644 --- a/app/models/agreement_letter.rb +++ b/app/models/agreement_letter.rb @@ -3,11 +3,11 @@ # Table name: agreement_letters # # id :integer not null, primary key -# user_id :integer not null -# event_id :integer not null # path :string not null # created_at :datetime not null # updated_at :datetime not null +# event_id :integer not null +# user_id :integer not null # # Indexes # diff --git a/app/models/application_letter.rb b/app/models/application_letter.rb index eae843d8..44b923d3 100644 --- a/app/models/application_letter.rb +++ b/app/models/application_letter.rb @@ -3,20 +3,20 @@ # Table name: application_letters # # id :integer not null, primary key -# motivation :string -# user_id :integer not null -# event_id :integer not null -# created_at :datetime not null -# updated_at :datetime not null -# status :integer default(2), not null -# emergency_number :string -# vegetarian :boolean -# vegan :boolean # allergies :string -# custom_application_fields :text # annotation :text +# custom_application_fields :text +# emergency_number :string +# motivation :string # organisation :string +# status :integer default("pending"), not null # status_notification_sent :boolean default(FALSE), not null +# vegan :boolean +# vegetarian :boolean +# created_at :datetime not null +# updated_at :datetime not null +# event_id :integer not null +# user_id :integer not null # # Indexes # diff --git a/app/models/application_note.rb b/app/models/application_note.rb index a774ed78..c04532e2 100644 --- a/app/models/application_note.rb +++ b/app/models/application_note.rb @@ -4,9 +4,9 @@ # # id :integer not null, primary key # note :text -# application_letter_id :integer # created_at :datetime not null # updated_at :datetime not null +# application_letter_id :integer # # Indexes # diff --git a/app/models/date_range.rb b/app/models/date_range.rb index fe39736b..e4c1008a 100644 --- a/app/models/date_range.rb +++ b/app/models/date_range.rb @@ -3,11 +3,11 @@ # Table name: date_ranges # # id :integer not null, primary key -# start_date :date # end_date :date -# event_id :integer +# start_date :date # created_at :datetime # updated_at :datetime +# event_id :integer # # Indexes # diff --git a/app/models/email_template.rb b/app/models/email_template.rb index 446f58ba..874ce748 100644 --- a/app/models/email_template.rb +++ b/app/models/email_template.rb @@ -3,10 +3,10 @@ # Table name: email_templates # # id :integer not null, primary key -# status :integer -# subject :string # content :text # hide_recipients :boolean +# status :integer +# subject :string # class EmailTemplate < ActiveRecord::Base diff --git a/app/models/event.rb b/app/models/event.rb index d692823e..29af2a16 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -3,21 +3,21 @@ # Table name: events # # id :integer not null, primary key -# name :string -# description :text -# max_participants :integer -# created_at :datetime not null -# updated_at :datetime not null -# published :boolean default(FALSE) -# organizer :string -# knowledge_level :string +# acceptances_have_been_sent :boolean default(FALSE) # application_deadline :date # custom_application_fields :text +# custom_image :string +# description :text # hidden :boolean default(FALSE) # image :string +# knowledge_level :string +# max_participants :integer +# name :string +# organizer :string +# published :boolean default(FALSE) # rejections_have_been_sent :boolean default(FALSE) -# acceptances_have_been_sent :boolean default(FALSE) -# custom_image :string +# created_at :datetime not null +# updated_at :datetime not null # class Event < ActiveRecord::Base diff --git a/app/models/participant_group.rb b/app/models/participant_group.rb index f76e928a..7aeec66f 100644 --- a/app/models/participant_group.rb +++ b/app/models/participant_group.rb @@ -3,9 +3,9 @@ # Table name: participant_groups # # id :integer not null, primary key -# user_id :integer -# event_id :integer # group :integer not null +# event_id :integer +# user_id :integer # # Indexes # diff --git a/app/models/profile.rb b/app/models/profile.rb index 5d013e8d..1f6426f9 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -3,19 +3,19 @@ # Table name: profiles # # id :integer not null, primary key -# user_id :integer not null -# created_at :datetime not null -# updated_at :datetime not null -# first_name :string -# last_name :string -# gender :string # birth_date :date -# street_name :string -# zip_code :string # city :string -# state :string # country :string # discovery_of_site :text +# first_name :string +# gender :string +# last_name :string +# state :string +# street_name :string +# zip_code :string +# created_at :datetime not null +# updated_at :datetime not null +# user_id :integer not null # # Indexes # diff --git a/app/models/request.rb b/app/models/request.rb index 4888804b..61f75975 100644 --- a/app/models/request.rb +++ b/app/models/request.rb @@ -3,24 +3,24 @@ # Table name: requests # # id :integer not null, primary key -# created_at :datetime not null -# updated_at :datetime not null -# form_of_address :integer +# annotations :text +# contact_person :string +# email :string # first_name :string +# form_of_address :integer +# grade :string +# knowledge_level :string # last_name :string +# notes :text +# number_of_participants :integer # phone_number :string # school_street :string -# email :string -# topic_of_workshop :text -# time_period :text -# number_of_participants :integer -# knowledge_level :string -# annotations :text -# status :integer default(0) # school_zip_code_city :string -# contact_person :string -# notes :text -# grade :string +# status :integer default("open") +# time_period :text +# topic_of_workshop :text +# created_at :datetime not null +# updated_at :datetime not null # class Request < ActiveRecord::Base diff --git a/app/models/user.rb b/app/models/user.rb index 92f67628..ea4b0b26 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -3,21 +3,21 @@ # Table name: users # # id :integer not null, primary key +# current_sign_in_at :datetime +# current_sign_in_ip :string # email :string default(""), not null # encrypted_password :string default(""), not null -# reset_password_token :string -# reset_password_sent_at :datetime -# remember_created_at :datetime -# sign_in_count :integer default(0), not null -# current_sign_in_at :datetime # last_sign_in_at :datetime -# current_sign_in_ip :string # last_sign_in_ip :string -# created_at :datetime not null -# updated_at :datetime not null -# role :string # provider :string +# remember_created_at :datetime +# reset_password_sent_at :datetime +# reset_password_token :string +# role :string +# sign_in_count :integer default(0), not null # uid :string +# created_at :datetime not null +# updated_at :datetime not null # # Indexes # diff --git a/db/schema.rb b/db/schema.rb index 11166f5c..647d2bab 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -14,157 +13,140 @@ ActiveRecord::Schema.define(version: 20180423170641) do create_table "agreement_letters", force: :cascade do |t| - t.integer "user_id", null: false - t.integer "event_id", null: false - t.string "path", null: false + t.integer "user_id", null: false + t.integer "event_id", null: false + t.string "path", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["event_id"], name: "index_agreement_letters_on_event_id" + t.index ["user_id"], name: "index_agreement_letters_on_user_id" end - add_index "agreement_letters", ["event_id"], name: "index_agreement_letters_on_event_id" - add_index "agreement_letters", ["user_id"], name: "index_agreement_letters_on_user_id" - create_table "application_letters", force: :cascade do |t| - t.string "motivation" - t.integer "user_id", null: false - t.integer "event_id", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "status", default: 2, null: false - t.string "emergency_number" - t.boolean "vegetarian" - t.boolean "vegan" - t.string "allergies" - t.text "custom_application_fields" - t.text "annotation" - t.string "organisation" - t.boolean "status_notification_sent", default: false, null: false + t.string "motivation" + t.integer "user_id", null: false + t.integer "event_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "status", default: 2, null: false + t.string "emergency_number" + t.boolean "vegetarian" + t.boolean "vegan" + t.string "allergies" + t.text "custom_application_fields" + t.text "annotation" + t.string "organisation" + t.boolean "status_notification_sent", default: false, null: false + t.index ["event_id"], name: "index_application_letters_on_event_id" + t.index ["user_id"], name: "index_application_letters_on_user_id" end - add_index "application_letters", ["event_id"], name: "index_application_letters_on_event_id" - add_index "application_letters", ["user_id"], name: "index_application_letters_on_user_id" - create_table "application_notes", force: :cascade do |t| - t.text "note" - t.integer "application_letter_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.text "note" + t.integer "application_letter_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["application_letter_id"], name: "index_application_notes_on_application_letter_id" end - add_index "application_notes", ["application_letter_id"], name: "index_application_notes_on_application_letter_id" - create_table "date_ranges", force: :cascade do |t| - t.date "start_date" - t.date "end_date" - t.integer "event_id" + t.date "start_date" + t.date "end_date" + t.integer "event_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["event_id"], name: "index_date_ranges_on_event_id" end - add_index "date_ranges", ["event_id"], name: "index_date_ranges_on_event_id" - create_table "email_templates", force: :cascade do |t| t.integer "status" - t.string "subject" - t.text "content" + t.string "subject" + t.text "content" t.boolean "hide_recipients" end - create_table "emails", force: :cascade do |t| - t.boolean "hide_recipients" - t.string "recipients" - t.string "reply_to" - t.string "subject" - t.string "content" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - create_table "events", force: :cascade do |t| - t.string "name" - t.text "description" - t.integer "max_participants" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "published", default: false - t.string "organizer" - t.string "knowledge_level" - t.date "application_deadline" - t.text "custom_application_fields" - t.boolean "hidden", default: false - t.boolean "rejections_have_been_sent", default: false - t.boolean "acceptances_have_been_sent", default: false - t.string "image" - t.string "custom_image" + t.string "name" + t.text "description" + t.integer "max_participants" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "published", default: false + t.string "organizer" + t.string "knowledge_level" + t.date "application_deadline" + t.text "custom_application_fields" + t.boolean "hidden", default: false + t.string "image" + t.boolean "rejections_have_been_sent", default: false + t.boolean "acceptances_have_been_sent", default: false + t.string "custom_image" end create_table "participant_groups", force: :cascade do |t| t.integer "user_id" t.integer "event_id" - t.integer "group", null: false + t.integer "group", null: false + t.index ["event_id"], name: "index_participant_groups_on_event_id" + t.index ["user_id"], name: "index_participant_groups_on_user_id" end - add_index "participant_groups", ["event_id"], name: "index_participant_groups_on_event_id" - add_index "participant_groups", ["user_id"], name: "index_participant_groups_on_user_id" - create_table "profiles", force: :cascade do |t| - t.integer "user_id", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "first_name" - t.string "last_name" - t.string "gender" - t.date "birth_date" - t.string "street_name" - t.string "zip_code" - t.string "city" - t.string "state" - t.string "country" - t.text "discovery_of_site" + t.integer "user_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "first_name" + t.string "last_name" + t.string "gender" + t.date "birth_date" + t.string "street_name" + t.string "zip_code" + t.string "city" + t.string "state" + t.string "country" + t.text "discovery_of_site" + t.index ["user_id"], name: "index_profiles_on_user_id" end - add_index "profiles", ["user_id"], name: "index_profiles_on_user_id" - create_table "requests", force: :cascade do |t| - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "form_of_address" - t.string "first_name" - t.string "last_name" - t.string "phone_number" - t.string "school_street" - t.string "email" - t.text "topic_of_workshop" - t.text "time_period" - t.integer "number_of_participants" - t.string "knowledge_level" - t.text "annotations" - t.integer "status", default: 0 - t.string "school_zip_code_city" - t.string "contact_person" - t.text "notes" - t.string "grade" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "form_of_address" + t.string "first_name" + t.string "last_name" + t.string "phone_number" + t.string "school_street" + t.string "email" + t.text "topic_of_workshop" + t.text "time_period" + t.integer "number_of_participants" + t.string "knowledge_level" + t.text "annotations" + t.integer "status", default: 0 + t.string "school_zip_code_city" + t.string "contact_person" + t.text "notes" + t.string "grade" end create_table "users", force: :cascade do |t| - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false - t.string "reset_password_token" + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0, null: false + t.integer "sign_in_count", default: 0, null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" - t.string "current_sign_in_ip" - t.string "last_sign_in_ip" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "role" - t.string "provider" - t.string "uid" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "role" + t.string "provider" + t.string "uid" + t.index ["email"], name: "index_users_on_email", unique: true + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true end - add_index "users", ["email"], name: "index_users_on_email", unique: true - add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true - end diff --git a/lib/tasks/auto_annotate_models.rake b/lib/tasks/auto_annotate_models.rake index 0df6b27e..edb0a0da 100644 --- a/lib/tasks/auto_annotate_models.rake +++ b/lib/tasks/auto_annotate_models.rake @@ -2,45 +2,51 @@ # NOTE: are sensitive to local FS writes, and besides -- it's just not proper # NOTE: to have a dev-mode tool do its thing in production. if Rails.env.development? + require 'annotate' task :set_annotation_options do # You can override any of these by setting an environment variable of the # same name. Annotate.set_defaults( - 'routes' => 'false', - 'position_in_routes' => 'before', - 'position_in_class' => 'before', - 'position_in_test' => 'before', - 'position_in_fixture' => 'before', - 'position_in_factory' => 'before', - 'position_in_serializer' => 'before', - 'show_foreign_keys' => 'true', - 'show_indexes' => 'true', - 'simple_indexes' => 'false', - 'model_dir' => 'app/models', - 'root_dir' => '', - 'include_version' => 'false', - 'require' => '', - 'exclude_tests' => 'false', - 'exclude_fixtures' => 'false', - 'exclude_factories' => 'false', - 'exclude_serializers' => 'false', - 'exclude_scaffolds' => 'true', - 'exclude_controllers' => 'true', - 'exclude_helpers' => 'true', - 'ignore_model_sub_dir' => 'false', - 'ignore_columns' => nil, - 'ignore_routes' => nil, - 'ignore_unknown_models' => 'false', - 'hide_limit_column_types' => 'integer,boolean', - 'skip_on_db_migrate' => 'false', - 'format_bare' => 'true', - 'format_rdoc' => 'false', - 'format_markdown' => 'false', - 'sort' => 'false', - 'force' => 'false', - 'trace' => 'false', - 'wrapper_open' => nil, - 'wrapper_close' => nil + 'routes' => 'false', + 'position_in_routes' => 'before', + 'position_in_class' => 'before', + 'position_in_test' => 'before', + 'position_in_fixture' => 'before', + 'position_in_factory' => 'before', + 'position_in_serializer' => 'before', + 'show_foreign_keys' => 'true', + 'show_complete_foreign_keys' => 'false', + 'show_indexes' => 'true', + 'simple_indexes' => 'false', + 'model_dir' => 'app/models', + 'root_dir' => '', + 'include_version' => 'false', + 'require' => '', + 'exclude_tests' => 'false', + 'exclude_fixtures' => 'false', + 'exclude_factories' => 'false', + 'exclude_serializers' => 'false', + 'exclude_scaffolds' => 'true', + 'exclude_controllers' => 'true', + 'exclude_helpers' => 'true', + 'exclude_sti_subclasses' => 'false', + 'ignore_model_sub_dir' => 'false', + 'ignore_columns' => nil, + 'ignore_routes' => nil, + 'ignore_unknown_models' => 'false', + 'hide_limit_column_types' => 'integer,boolean', + 'hide_default_column_types' => 'json,jsonb,hstore', + 'skip_on_db_migrate' => 'false', + 'format_bare' => 'true', + 'format_rdoc' => 'false', + 'format_markdown' => 'false', + 'sort' => 'false', + 'force' => 'false', + 'classified_sort' => 'true', + 'trace' => 'false', + 'wrapper_open' => nil, + 'wrapper_close' => nil, + 'with_comment' => true ) end diff --git a/spec/factories/agreement_letters.rb b/spec/factories/agreement_letters.rb index a5d81292..90a04dda 100644 --- a/spec/factories/agreement_letters.rb +++ b/spec/factories/agreement_letters.rb @@ -2,13 +2,19 @@ # # Table name: agreement_letters # -# id :integer not null, primary key -# user_id :integer not null -# event_id :integer not null -# path :string not null -# created_at :datetime not null -# updated_at :datetime not null +# id :integer not null, primary key +# path :string not null +# created_at :datetime not null +# updated_at :datetime not null +# event_id :integer not null +# user_id :integer not null # +# Indexes +# +# index_agreement_letters_on_event_id (event_id) +# index_agreement_letters_on_user_id (user_id) +# + FactoryGirl.define do factory :agreement_letter do path { Rails.root.join('storage/agreement_letters/foo.pdf').to_s } diff --git a/spec/factories/application_letters.rb b/spec/factories/application_letters.rb index 5de27bd2..96706c4f 100644 --- a/spec/factories/application_letters.rb +++ b/spec/factories/application_letters.rb @@ -2,14 +2,28 @@ # # Table name: application_letters # -# id :integer not null, primary key -# motivation :string -# user_id :integer not null -# event_id :integer not null -# created_at :datetime not null -# updated_at :datetime not null -# status :integer not null +# id :integer not null, primary key +# allergies :string +# annotation :text +# custom_application_fields :text +# emergency_number :string +# motivation :string +# organisation :string +# status :integer default("pending"), not null +# status_notification_sent :boolean default(FALSE), not null +# vegan :boolean +# vegetarian :boolean +# created_at :datetime not null +# updated_at :datetime not null +# event_id :integer not null +# user_id :integer not null # +# Indexes +# +# index_application_letters_on_event_id (event_id) +# index_application_letters_on_user_id (user_id) +# + FactoryGirl.define do factory :application_letter do motivation "None" diff --git a/spec/factories/application_notes.rb b/spec/factories/application_notes.rb index 1e049e1e..77526944 100644 --- a/spec/factories/application_notes.rb +++ b/spec/factories/application_notes.rb @@ -1,3 +1,18 @@ +# == Schema Information +# +# Table name: application_notes +# +# id :integer not null, primary key +# note :text +# created_at :datetime not null +# updated_at :datetime not null +# application_letter_id :integer +# +# Indexes +# +# index_application_notes_on_application_letter_id (application_letter_id) +# + FactoryGirl.define do factory :application_note do note "Hate this guy." diff --git a/spec/factories/date_ranges.rb b/spec/factories/date_ranges.rb index 913c0a1f..19402904 100644 --- a/spec/factories/date_ranges.rb +++ b/spec/factories/date_ranges.rb @@ -1,13 +1,18 @@ # == Schema Information # -# Table name: dateRange +# Table name: date_ranges # -# id :integer -# startDate :date -# endDate :date -# event_id :integer +# id :integer not null, primary key +# end_date :date +# start_date :date +# created_at :datetime +# updated_at :datetime +# event_id :integer +# +# Indexes +# +# index_date_ranges_on_event_id (event_id) # - FactoryGirl.define do factory :date_range do diff --git a/spec/factories/email_templates.rb b/spec/factories/email_templates.rb index 782d9c88..b9d6bd77 100644 --- a/spec/factories/email_templates.rb +++ b/spec/factories/email_templates.rb @@ -2,12 +2,13 @@ # # Table name: email_templates # -# id :integer not null, primary key -# status :integer(enum) not null -# hide_recipients :boolean not null -# subject :string not null -# content :string not null +# id :integer not null, primary key +# content :text +# hide_recipients :boolean +# status :integer +# subject :string # + FactoryGirl.define do factory :email_template do status :acceptance diff --git a/spec/factories/events.rb b/spec/factories/events.rb index 153b7c9b..a26d1f38 100644 --- a/spec/factories/events.rb +++ b/spec/factories/events.rb @@ -2,15 +2,22 @@ # # Table name: events # -# id :integer not null, primary key -# name :string -# description :string -# max_participants :integer -# date_ranges :collection -# published :boolean -# created_at :datetime not null -# updated_at :datetime not null -# hidden :boolean +# id :integer not null, primary key +# acceptances_have_been_sent :boolean default(FALSE) +# application_deadline :date +# custom_application_fields :text +# custom_image :string +# description :text +# hidden :boolean default(FALSE) +# image :string +# knowledge_level :string +# max_participants :integer +# name :string +# organizer :string +# published :boolean default(FALSE) +# rejections_have_been_sent :boolean default(FALSE) +# created_at :datetime not null +# updated_at :datetime not null # FactoryGirl.define do diff --git a/spec/factories/participant_groups.rb b/spec/factories/participant_groups.rb index 9cf956a8..2b2d7787 100644 --- a/spec/factories/participant_groups.rb +++ b/spec/factories/participant_groups.rb @@ -1,3 +1,18 @@ +# == Schema Information +# +# Table name: participant_groups +# +# id :integer not null, primary key +# group :integer not null +# event_id :integer +# user_id :integer +# +# Indexes +# +# index_participant_groups_on_event_id (event_id) +# index_participant_groups_on_user_id (user_id) +# + FactoryGirl.define do factory :participant_group do event diff --git a/spec/factories/profiles.rb b/spec/factories/profiles.rb index f0620781..3c715fcf 100644 --- a/spec/factories/profiles.rb +++ b/spec/factories/profiles.rb @@ -2,10 +2,24 @@ # # Table name: profiles # -# id :integer not null, primary key -# user_id :integer not null -# created_at :datetime not null -# updated_at :datetime not null +# id :integer not null, primary key +# birth_date :date +# city :string +# country :string +# discovery_of_site :text +# first_name :string +# gender :string +# last_name :string +# state :string +# street_name :string +# zip_code :string +# created_at :datetime not null +# updated_at :datetime not null +# user_id :integer not null +# +# Indexes +# +# index_profiles_on_user_id (user_id) # FactoryGirl.define do diff --git a/spec/factories/requests.rb b/spec/factories/requests.rb index 8c7f319e..953c4cd6 100644 --- a/spec/factories/requests.rb +++ b/spec/factories/requests.rb @@ -3,27 +3,26 @@ # Table name: requests # # id :integer not null, primary key -# created_at :datetime not null -# updated_at :datetime not null -# form_of_address :integer +# annotations :text +# contact_person :string +# email :string # first_name :string +# form_of_address :integer +# grade :string +# knowledge_level :string # last_name :string +# notes :text +# number_of_participants :integer # phone_number :string # school_street :string -# email :string -# topic_of_workshop :text -# time_period :text -# number_of_participants :integer -# knowledge_level :string -# annotations :text -# status :integer default(0) # school_zip_code_city :string -# contact_person :string -# notes :text -# grade :string +# status :integer default("open") +# time_period :text +# topic_of_workshop :text +# created_at :datetime not null +# updated_at :datetime not null # - FactoryGirl.define do factory :request do form_of_address :mrs diff --git a/spec/factories/users.rb b/spec/factories/users.rb index ffa52527..c30f9d2d 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -3,19 +3,26 @@ # Table name: users # # id :integer not null, primary key +# current_sign_in_at :datetime +# current_sign_in_ip :string # email :string default(""), not null # encrypted_password :string default(""), not null -# reset_password_token :string -# reset_password_sent_at :datetime -# remember_created_at :datetime -# sign_in_count :integer default(0), not null -# current_sign_in_at :datetime # last_sign_in_at :datetime -# current_sign_in_ip :string # last_sign_in_ip :string +# provider :string +# remember_created_at :datetime +# reset_password_sent_at :datetime +# reset_password_token :string +# role :string +# sign_in_count :integer default(0), not null +# uid :string # created_at :datetime not null # updated_at :datetime not null -# name :string +# +# Indexes +# +# index_users_on_email (email) UNIQUE +# index_users_on_reset_password_token (reset_password_token) UNIQUE # FactoryGirl.define do diff --git a/spec/models/agreement_letter_spec.rb b/spec/models/agreement_letter_spec.rb index 72bf7a8c..5ed89eea 100644 --- a/spec/models/agreement_letter_spec.rb +++ b/spec/models/agreement_letter_spec.rb @@ -1,3 +1,20 @@ +# == Schema Information +# +# Table name: agreement_letters +# +# id :integer not null, primary key +# path :string not null +# created_at :datetime not null +# updated_at :datetime not null +# event_id :integer not null +# user_id :integer not null +# +# Indexes +# +# index_agreement_letters_on_event_id (event_id) +# index_agreement_letters_on_user_id (user_id) +# + require 'rails_helper' RSpec.describe AgreementLetter, type: :model do diff --git a/spec/models/application_letter_spec.rb b/spec/models/application_letter_spec.rb index fc7655f7..79f48cb1 100644 --- a/spec/models/application_letter_spec.rb +++ b/spec/models/application_letter_spec.rb @@ -2,12 +2,26 @@ # # Table name: application_letters # -# id :integer not null, primary key -# motivation :string -# user_id :integer not null -# event_id :integer not null -# created_at :datetime not null -# updated_at :datetime not null +# id :integer not null, primary key +# allergies :string +# annotation :text +# custom_application_fields :text +# emergency_number :string +# motivation :string +# organisation :string +# status :integer default("pending"), not null +# status_notification_sent :boolean default(FALSE), not null +# vegan :boolean +# vegetarian :boolean +# created_at :datetime not null +# updated_at :datetime not null +# event_id :integer not null +# user_id :integer not null +# +# Indexes +# +# index_application_letters_on_event_id (event_id) +# index_application_letters_on_user_id (user_id) # require 'rails_helper' diff --git a/spec/models/application_note_spec.rb b/spec/models/application_note_spec.rb index 59295d0f..8d261284 100644 --- a/spec/models/application_note_spec.rb +++ b/spec/models/application_note_spec.rb @@ -1,3 +1,18 @@ +# == Schema Information +# +# Table name: application_notes +# +# id :integer not null, primary key +# note :text +# created_at :datetime not null +# updated_at :datetime not null +# application_letter_id :integer +# +# Indexes +# +# index_application_notes_on_application_letter_id (application_letter_id) +# + require 'rails_helper' RSpec.describe ApplicationNote, type: :model do diff --git a/spec/models/date_range_spec.rb b/spec/models/date_range_spec.rb index bbb129b3..a45d8a2c 100644 --- a/spec/models/date_range_spec.rb +++ b/spec/models/date_range_spec.rb @@ -1,3 +1,19 @@ +# == Schema Information +# +# Table name: date_ranges +# +# id :integer not null, primary key +# end_date :date +# start_date :date +# created_at :datetime +# updated_at :datetime +# event_id :integer +# +# Indexes +# +# index_date_ranges_on_event_id (event_id) +# + require 'rails_helper' describe DateRange do diff --git a/spec/models/email_template_spec.rb b/spec/models/email_template_spec.rb index b8fc4d78..468075b5 100644 --- a/spec/models/email_template_spec.rb +++ b/spec/models/email_template_spec.rb @@ -2,11 +2,11 @@ # # Table name: email_templates # -# id :integer not null, primary key -# status :integer(enum) not null -# hide_recipients :boolean not null -# subject :string not null -# content :string not null +# id :integer not null, primary key +# content :text +# hide_recipients :boolean +# status :integer +# subject :string # require 'rails_helper' diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb index c0e31aa0..a972f240 100644 --- a/spec/models/event_spec.rb +++ b/spec/models/event_spec.rb @@ -2,13 +2,22 @@ # # Table name: events # -# id :integer not null, primary key -# name :string -# description :string -# max_participants :integer -# active :boolean -# created_at :datetime not null -# updated_at :datetime not null +# id :integer not null, primary key +# acceptances_have_been_sent :boolean default(FALSE) +# application_deadline :date +# custom_application_fields :text +# custom_image :string +# description :text +# hidden :boolean default(FALSE) +# image :string +# knowledge_level :string +# max_participants :integer +# name :string +# organizer :string +# published :boolean default(FALSE) +# rejections_have_been_sent :boolean default(FALSE) +# created_at :datetime not null +# updated_at :datetime not null # require 'rails_helper' diff --git a/spec/models/participant_group_spec.rb b/spec/models/participant_group_spec.rb index 17157401..5bd76dda 100644 --- a/spec/models/participant_group_spec.rb +++ b/spec/models/participant_group_spec.rb @@ -1,3 +1,18 @@ +# == Schema Information +# +# Table name: participant_groups +# +# id :integer not null, primary key +# group :integer not null +# event_id :integer +# user_id :integer +# +# Indexes +# +# index_participant_groups_on_event_id (event_id) +# index_participant_groups_on_user_id (user_id) +# + require 'rails_helper' RSpec.describe ParticipantGroup, type: :model do diff --git a/spec/models/profile_spec.rb b/spec/models/profile_spec.rb index 3a9d3648..97d8caaf 100644 --- a/spec/models/profile_spec.rb +++ b/spec/models/profile_spec.rb @@ -2,10 +2,24 @@ # # Table name: profiles # -# id :integer not null, primary key -# user_id :integer not null -# created_at :datetime not null -# updated_at :datetime not null +# id :integer not null, primary key +# birth_date :date +# city :string +# country :string +# discovery_of_site :text +# first_name :string +# gender :string +# last_name :string +# state :string +# street_name :string +# zip_code :string +# created_at :datetime not null +# updated_at :datetime not null +# user_id :integer not null +# +# Indexes +# +# index_profiles_on_user_id (user_id) # require 'rails_helper' diff --git a/spec/models/request_spec.rb b/spec/models/request_spec.rb index 03fd8d8d..f5951ee7 100644 --- a/spec/models/request_spec.rb +++ b/spec/models/request_spec.rb @@ -3,24 +3,24 @@ # Table name: requests # # id :integer not null, primary key -# created_at :datetime not null -# updated_at :datetime not null -# form_of_address :integer +# annotations :text +# contact_person :string +# email :string # first_name :string +# form_of_address :integer +# grade :string +# knowledge_level :string # last_name :string +# notes :text +# number_of_participants :integer # phone_number :string # school_street :string -# email :string -# topic_of_workshop :text -# time_period :text -# number_of_participants :integer -# knowledge_level :string -# annotations :text -# status :integer default(0) # school_zip_code_city :string -# contact_person :string -# notes :text -# grade :string +# status :integer default("open") +# time_period :text +# topic_of_workshop :text +# created_at :datetime not null +# updated_at :datetime not null # require 'rails_helper' diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index d70588c0..b7134ebb 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -3,19 +3,26 @@ # Table name: users # # id :integer not null, primary key +# current_sign_in_at :datetime +# current_sign_in_ip :string # email :string default(""), not null # encrypted_password :string default(""), not null -# reset_password_token :string -# reset_password_sent_at :datetime -# remember_created_at :datetime -# sign_in_count :integer default(0), not null -# current_sign_in_at :datetime # last_sign_in_at :datetime -# current_sign_in_ip :string # last_sign_in_ip :string +# provider :string +# remember_created_at :datetime +# reset_password_sent_at :datetime +# reset_password_token :string +# role :string +# sign_in_count :integer default(0), not null +# uid :string # created_at :datetime not null # updated_at :datetime not null -# name :string +# +# Indexes +# +# index_users_on_email (email) UNIQUE +# index_users_on_reset_password_token (reset_password_token) UNIQUE # require 'rails_helper' From 8e82ec1b4d19bb331018c49abeaae0b60aa284a8 Mon Sep 17 00:00:00 2001 From: Christian Flach Date: Sat, 2 Jun 2018 10:40:19 +0200 Subject: [PATCH 3/5] Auto-cd into hpi-swt2 folder --- Vagrantfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Vagrantfile b/Vagrantfile index 7849879b..fe53fed6 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -27,5 +27,6 @@ Vagrant.configure("2") do |config| apt-get update apt-get install -y phantomjs apt-get install -y imagemagick + echo "cd hpi-swt2" >> /home/vagrant/.bashrc SHELL end From 7837a9b3c0099c786062d898b90f292a1ccf7170 Mon Sep 17 00:00:00 2001 From: Corinna Jaschek Date: Sat, 2 Jun 2018 11:54:32 +0200 Subject: [PATCH 4/5] fix application letters not deleting their notes (#704) --- app/models/application_letter.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/application_letter.rb b/app/models/application_letter.rb index 44b923d3..22ae43e4 100644 --- a/app/models/application_letter.rb +++ b/app/models/application_letter.rb @@ -23,12 +23,17 @@ # index_application_letters_on_event_id (event_id) # index_application_letters_on_user_id (user_id) # +# Foreign Keys +# +# fk_rails_... (event_id => events.id) +# fk_rails_... (user_id => users.id) +# class ApplicationLetter < ActiveRecord::Base belongs_to :user belongs_to :event - has_many :application_notes + has_many :application_notes, dependent: :destroy serialize :custom_application_fields, Array validates_presence_of :user, :event, :motivation, :emergency_number, :organisation From 9387d0bd2e20b5b1063367ebf57f4e165c4007b0 Mon Sep 17 00:00:00 2001 From: Eva Date: Sat, 2 Jun 2018 14:21:10 +0200 Subject: [PATCH 5/5] Update user.rb --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 9d4c2d12..98891b7a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -43,7 +43,7 @@ class User < ActiveRecord::Base def role?(base_role) return false unless role - raise "invalid role: " + base_role unless ROLES.include?(base_role) + raise 'invalid role: ' + base_role unless ROLES.include?(base_role) base_role.to_sym == role.to_sym end