diff options
| author | cedricnjanga | 2018-01-12 14:51:00 +0100 |
|---|---|---|
| committer | cedricnjanga | 2018-01-12 14:56:34 +0100 |
| commit | 907e0300cc2ff77df67171642c7cc5579a34163a (patch) | |
| tree | 8b8eb904f918ad401004f3e1ae160c27c9aaa3df | |
| parent | 04e7d217a77e6b2c70a4a5994993bf0c0bbff08e (diff) | |
| download | chouette-core-907e0300cc2ff77df67171642c7cc5579a34163a.tar.bz2 | |
Refs #5163
Add compliance check resource status helper
Add small changes for CSV export
| -rw-r--r-- | app/controllers/compliance_check_messages_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/import_messages_controller.rb | 2 | ||||
| -rw-r--r-- | app/helpers/compliance_check_resources_helper.rb | 12 | ||||
| -rw-r--r-- | app/views/compliance_check_sets/show.html.slim | 2 | ||||
| -rw-r--r-- | db/schema.rb | 8 |
5 files changed, 19 insertions, 7 deletions
diff --git a/app/controllers/compliance_check_messages_controller.rb b/app/controllers/compliance_check_messages_controller.rb index 73a821e79..1e4fff6e5 100644 --- a/app/controllers/compliance_check_messages_controller.rb +++ b/app/controllers/compliance_check_messages_controller.rb @@ -7,7 +7,7 @@ class ComplianceCheckMessagesController < ChouetteController def index index! do |format| format.csv { - send_data ComplianceCheckMessageExport.new(compliance_check_messages: collection).to_csv(:col_sep => ",") , :filename => "compliance_check_set_errors_#{line_code}_#{Time.now.to_i}.csv" + send_data ComplianceCheckMessageExport.new(compliance_check_messages: collection).to_csv(:col_sep => "\;", :quote_char=>'"', force_quotes: true) , :filename => "compliance_check_set_errors_#{line_code}_#{Time.now.to_i}.csv" } end end diff --git a/app/controllers/import_messages_controller.rb b/app/controllers/import_messages_controller.rb index 1862d763e..286bb0ce8 100644 --- a/app/controllers/import_messages_controller.rb +++ b/app/controllers/import_messages_controller.rb @@ -9,7 +9,7 @@ class ImportMessagesController < ChouetteController def index index! do |format| format.csv { - send_data ImportMessageExport.new(:import_messages => @import_messages).to_csv(:col_sep => ",") , :filename => "import_errors_#{@import_resource.name.gsub('.xml', '')}_#{Time.now.to_i}.csv" + send_data ImportMessageExport.new(:import_messages => @import_messages).to_csv(:col_sep => "\;", :quote_char=>'"', force_quotes: true) , :filename => "import_errors_#{@import_resource.name.gsub('.xml', '')}_#{Time.now.to_i}.csv" } end end diff --git a/app/helpers/compliance_check_resources_helper.rb b/app/helpers/compliance_check_resources_helper.rb new file mode 100644 index 000000000..95cabed88 --- /dev/null +++ b/app/helpers/compliance_check_resources_helper.rb @@ -0,0 +1,12 @@ +module ComplianceCheckResourcesHelper + + # Comlpiance Check Resources statuses helper + def compliance_check_resource_status(status) + cls = '' + cls = 'success' if status == 'OK' + cls = 'warning' if status == 'WARNING' + cls = 'danger' if %w[ERROR IGNORED].include? status + + content_tag :span, '', class: "fa fa-circle text-#{cls}" + end +end diff --git a/app/views/compliance_check_sets/show.html.slim b/app/views/compliance_check_sets/show.html.slim index 9644ed5a2..35a60eb52 100644 --- a/app/views/compliance_check_sets/show.html.slim +++ b/app/views/compliance_check_sets/show.html.slim @@ -46,7 +46,7 @@ ), \ TableBuilderHelper::Column.new( \ key: :status, \ - attribute: Proc.new { |n| compliance_check_set_status(n.status) } \ + attribute: Proc.new { |n| compliance_check_resource_status(n.status) } \ ), \ TableBuilderHelper::Column.new( \ key: :metrics, \ diff --git a/db/schema.rb b/db/schema.rb index f2cf6b4b6..0f5d796c5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -416,9 +416,9 @@ ActiveRecord::Schema.define(version: 20180111200406) do t.string "type" t.integer "parent_id", limit: 8 t.string "parent_type" - t.datetime "notified_parent_at" t.integer "current_step", default: 0 t.integer "total_steps", default: 0 + t.datetime "notified_parent_at" t.string "creator" end @@ -956,7 +956,7 @@ ActiveRecord::Schema.define(version: 20180111200406) do t.integer "route_id", limit: 8 t.integer "journey_pattern_id", limit: 8 t.integer "company_id", limit: 8 - t.string "objectid", null: false + t.string "objectid", null: false t.integer "object_version", limit: 8 t.string "comment" t.string "status_value" @@ -968,13 +968,13 @@ ActiveRecord::Schema.define(version: 20180111200406) do 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" t.string "checksum" t.text "checksum_source" t.string "data_source_ref" - t.jsonb "custom_field_values" + t.jsonb "custom_field_values", default: {} end add_index "vehicle_journeys", ["objectid"], name: "vehicle_journeys_objectid_key", unique: true, using: :btree |
