diff options
| author | Xinhui | 2017-06-05 16:47:06 +0200 |
|---|---|---|
| committer | Xinhui | 2017-06-05 16:47:06 +0200 |
| commit | f422c130f9bda3c425cc3e1b9604345ca3586fe1 (patch) | |
| tree | db41f199039c48bcb0a87f213692b77e1c48b564 | |
| parent | 560b21733c676187d02795332e8ec0491cd875b8 (diff) | |
| download | chouette-core-f422c130f9bda3c425cc3e1b9604345ca3586fe1.tar.bz2 | |
Referential Cleanup add date_type
Refs #3662
| -rw-r--r-- | app/assets/javascripts/cleanup.coffee | 9 | ||||
| -rw-r--r-- | app/controllers/clean_ups_controller.rb | 2 | ||||
| -rw-r--r-- | app/models/clean_up.rb | 4 | ||||
| -rw-r--r-- | app/views/referentials/show.html.slim | 4 | ||||
| -rw-r--r-- | config/locales/enumerize.en.yml | 5 | ||||
| -rw-r--r-- | config/locales/enumerize.fr.yml | 5 | ||||
| -rw-r--r-- | db/migrate/20170605135126_add_date_type_to_clean_ups.rb | 5 | ||||
| -rw-r--r-- | db/schema.rb | 475 | ||||
| -rw-r--r-- | spec/models/clean_up_spec.rb | 1 |
9 files changed, 264 insertions, 246 deletions
diff --git a/app/assets/javascripts/cleanup.coffee b/app/assets/javascripts/cleanup.coffee new file mode 100644 index 000000000..169a006a9 --- /dev/null +++ b/app/assets/javascripts/cleanup.coffee @@ -0,0 +1,9 @@ +$(document).on("change", 'input[name="clean_up[date_type]"]', (e) -> + type = $(this).val() + end_date = $('.cleanup_end_date_wrapper') + + if type == 'between' + end_date.removeClass('hidden').show() + else + end_date.hide() +) diff --git a/app/controllers/clean_ups_controller.rb b/app/controllers/clean_ups_controller.rb index 1e4835775..b9ff225b3 100644 --- a/app/controllers/clean_ups_controller.rb +++ b/app/controllers/clean_ups_controller.rb @@ -14,6 +14,6 @@ class CleanUpsController < ChouetteController end def clean_up_params - params.require(:clean_up).permit(:keep_lines, :keep_stops, :keep_companies, :keep_networks, :keep_group_of_lines, :begin_date, :end_date) + params.require(:clean_up).permit(:date_type, :begin_date, :end_date) end end diff --git a/app/models/clean_up.rb b/app/models/clean_up.rb index a44bb46a4..457e90b65 100644 --- a/app/models/clean_up.rb +++ b/app/models/clean_up.rb @@ -1,9 +1,13 @@ class CleanUp < ActiveRecord::Base + extend Enumerize include AASM belongs_to :referential has_one :clean_up_result + enumerize :date_type, in: %i(between before after) + validates :begin_date, presence: true + validates :date_type, presence: true after_commit :perform_cleanup, :on => :create def perform_cleanup diff --git a/app/views/referentials/show.html.slim b/app/views/referentials/show.html.slim index 9c60c2768..3c1e36302 100644 --- a/app/views/referentials/show.html.slim +++ b/app/views/referentials/show.html.slim @@ -75,8 +75,10 @@ .container-fluid .row .col-lg-8.col-ld-offset-2.col-md-8.col-md-offset-2.col-sm-8.col-sm-offset-2.col-xs-12 + = f.input :date_type, as: :radio_buttons, label: false = f.input :begin_date, as: :date, label: t('titles.clean_up.begin_date'),:wrapper_html => { class: 'date', title: t('titles.clean_up.begin_date') } - = f.input :end_date, as: :date, label: t('titles.clean_up.end_date'), :wrapper_html => { class: 'date', title: t('titles.clean_up.end_date') } + + = f.input :end_date, as: :date, label: t('titles.clean_up.end_date'), :wrapper_html => { class: 'date cleanup_end_date_wrapper hidden', title: t('titles.clean_up.end_date') } .modal-footer button.btn.btn-link type='button' data-dismiss='modal' Annuler diff --git a/config/locales/enumerize.en.yml b/config/locales/enumerize.en.yml index 8e9f89cf3..f76237288 100644 --- a/config/locales/enumerize.en.yml +++ b/config/locales/enumerize.en.yml @@ -105,6 +105,11 @@ en: zdlp: ZDLp zdlr: ZDLr lda: LDA + clean_up: + date_type: + between: Between two dates + before: Before date + after: After date line: transport_mode: interchange: Interchange diff --git a/config/locales/enumerize.fr.yml b/config/locales/enumerize.fr.yml index d99e7625b..14aedd155 100644 --- a/config/locales/enumerize.fr.yml +++ b/config/locales/enumerize.fr.yml @@ -104,6 +104,11 @@ fr: zdlp: ZDLp zdlr: ZDLr lda: LDA + clean_up: + date_type: + between: Entre deux dates + before: Avant une date + after: Après une date line: transport_mode: interchange: Interconnection diff --git a/db/migrate/20170605135126_add_date_type_to_clean_ups.rb b/db/migrate/20170605135126_add_date_type_to_clean_ups.rb new file mode 100644 index 000000000..693e1ccce --- /dev/null +++ b/db/migrate/20170605135126_add_date_type_to_clean_ups.rb @@ -0,0 +1,5 @@ +class AddDateTypeToCleanUps < ActiveRecord::Migration + def change + add_column :clean_ups, :date_type, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index a7f072721..9108ed169 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170531154114) do +ActiveRecord::Schema.define(version: 20170605135126) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -21,12 +21,12 @@ ActiveRecord::Schema.define(version: 20170531154114) do create_table "access_links", id: :bigserial, force: :cascade do |t| t.integer "access_point_id", limit: 8 t.integer "stop_area_id", limit: 8 - t.string "objectid", limit: 255, null: false + t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id", limit: 255 - t.string "name", limit: 255 - t.string "comment", limit: 255 - t.decimal "link_distance", precision: 19, scale: 2 + t.string "creator_id" + t.string "name" + t.string "comment" + t.decimal "link_distance", precision: 19, scale: 2 t.boolean "lift_availability" t.boolean "mobility_restricted_suitability" t.boolean "stairs_availability" @@ -34,9 +34,9 @@ ActiveRecord::Schema.define(version: 20170531154114) do t.time "frequent_traveller_duration" t.time "occasional_traveller_duration" t.time "mobility_restricted_traveller_duration" - t.string "link_type", limit: 255 + t.string "link_type" t.integer "int_user_needs" - t.string "link_orientation", limit: 255 + t.string "link_orientation" t.datetime "created_at" t.datetime "updated_at" end @@ -44,26 +44,26 @@ ActiveRecord::Schema.define(version: 20170531154114) do add_index "access_links", ["objectid"], name: "access_links_objectid_key", unique: true, using: :btree create_table "access_points", id: :bigserial, force: :cascade do |t| - t.string "objectid", limit: 255 + t.string "objectid" t.integer "object_version", limit: 8 - t.string "creator_id", limit: 255 - t.string "name", limit: 255 - t.string "comment", limit: 255 - t.decimal "longitude", precision: 19, scale: 16 - t.decimal "latitude", precision: 19, scale: 16 - t.string "long_lat_type", limit: 255 - t.string "country_code", limit: 255 - t.string "street_name", limit: 255 - t.string "contained_in", limit: 255 + t.string "creator_id" + t.string "name" + t.string "comment" + t.decimal "longitude", precision: 19, scale: 16 + t.decimal "latitude", precision: 19, scale: 16 + t.string "long_lat_type" + t.string "country_code" + t.string "street_name" + t.string "contained_in" t.time "openning_time" t.time "closing_time" - t.string "access_type", limit: 255 + t.string "access_type" t.boolean "lift_availability" t.boolean "mobility_restricted_suitability" t.boolean "stairs_availability" t.integer "stop_area_id", limit: 8 - t.string "zip_code", limit: 255 - t.string "city_name", limit: 255 + t.string "zip_code" + t.string "city_name" t.text "import_xml" t.datetime "created_at" t.datetime "updated_at" @@ -73,18 +73,18 @@ ActiveRecord::Schema.define(version: 20170531154114) do create_table "api_keys", id: :bigserial, force: :cascade do |t| t.integer "referential_id", limit: 8 - t.string "token", limit: 255 - t.string "name", limit: 255 + t.string "token" + t.string "name" t.datetime "created_at" t.datetime "updated_at" end create_table "calendars", id: :bigserial, force: :cascade do |t| - t.string "name", limit: 255 - t.string "short_name", limit: 255 - t.daterange "date_ranges", array: true - t.date "dates", array: true - t.boolean "shared", default: false + t.string "name" + t.string "short_name" + t.daterange "date_ranges", array: true + t.date "dates", array: true + t.boolean "shared", default: false t.integer "organisation_id", limit: 8 t.datetime "created_at" t.datetime "updated_at" @@ -94,7 +94,7 @@ ActiveRecord::Schema.define(version: 20170531154114) do add_index "calendars", ["short_name"], name: "index_calendars_on_short_name", unique: true, using: :btree create_table "clean_up_results", id: :bigserial, force: :cascade do |t| - t.string "message_key", limit: 255 + t.string "message_key" t.hstore "message_attributs" t.integer "clean_up_id", limit: 8 t.datetime "created_at" @@ -104,7 +104,7 @@ ActiveRecord::Schema.define(version: 20170531154114) do add_index "clean_up_results", ["clean_up_id"], name: "index_clean_up_results_on_clean_up_id", using: :btree create_table "clean_ups", id: :bigserial, force: :cascade do |t| - t.string "status", limit: 255 + t.string "status" t.datetime "started_at" t.datetime "ended_at" t.integer "referential_id", limit: 8 @@ -112,25 +112,26 @@ ActiveRecord::Schema.define(version: 20170531154114) do t.datetime "created_at" t.datetime "updated_at" t.datetime "end_date" + t.string "date_type" end add_index "clean_ups", ["referential_id"], name: "index_clean_ups_on_referential_id", using: :btree create_table "companies", id: :bigserial, force: :cascade do |t| - t.string "objectid", limit: 255, null: false + t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id", limit: 255 - t.string "name", limit: 255 - t.string "short_name", limit: 255 - t.string "organizational_unit", limit: 255 - t.string "operating_department_name", limit: 255 - t.string "code", limit: 255 - t.string "phone", limit: 255 - t.string "fax", limit: 255 - t.string "email", limit: 255 - t.string "registration_number", limit: 255 - t.string "url", limit: 255 - t.string "time_zone", limit: 255 + t.string "creator_id" + t.string "name" + t.string "short_name" + t.string "organizational_unit" + t.string "operating_department_name" + t.string "code" + t.string "phone" + t.string "fax" + t.string "email" + t.string "registration_number" + t.string "url" + t.string "time_zone" t.integer "line_referential_id", limit: 8 t.text "import_xml" t.datetime "created_at" @@ -144,13 +145,13 @@ ActiveRecord::Schema.define(version: 20170531154114) do create_table "connection_links", id: :bigserial, force: :cascade do |t| t.integer "departure_id", limit: 8 t.integer "arrival_id", limit: 8 - t.string "objectid", limit: 255, null: false + t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id", limit: 255 - t.string "name", limit: 255 - t.string "comment", limit: 255 - t.decimal "link_distance", precision: 19, scale: 2 - t.string "link_type", limit: 255 + t.string "creator_id" + t.string "name" + t.string "comment" + t.decimal "link_distance", precision: 19, scale: 2 + t.string "link_type" t.time "default_duration" t.time "frequent_traveller_duration" t.time "occasional_traveller_duration" @@ -165,31 +166,15 @@ ActiveRecord::Schema.define(version: 20170531154114) do add_index "connection_links", ["objectid"], name: "connection_links_objectid_key", unique: true, using: :btree - create_table "delayed_jobs", id: :bigserial, force: :cascade do |t| - t.integer "priority", default: 0 - t.integer "attempts", default: 0 - t.text "handler" - t.text "last_error" - t.datetime "run_at" - t.datetime "locked_at" - t.datetime "failed_at" - t.string "locked_by", limit: 255 - t.string "queue", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree - create_table "exports", id: :bigserial, force: :cascade do |t| t.integer "referential_id", limit: 8 - t.string "status", limit: 255 - t.string "type", limit: 255 - t.string "options", limit: 255 + t.string "status" + t.string "type" + t.string "options" t.datetime "created_at" t.datetime "updated_at" - t.string "references_type", limit: 255 - t.string "reference_ids", limit: 255 + t.string "references_type" + t.string "reference_ids" end add_index "exports", ["referential_id"], name: "index_exports_on_referential_id", using: :btree @@ -199,23 +184,23 @@ ActiveRecord::Schema.define(version: 20170531154114) do t.integer "line_id", limit: 8 t.integer "connection_link_id", limit: 8 t.integer "stop_point_id", limit: 8 - t.string "objectid", limit: 255, null: false + t.string "objectid", null: false t.integer "object_version", limit: 8 t.datetime "creation_time" - t.string "creator_id", limit: 255 - t.string "name", limit: 255 - t.string "comment", limit: 255 - t.string "description", limit: 255 + t.string "creator_id" + t.string "name" + t.string "comment" + t.string "description" t.boolean "free_access" - t.decimal "longitude", precision: 19, scale: 16 - t.decimal "latitude", precision: 19, scale: 16 - t.string "long_lat_type", limit: 255 - t.decimal "x", precision: 19, scale: 2 - t.decimal "y", precision: 19, scale: 2 - t.string "projection_type", limit: 255 - t.string "country_code", limit: 255 - t.string "street_name", limit: 255 - t.string "contained_in", limit: 255 + t.decimal "longitude", precision: 19, scale: 16 + t.decimal "latitude", precision: 19, scale: 16 + t.string "long_lat_type" + t.decimal "x", precision: 19, scale: 2 + t.decimal "y", precision: 19, scale: 2 + t.string "projection_type" + t.string "country_code" + t.string "street_name" + t.string "contained_in" end add_index "facilities", ["objectid"], name: "facilities_objectid_key", unique: true, using: :btree @@ -227,8 +212,8 @@ ActiveRecord::Schema.define(version: 20170531154114) do create_table "footnotes", id: :bigserial, force: :cascade do |t| t.integer "line_id", limit: 8 - t.string "code", limit: 255 - t.string "label", limit: 255 + t.string "code" + t.string "label" t.datetime "created_at" t.datetime "updated_at" end @@ -239,12 +224,12 @@ ActiveRecord::Schema.define(version: 20170531154114) do end create_table "group_of_lines", id: :bigserial, force: :cascade do |t| - t.string "objectid", limit: 255, null: false + t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id", limit: 255 - t.string "name", limit: 255 - t.string "comment", limit: 255 - t.string "registration_number", limit: 255 + t.string "creator_id" + t.string "name" + t.string "comment" + t.string "registration_number" t.integer "line_referential_id", limit: 8 t.text "import_xml" t.datetime "created_at" @@ -261,7 +246,7 @@ ActiveRecord::Schema.define(version: 20170531154114) do create_table "import_messages", id: :bigserial, force: :cascade do |t| t.integer "criticity" - t.string "message_key", limit: 255 + t.string "message_key" t.hstore "message_attributs" t.integer "import_id", limit: 8 t.integer "resource_id", limit: 8 @@ -275,30 +260,30 @@ ActiveRecord::Schema.define(version: 20170531154114) do create_table "import_resources", id: :bigserial, force: :cascade do |t| t.integer "import_id", limit: 8 - t.string "status", limit: 255 + t.string "status" t.datetime "created_at" t.datetime "updated_at" - t.string "type", limit: 255 - t.string "reference", limit: 255 - t.string "name", limit: 255 + t.string "type" + t.string "reference" + t.string "name" t.hstore "metrics" end add_index "import_resources", ["import_id"], name: "index_import_resources_on_import_id", using: :btree create_table "imports", id: :bigserial, force: :cascade do |t| - t.string "status", limit: 255 - t.string "current_step_id", limit: 255 + t.string "status" + t.string "current_step_id" t.float "current_step_progress" t.integer "workbench_id", limit: 8 t.integer "referential_id", limit: 8 - t.string "name", limit: 255 + t.string "name" t.datetime "created_at" t.datetime "updated_at" - t.string "file", limit: 255 + t.string "file" t.datetime "started_at" t.datetime "ended_at" - t.string "token_download", limit: 255 + t.string "token_download" t.string "type", limit: 255 end @@ -333,16 +318,16 @@ ActiveRecord::Schema.define(version: 20170531154114) do create_table "journey_patterns", id: :bigserial, force: :cascade do |t| t.integer "route_id", limit: 8 - t.string "objectid", limit: 255, null: false + t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id", limit: 255 - t.string "name", limit: 255 - t.string "comment", limit: 255 - t.string "registration_number", limit: 255 - t.string "published_name", limit: 255 + t.string "creator_id" + t.string "name" + t.string "comment" + t.string "registration_number" + t.string "published_name" t.integer "departure_stop_point_id", limit: 8 t.integer "arrival_stop_point_id", limit: 8 - t.integer "section_status", default: 0, null: false + t.integer "section_status", default: 0, null: false t.datetime "created_at" t.datetime "updated_at" end @@ -364,7 +349,7 @@ ActiveRecord::Schema.define(version: 20170531154114) do create_table "line_referential_sync_messages", id: :bigserial, force: :cascade do |t| t.integer "criticity" - t.string "message_key", limit: 255 + t.string "message_key" t.hstore "message_attributs" t.integer "line_referential_sync_id", limit: 8 t.datetime "created_at" @@ -379,42 +364,42 @@ ActiveRecord::Schema.define(version: 20170531154114) do t.datetime "updated_at" t.datetime "started_at" t.datetime "ended_at" - t.string "status", limit: 255 + t.string "status" end add_index "line_referential_syncs", ["line_referential_id"], name: "index_line_referential_syncs_on_line_referential_id", using: :btree create_table "line_referentials", id: :bigserial, force: :cascade do |t| - t.string "name", limit: 255 + t.string "name" t.datetime "created_at" t.datetime "updated_at" - t.integer "sync_interval", default: 1 + t.integer "sync_interval", default: 1 end create_table "lines", id: :bigserial, force: :cascade do |t| t.integer "network_id", limit: 8 t.integer "company_id", limit: 8 - t.string "objectid", limit: 255, null: false + t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id", limit: 255 - t.string "name", limit: 255 - t.string "number", limit: 255 - t.string "published_name", limit: 255 - t.string "transport_mode", limit: 255 - t.string "registration_number", limit: 255 - t.string "comment", limit: 255 + t.string "creator_id" + t.string "name" + t.string "number" + t.string "published_name" + t.string "transport_mode" + t.string "registration_number" + t.string "comment" t.boolean "mobility_restricted_suitability" t.integer "int_user_needs" t.boolean "flexible_service" - t.string "url", limit: 255 + t.string "url" t.string "color", limit: 6 t.string "text_color", limit: 6 - t.string "stable_id", limit: 255 + t.string "stable_id" t.integer "line_referential_id", limit: 8 - t.boolean "deactivated", default: false + t.boolean "deactivated", default: false t.text "import_xml" - t.string "transport_submode", limit: 255 - t.integer "secondary_company_ids", limit: 8, array: true + t.string "transport_submode" + t.integer "secondary_company_ids", limit: 8, array: true t.datetime "created_at" t.datetime "updated_at" t.boolean "seasonal" @@ -426,17 +411,17 @@ ActiveRecord::Schema.define(version: 20170531154114) do add_index "lines", ["secondary_company_ids"], name: "index_lines_on_secondary_company_ids", using: :gin create_table "networks", id: :bigserial, force: :cascade do |t| - t.string "objectid", limit: 255, null: false + t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id", limit: 255 + t.string "creator_id" t.date "version_date" - t.string "description", limit: 255 - t.string "name", limit: 255 - t.string "registration_number", limit: 255 - t.string "source_name", limit: 255 - t.string "source_type", limit: 255 - t.string "source_identifier", limit: 255 - t.string "comment", limit: 255 + t.string "description" + t.string "name" + t.string "registration_number" + t.string "source_name" + t.string "source_type" + t.string "source_identifier" + t.string "comment" t.text "import_xml" t.integer "line_referential_id", limit: 8 t.datetime "created_at" @@ -448,11 +433,11 @@ ActiveRecord::Schema.define(version: 20170531154114) do add_index "networks", ["registration_number"], name: "networks_registration_number_key", using: :btree create_table "organisations", id: :bigserial, force: :cascade do |t| - t.string "name", limit: 255 + t.string "name" t.datetime "created_at" t.datetime "updated_at" - t.string "data_format", limit: 255, default: "neptune" - t.string "code", limit: 255 + t.string "data_format", default: "neptune" + t.string "code" t.datetime "synced_at" t.hstore "sso_attributes" end @@ -463,12 +448,12 @@ ActiveRecord::Schema.define(version: 20170531154114) do t.integer "start_of_link_id", limit: 8 t.integer "end_of_link_id", limit: 8 t.integer "route_id", limit: 8 - t.string "objectid", limit: 255, null: false + t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id", limit: 255 - t.string "name", limit: 255 - t.string "comment", limit: 255 - t.decimal "link_distance", precision: 19, scale: 2 + t.string "creator_id" + t.string "name" + t.string "comment" + t.decimal "link_distance", precision: 19, scale: 2 t.datetime "created_at" t.datetime "updated_at" end @@ -476,7 +461,7 @@ ActiveRecord::Schema.define(version: 20170531154114) do add_index "pt_links", ["objectid"], name: "pt_links_objectid_key", unique: true, using: :btree create_table "referential_clonings", id: :bigserial, force: :cascade do |t| - t.string "status", limit: 255 + t.string "status" t.datetime "started_at" t.datetime "ended_at" t.integer "source_referential_id", limit: 8 @@ -497,30 +482,30 @@ ActiveRecord::Schema.define(version: 20170531154114) do t.daterange "periodes", array: true end - add_index "referential_metadata", ["line_ids"], name: "index_referential_metadata_on_line_ids", using: :btree + add_index "referential_metadata", ["line_ids"], name: "index_referential_metadata_on_line_ids", using: :gin add_index "referential_metadata", ["referential_id"], name: "index_referential_metadata_on_referential_id", using: :btree add_index "referential_metadata", ["referential_source_id"], name: "index_referential_metadata_on_referential_source_id", using: :btree create_table "referentials", id: :bigserial, force: :cascade do |t| - t.string "name", limit: 255 - t.string "slug", limit: 255 + t.string "name" + t.string "slug" t.datetime "created_at" t.datetime "updated_at" - t.string "prefix", limit: 255 - t.string "projection_type", limit: 255 - t.string "time_zone", limit: 255 - t.string "bounds", limit: 255 + t.string "prefix" + t.string "projection_type" + t.string "time_zone" + t.string "bounds" t.integer "organisation_id", limit: 8 t.text "geographical_bounds" t.integer "user_id", limit: 8 - t.string "user_name", limit: 255 - t.string "data_format", limit: 255 + t.string "user_name" + t.string "data_format" t.integer "line_referential_id", limit: 8 t.integer "stop_area_referential_id", limit: 8 t.integer "workbench_id", limit: 8 t.datetime "archived_at" t.integer "created_from_id", limit: 8 - t.boolean "ready", default: false + t.boolean "ready", default: false end add_index "referentials", ["created_from_id"], name: "index_referentials_on_created_from_id", using: :btree @@ -528,29 +513,29 @@ ActiveRecord::Schema.define(version: 20170531154114) do create_table "route_sections", id: :bigserial, force: :cascade do |t| t.integer "departure_id", limit: 8 t.integer "arrival_id", limit: 8 - t.string "objectid", limit: 255, null: false + t.geometry "input_geometry", limit: {:srid=>4326, :type=>"line_string"} + t.geometry "processed_geometry", limit: {:srid=>4326, :type=>"line_string"} + t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id", limit: 255 + t.string "creator_id" t.float "distance" t.boolean "no_processing" - t.geometry "input_geometry", limit: {:srid=>4326, :type=>"line_string"} - t.geometry "processed_geometry", limit: {:srid=>4326, :type=>"line_string"} t.datetime "created_at" t.datetime "updated_at" end create_table "routes", id: :bigserial, force: :cascade do |t| t.integer "line_id", limit: 8 - t.string "objectid", limit: 255, null: false + t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id", limit: 255 - t.string "name", limit: 255 - t.string "comment", limit: 255 + t.string "creator_id" + t.string "name" + t.string "comment" t.integer "opposite_route_id", limit: 8 - t.string "published_name", limit: 255 - t.string "number", limit: 255 - t.string "direction", limit: 255 - t.string "wayback", limit: 255 + t.string "published_name" + t.string "number" + t.string "direction" + t.string "wayback" t.datetime "created_at" t.datetime "updated_at" end @@ -558,14 +543,14 @@ ActiveRecord::Schema.define(version: 20170531154114) do add_index "routes", ["objectid"], name: "routes_objectid_key", unique: true, using: :btree create_table "routing_constraint_zones", id: :bigserial, force: :cascade do |t| - t.string "name", limit: 255 + t.string "name" t.datetime "created_at" t.datetime "updated_at" - t.string "objectid", limit: 255, null: false + t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id", limit: 255 + t.string "creator_id" t.integer "route_id", limit: 8 - t.integer "stop_point_ids", limit: 8, array: true + t.integer "stop_point_ids", limit: 8, array: true end create_table "routing_constraints_lines", id: false, force: :cascade do |t| @@ -575,7 +560,7 @@ ActiveRecord::Schema.define(version: 20170531154114) do create_table "rule_parameter_sets", id: :bigserial, force: :cascade do |t| t.text "parameters" - t.string "name", limit: 255 + t.string "name" t.datetime "created_at" t.datetime "updated_at" t.integer "organisation_id", limit: 8 @@ -589,7 +574,7 @@ ActiveRecord::Schema.define(version: 20170531154114) do create_table "stop_area_referential_sync_messages", id: :bigserial, force: :cascade do |t| t.integer "criticity" - t.string "message_key", limit: 255 + t.string "message_key" t.hstore "message_attributs" t.integer "stop_area_referential_sync_id", limit: 8 t.datetime "created_at" @@ -604,43 +589,43 @@ ActiveRecord::Schema.define(version: 20170531154114) do t.datetime "updated_at" t.datetime "ended_at" t.datetime "started_at" - t.string "status", limit: 255 + t.string "status" end add_index "stop_area_referential_syncs", ["stop_area_referential_id"], name: "index_stop_area_referential_syncs_on_stop_area_referential_id", using: :btree create_table "stop_area_referentials", id: :bigserial, force: :cascade do |t| - t.string "name", limit: 255 + t.string "name" t.datetime "created_at" t.datetime "updated_at" end create_table "stop_areas", id: :bigserial, force: :cascade do |t| t.integer "parent_id", limit: 8 - t.string "objectid", limit: 255, null: false + t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id", limit: 255 - t.string "name", limit: 255 - t.string "comment", limit: 255 - t.string "area_type", limit: 255 - t.string "registration_number", limit: 255 - t.string "nearest_topic_name", limit: 255 + t.string "creator_id" + t.string "name" + t.string "comment" + t.string "area_type" + t.string "registration_number" + t.string "nearest_topic_name" t.integer "fare_code" t.decimal "longitude", precision: 19, scale: 16 t.decimal "latitude", precision: 19, scale: 16 - t.string "long_lat_type", limit: 255 - t.string "country_code", limit: 255 - t.string "street_name", limit: 255 + t.string "long_lat_type" + t.string "country_code" + t.string "street_name" t.boolean "mobility_restricted_suitability" t.boolean "stairs_availability" t.boolean "lift_availability" t.integer "int_user_needs" - t.string "zip_code", limit: 255 - t.string "city_name", limit: 255 - t.string "url", limit: 255 - t.string "time_zone", limit: 255 + t.string "zip_code" + t.string "city_name" + t.string "url" + t.string "time_zone" t.integer "stop_area_referential_id", limit: 8 - t.string "status", limit: 255 + t.string "status" t.text "import_xml" t.datetime "deleted_at" t.datetime "created_at" @@ -661,12 +646,12 @@ ActiveRecord::Schema.define(version: 20170531154114) do create_table "stop_points", id: :bigserial, force: :cascade do |t| t.integer "route_id", limit: 8 t.integer "stop_area_id", limit: 8 - t.string "objectid", limit: 255, null: false + t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id", limit: 255 + t.string "creator_id" t.integer "position" - t.string "for_boarding", limit: 255 - t.string "for_alighting", limit: 255 + t.string "for_boarding" + t.string "for_alighting" t.datetime "created_at" t.datetime "updated_at" end @@ -676,9 +661,9 @@ ActiveRecord::Schema.define(version: 20170531154114) do create_table "taggings", id: :bigserial, force: :cascade do |t| t.integer "tag_id", limit: 8 t.integer "taggable_id", limit: 8 - t.string "taggable_type", limit: 255 + t.string "taggable_type" t.integer "tagger_id", limit: 8 - t.string "tagger_type", limit: 255 + t.string "tagger_type" t.string "context", limit: 128 t.datetime "created_at" end @@ -687,8 +672,8 @@ ActiveRecord::Schema.define(version: 20170531154114) do add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree create_table "tags", id: :bigserial, force: :cascade do |t| - t.string "name", limit: 255 - t.integer "taggings_count", default: 0 + t.string "name" + t.integer "taggings_count", default: 0 end add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree @@ -712,11 +697,11 @@ ActiveRecord::Schema.define(version: 20170531154114) do add_index "time_table_periods", ["time_table_id"], name: "index_time_table_periods_on_time_table_id", using: :btree create_table "time_tables", id: :bigserial, force: :cascade do |t| - t.string "objectid", limit: 255, null: false + t.string "objectid", null: false t.integer "object_version", limit: 8, default: 1 - t.string "creator_id", limit: 255 - t.string "version", limit: 255 - t.string "comment", limit: 255 + t.string "creator_id" + t.string "version" + t.string "comment" t.integer "int_day_types", default: 0 t.date "start_date" t.date "end_date" @@ -740,49 +725,49 @@ ActiveRecord::Schema.define(version: 20170531154114) do add_index "time_tables_vehicle_journeys", ["vehicle_journey_id"], name: "index_time_tables_vehicle_journeys_on_vehicle_journey_id", using: :btree create_table "timebands", id: :bigserial, force: :cascade do |t| - t.string "objectid", limit: 255, null: false + t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id", limit: 255 - t.string "name", limit: 255 - t.time "start_time", null: false - t.time "end_time", null: false + t.string "creator_id" + t.string "name" + t.time "start_time", null: false + t.time "end_time", null: false t.datetime "created_at" t.datetime "updated_at" end create_table "users", id: :bigserial, force: :cascade do |t| - t.string "email", limit: 255, default: "", null: false - t.string "encrypted_password", limit: 255, default: "" - t.string "reset_password_token", limit: 255 + t.string "email", default: "", null: false + t.string "encrypted_password", default: "" + t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0 + t.integer "sign_in_count", default: 0 t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" - t.string "current_sign_in_ip", limit: 255 - t.string "last_sign_in_ip", limit: 255 + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" t.datetime "created_at" t.datetime "updated_at" t.integer "organisation_id", limit: 8 - t.string "name", limit: 255 - t.string "confirmation_token", limit: 255 + t.string "name" + t.string "confirmation_token" t.datetime "confirmed_at" t.datetime "confirmation_sent_at" - t.string "unconfirmed_email", limit: 255 - t.integer "failed_attempts", default: 0 - t.string "unlock_token", limit: 255 + t.string "unconfirmed_email" + t.integer "failed_attempts", default: 0 + t.string "unlock_token" t.datetime "locked_at" - t.string "authentication_token", limit: 255 - t.string "invitation_token", limit: 255 + t.string "authentication_token" + t.string "invitation_token" t.datetime "invitation_sent_at" t.datetime "invitation_accepted_at" t.integer "invitation_limit" t.integer "invited_by_id", limit: 8 - t.string "invited_by_type", limit: 255 + t.string "invited_by_type" t.datetime "invitation_created_at" - t.string "username", limit: 255 + t.string "username" t.datetime "synced_at" - t.string "permissions", limit: 255, array: true + t.string "permissions", array: true end add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree @@ -793,14 +778,14 @@ ActiveRecord::Schema.define(version: 20170531154114) do create_table "vehicle_journey_at_stops", id: :bigserial, force: :cascade do |t| t.integer "vehicle_journey_id", limit: 8 t.integer "stop_point_id", limit: 8 - t.string "connecting_service_id", limit: 255 - t.string "boarding_alighting_possibility", limit: 255 + t.string "connecting_service_id" + t.string "boarding_alighting_possibility" t.time "arrival_time" t.time "departure_time" - t.string "for_boarding", limit: 255 - t.string "for_alighting", limit: 255 - t.integer "departure_day_offset", default: 0 - t.integer "arrival_day_offset", default: 0 + t.string "for_boarding" + t.string "for_alighting" + t.integer "departure_day_offset", default: 0 + t.integer "arrival_day_offset", default: 0 end add_index "vehicle_journey_at_stops", ["stop_point_id"], name: "index_vehicle_journey_at_stops_on_stop_pointid", using: :btree @@ -810,20 +795,20 @@ ActiveRecord::Schema.define(version: 20170531154114) do t.integer "route_id", limit: 8 t.integer "journey_pattern_id", limit: 8 t.integer "company_id", limit: 8 - t.string "objectid", limit: 255, null: false + t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id", limit: 255 - t.string "comment", limit: 255 - t.string "status_value", limit: 255 - t.string "transport_mode", limit: 255 - t.string "published_journey_name", limit: 255 - t.string "published_journey_identifier", limit: 255 - t.string "facility", limit: 255 - t.string "vehicle_type_identifier", limit: 255 + t.string "creator_id" + t.string "comment" + t.string "status_value" + t.string "transport_mode" + t.string "published_journey_name" + t.string "published_journey_identifier" + t.string "facility" + t.string "vehicle_type_identifier" t.integer "number", limit: 8 t.boolean "mobility_restricted_suitability" t.boolean "flexible_service" - t.integer "journey_category", default: 0, null: false + t.integer "journey_category", default: 0, null: false t.datetime "created_at" t.datetime "updated_at" end @@ -832,7 +817,7 @@ ActiveRecord::Schema.define(version: 20170531154114) do add_index "vehicle_journeys", ["route_id"], name: "index_vehicle_journeys_on_route_id", using: :btree create_table "workbenches", id: :bigserial, force: :cascade do |t| - t.string "name", limit: 255 + t.string "name" t.integer "organisation_id", limit: 8 t.datetime "created_at" t.datetime "updated_at" @@ -844,18 +829,20 @@ ActiveRecord::Schema.define(version: 20170531154114) do add_index "workbenches", ["organisation_id"], name: "index_workbenches_on_organisation_id", using: :btree add_index "workbenches", ["stop_area_referential_id"], name: "index_workbenches_on_stop_area_referential_id", using: :btree - add_foreign_key "access_links", "access_points", name: "aclk_acpt_fkey", on_delete: :cascade + add_foreign_key "access_links", "access_points", name: "aclk_acpt_fkey" add_foreign_key "group_of_lines_lines", "group_of_lines", name: "groupofline_group_fkey", on_delete: :cascade - add_foreign_key "journey_frequencies", "timebands", name: "journey_frequencies_timeband_id_fk", on_delete: :nullify - add_foreign_key "journey_frequencies", "vehicle_journeys", name: "journey_frequencies_vehicle_journey_id_fk", on_delete: :nullify - add_foreign_key "journey_pattern_sections", "journey_patterns", name: "journey_pattern_sections_journey_pattern_id_fk", on_delete: :cascade - add_foreign_key "journey_pattern_sections", "route_sections", name: "journey_pattern_sections_route_section_id_fk", on_delete: :cascade + add_foreign_key "journey_frequencies", "timebands", on_delete: :nullify + add_foreign_key "journey_frequencies", "vehicle_journeys", on_delete: :nullify + add_foreign_key "journey_pattern_sections", "journey_patterns", on_delete: :cascade + add_foreign_key "journey_pattern_sections", "route_sections", on_delete: :cascade add_foreign_key "journey_patterns", "routes", name: "jp_route_fkey", on_delete: :cascade add_foreign_key "journey_patterns", "stop_points", column: "arrival_stop_point_id", name: "arrival_point_fkey", on_delete: :nullify add_foreign_key "journey_patterns", "stop_points", column: "departure_stop_point_id", name: "departure_point_fkey", on_delete: :nullify add_foreign_key "journey_patterns_stop_points", "journey_patterns", name: "jpsp_jp_fkey", on_delete: :cascade add_foreign_key "journey_patterns_stop_points", "stop_points", name: "jpsp_stoppoint_fkey", on_delete: :cascade - add_foreign_key "routes", "routes", column: "opposite_route_id", name: "route_opposite_route_fkey", on_delete: :nullify + add_foreign_key "route_sections", "stop_areas", column: "arrival_id" + add_foreign_key "route_sections", "stop_areas", column: "departure_id" + add_foreign_key "routes", "routes", column: "opposite_route_id", name: "route_opposite_route_fkey" add_foreign_key "stop_areas", "stop_areas", column: "parent_id", name: "area_parent_fkey", on_delete: :nullify add_foreign_key "stop_areas_stop_areas", "stop_areas", column: "child_id", name: "stoparea_child_fkey", on_delete: :cascade add_foreign_key "stop_areas_stop_areas", "stop_areas", column: "parent_id", name: "stoparea_parent_fkey", on_delete: :cascade diff --git a/spec/models/clean_up_spec.rb b/spec/models/clean_up_spec.rb index c495abdfe..c22d32eaa 100644 --- a/spec/models/clean_up_spec.rb +++ b/spec/models/clean_up_spec.rb @@ -4,6 +4,7 @@ RSpec.describe CleanUp, :type => :model do let(:cleaner) { CleanUp.new } it { should validate_presence_of(:begin_date) } + it { should validate_presence_of(:date_type) } it { should belong_to(:referential) } it 'should delete vehiclejourneys without timetables' do |
