Skip to content

Commit

Permalink
Merge pull request #71 from camsys/quarter3
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mathmerized authored Sep 25, 2018
2 parents df38b00 + 17bda45 commit 5b473d6
Show file tree
Hide file tree
Showing 14 changed files with 1,579 additions and 49 deletions.
1 change: 1 addition & 0 deletions app/controllers/activity_line_items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def assets
assets_json = @activity_line_item.assets.very_specific.limit(params[:limit]).offset(params[:offset]).order(sort_clause).collect{ |p|
asset_policy_analyzer = p.policy_analyzer
p.as_json.merge!({
asset_subtype: p.try(:asset_subtype).try(:to_s),
fuel_type: p.try(:fuel_type).try(:code),
age: p.age,
in_backlog: p.in_backlog,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
%th.bs-checkbox{:data => {:checkbox => 'true', :field => 'state'}}
%th.center{:data => {:field => 'object_key', :visible => 'false'}} Object
%th.left{data: {field: 'asset_tag'}} Tag
%th.left{data: {field: 'asset_subtype_id'}} Asset Subtype
%th.left{data: {field: 'asset_subtype'}} Asset Subtype
%th.center{data: {field: 'fuel_type'}} Fuel
%th.left{data: {field: 'description'}} Description

Expand Down
2 changes: 1 addition & 1 deletion app/views/capital_projects/_index_scripts.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
$(function() {
var last_tab = transam.get_ui_key_value('capital_project_index_tab');
if (last_tab) {
$('a[href='+last_tab+']').tab('show');
$('a[href="'+last_tab+'"]').tab('show');
} else {
// Default to the firsdt tab if no tab is stored
$('a[data-toggle="tab"]:first').tab('show');
Expand Down
8 changes: 4 additions & 4 deletions app/views/capital_projects/_index_table.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
%th.center.nowrap{data: {field: 'fy_year'}} #{get_fy_label}
%th.left.nowrap{data: {field: 'project_number'}} Project
%th.center.nowrap{data: {field: 'scope'}} Scope
%th.center{data: {field: 'is_emergency', formatter: 'boolean_formatter'}} Emgcy
%th.center{data: {field: 'is_sogr', formatter: 'boolean_formatter'}} SOGR
%th.center{data: {field: 'is_notional', formatter: 'boolean_formatter'}} Shadow
%th.center{data: {field: 'is_multi_year', formatter: 'boolean_formatter'}} Multi Year
%th.center{data: {field: 'is_emergency', formatter: 'raw_boolean_formatter'}} Emgcy
%th.center{data: {field: 'is_sogr', formatter: 'raw_boolean_formatter'}} SOGR
%th.center{data: {field: 'is_notional', formatter: 'raw_boolean_formatter'}} Shadow
%th.center{data: {field: 'is_multi_year', formatter: 'raw_boolean_formatter'}} Multi Year

%th.center{data: {field: 'type'}} Type
%th.left{data: {field: 'title'}} Title
Expand Down
2 changes: 1 addition & 1 deletion app/views/capital_projects/_scripts.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
$(function() {
var last_tab = transam.get_ui_key_value(tab_key);
if (last_tab) {
$('a[href='+last_tab+']').tab('show');
$('a[href="'+last_tab+'"]').tab('show');
} else {
// Default to the firsdt tab if no tab is stored
$('a[data-toggle="tab"]:first').tab('show');
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_cpt_filter_nav.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%i.fa.fa-filter
= " #{session[:user_activity_line_item_filter].to_s[0..31]}#{session[:user_activity_line_item_filter].to_s.length > 32 ? '...' : ''}"
%b.caret
%ul.dropdown-menu.columns-2
%ul.dropdown-menu.dropdown-menu-right.multi-column.columns-2{role: "menu", style: "overflow-y:scroll;max-height:400px;"}
.row
.col-sm-6
%ul.multi-column-dropdown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
$(function() {
var last_tab = transam.get_ui_key_value(user_tab_key);
if (last_tab) {
$('a[href='+last_tab+']').tab('show');
$('a[href="'+last_tab+'"]').tab('show');
} else {
// Default to the first tab if no tab is stored
$('a[data-toggle="tab"]:first').tab('show');
Expand Down
82 changes: 43 additions & 39 deletions db/cpt_asset_table_views.sql
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,8 @@ CREATE OR REPLACE VIEW capital_equipment_asset_table_views AS
fta_asset_class.fta_asset_category_id AS 'transit_asset_fta_asset_class_fta_asset_category_id',
fta_asset_class.name AS 'transit_asset_fta_asset_class_name',

fta_vehicle_type.active AS 'transit_asset_fta_type_active',
fta_vehicle_type.code AS 'transit_asset_fta_type_code',
fta_vehicle_type.default_useful_life_benchmark AS 'transit_asset_fta_type_default_useful_life_benchmark',
fta_vehicle_type.description AS 'transit_asset_fta_type_description',
fta_vehicle_type.fta_asset_class_id AS 'transit_asset_fta_type_fta_asset_class_id',
fta_vehicle_type.name AS 'transit_asset_fta_type_name',
fta_vehicle_type.useful_life_benchmark_unit AS 'transit_asset_fta_type_useful_life_benchmark_unit',
fta_equipment_type.active AS 'transit_asset_fta_type_active',
fta_equipment_type.name AS 'transit_asset_fta_type_name',

transamAs.asset_subtype_id AS 'transam_asset_asset_subtype_id',
transamAs.asset_tag AS 'asset_tag',
Expand Down Expand Up @@ -158,6 +153,7 @@ CREATE OR REPLACE VIEW capital_equipment_asset_table_views AS
policy.depreciation_interval_type_id AS 'transam_asset_org_policy_depreciation_interval_type_id',
policy.description AS 'transam_asset_org_policy_description',
policy.id AS 'transam_asset_org_policy_id',
policy.id AS 'policy_id',
policy.object_key AS 'transam_asset_org_policy_object_key',
policy.organization_id AS 'transam_asset_org_policy_organization_id',
policy.parent_id AS 'transam_asset_org_policy_parent_id',
Expand Down Expand Up @@ -229,7 +225,7 @@ CREATE OR REPLACE VIEW capital_equipment_asset_table_views AS
LEFT JOIN asset_fleets AS fleets ON fleets.id = aafleet.asset_fleet_id

LEFT JOIN fta_asset_classes AS fta_asset_class ON fta_asset_class.id = transitAs.fta_asset_class_id
LEFT JOIN fta_vehicle_types AS fta_vehicle_type ON fta_vehicle_type.id = transitAs.fta_type_id
LEFT JOIN fta_equipment_types AS fta_equipment_type ON fta_equipment_type.id = transitAs.fta_type_id
LEFT JOIN asset_subtypes AS ast ON ast.id = transamAs.asset_subtype_id
LEFT JOIN transam_assets AS location ON location.id = transamAs.location_id
LEFT JOIN manufacturers AS manufacturer ON manufacturer.id = transamAs.manufacturer_id
Expand Down Expand Up @@ -281,12 +277,13 @@ CREATE OR REPLACE VIEW capital_equipment_asset_table_views AS
LEFT JOIN assets_fta_mode_types AS afmt ON afmt.asset_id = transamAs.id AND afmt.is_primary
LEFT JOIN fta_mode_types AS fmt ON fmt.id = afmt.fta_mode_type_id
WHERE transitAs.fta_type_type = 'FtaEquipmentType';

-- ----------------------------------------------------------------------------------------------------------------
-- ----------------------------------------------------------------------------------------------------------------
-- ----------------------------------------------------------------------------------------------------------------
DROP VIEW if exists facility_primary_asset_table_views;
CREATE OR REPLACE VIEW facility_primary_asset_table_views AS
SELECT
SELECT
f.id,
f.id AS 'facility_id',
f.ada_accessible AS 'facility_ada_accessible',
Expand Down Expand Up @@ -323,7 +320,8 @@ CREATE OR REPLACE VIEW facility_primary_asset_table_views AS

esl_category.name AS 'facility_esl_category_name',

c.component_type_id AS 'facility_component_type_id',
component.id AS 'component_id',
component.component_type_id AS 'facility_component_type_id',

ct.name AS 'facility_component_type_name',

Expand Down Expand Up @@ -456,6 +454,7 @@ CREATE OR REPLACE VIEW facility_primary_asset_table_views AS
policy.depreciation_interval_type_id AS 'transam_asset_org_policy_depreciation_interval_type_id',
policy.description AS 'transam_asset_org_policy_description',
policy.id AS 'transam_asset_org_policy_id',
policy.id AS 'policy_id',
policy.object_key AS 'transam_asset_org_policy_object_key',
policy.organization_id AS 'transam_asset_org_policy_organization_id',
policy.parent_id AS 'transam_asset_org_policy_parent_id',
Expand Down Expand Up @@ -517,14 +516,18 @@ CREATE OR REPLACE VIEW facility_primary_asset_table_views AS

most_recent_early_replacement_event.replacement_status_type_id AS 'most_recent_early_replacement_event_replacement_status_type_id',
replacement_status.name AS 'most_recent_early_replacement_event_replacement_status_type_name'
FROM facilities AS f

LEFT JOIN esl_categories AS esl_category ON esl_category.id = f.esl_category_id

LEFT JOIN transit_assets AS transitAs ON transitAs.transit_assetible_id = f.id
AND transitAs.transit_assetible_type = 'Facility'
LEFT JOIN transam_assets AS transamAs ON transamAs.transam_assetible_id = transitAs.id
AND transamAs.transam_assetible_type = 'TransitAsset'
FROM transam_assets AS transamAs
LEFT JOIN transit_assets AS transitAs ON transitAs.id = transamAs.transam_assetible_id
-- AND transamAs.transam_assetible_type = 'TransitAsset'

LEFT JOIN facilities AS f ON (transamAs.parent_id > 0 AND f.id = transamAs.parent_id) OR (transamAs.parent_id IS NULL AND f.id = transitAs.transit_assetible_id)
AND transitAs.transit_assetible_type = 'Facility'
LEFT JOIN components AS component ON component.id = transitAs.transit_assetible_id
AND transitAs.transit_assetible_type = 'Component'

LEFT JOIN esl_categories AS esl_category ON esl_category.id = f.esl_category_id

LEFT JOIN asset_groups_assets AS ada ON ada.transam_asset_id = transamAs.id
LEFT JOIN asset_groups AS ag ON ag.id = ada.asset_group_id
Expand Down Expand Up @@ -584,19 +587,17 @@ CREATE OR REPLACE VIEW facility_primary_asset_table_views AS
LEFT JOIN assets_fta_mode_types AS afmt ON afmt.asset_id = transamAs.id AND afmt.is_primary
LEFT JOIN fta_mode_types AS fmt ON fmt.id = afmt.fta_mode_type_id

LEFT JOIN transam_assets AS cTransamAs ON cTransamAs.parent_id = transamAs.id
LEFT JOIN transit_assets AS cTransitAs ON cTransitAs.id = cTransamAs.transam_assetible_id
LEFT JOIN components AS c ON c.id = cTransitAs.transit_assetible_id
LEFT JOIN component_types AS ct ON ct.id = c.component_type_id
LEFT JOIN component_subtypes As cst on cst.id = c.component_subtype_id;
LEFT JOIN component_types AS ct ON ct.id = component.component_type_id
LEFT JOIN component_subtypes As cst on cst.id = component.component_subtype_id
WHERE transamAs.transam_assetible_type = 'TransitAsset' AND (f.id >0 OR component.id > 0);

-- ----------------------------------------------------------------------------------------------------------------
-- ----------------------------------------------------------------------------------------------------------------
-- ----------------------------------------------------------------------------------------------------------------

DROP VIEW if exists infrastructure_asset_table_views;
CREATE OR REPLACE VIEW infrastructure_asset_table_views AS
SELECT
SELECT
i.id,
i.id AS 'infrastructure_id',
i.cant AS 'infrastructure_cant',
Expand Down Expand Up @@ -695,13 +696,14 @@ CREATE OR REPLACE VIEW infrastructure_asset_table_views AS
fta_asset_class.fta_asset_category_id AS 'transit_asset_fta_asset_class_fta_asset_category_id',
fta_asset_class.name AS 'transit_asset_fta_asset_class_name',

fta_vehicle_type.active AS 'transit_asset_fta_type_active',
fta_vehicle_type.code AS 'transit_asset_fta_type_code',
fta_vehicle_type.default_useful_life_benchmark AS 'transit_asset_fta_type_default_useful_life_benchmark',
fta_vehicle_type.description AS 'transit_asset_fta_type_description',
fta_vehicle_type.fta_asset_class_id AS 'transit_asset_fta_type_fta_asset_class_id',
fta_vehicle_type.name AS 'transit_asset_fta_type_name',
fta_vehicle_type.useful_life_benchmark_unit AS 'transit_asset_fta_type_useful_life_benchmark_unit',
fta_guideway_type.active AS 'transit_asset_fta_guideway_type_active',
fta_guideway_type.name AS 'transit_asset_fta_guideway_type_name',

fta_power_type.active AS 'transit_asset_fta_power_and_signal_type_active',
fta_power_type.name AS 'transit_asset_fta_power_and_signal_type_name',

fta_track_type.active AS 'transit_asset_fta_track_type_active',
fta_track_type.name AS 'transit_asset_fta_track_type_name',

transamAs.asset_subtype_id AS 'transam_asset_asset_subtype_id',
transamAs.asset_tag AS 'asset_tag',
Expand Down Expand Up @@ -797,6 +799,7 @@ CREATE OR REPLACE VIEW infrastructure_asset_table_views AS
policy.depreciation_interval_type_id AS 'transam_asset_org_policy_depreciation_interval_type_id',
policy.description AS 'transam_asset_org_policy_description',
policy.id AS 'transam_asset_org_policy_id',
policy.id AS 'policy_id',
policy.object_key AS 'transam_asset_org_policy_object_key',
policy.organization_id AS 'transam_asset_org_policy_organization_id',
policy.parent_id AS 'transam_asset_org_policy_parent_id',
Expand Down Expand Up @@ -875,7 +878,11 @@ CREATE OR REPLACE VIEW infrastructure_asset_table_views AS
LEFT JOIN asset_fleets AS fleets ON fleets.id = aafleet.asset_fleet_id

LEFT JOIN fta_asset_classes AS fta_asset_class ON fta_asset_class.id = transitAs.fta_asset_class_id
LEFT JOIN fta_vehicle_types AS fta_vehicle_type ON fta_vehicle_type.id = transitAs.fta_type_id

LEFT JOIN fta_guideway_types AS fta_guideway_type ON fta_guideway_type.id = transitAs.fta_type_id
LEFT JOIN fta_power_signal_types AS fta_power_type ON fta_power_type.id = transitAs.fta_type_id
LEFT JOIN fta_track_types AS fta_track_type ON fta_track_type.id = transitAs.fta_type_id

LEFT JOIN asset_subtypes AS ast ON ast.id = transamAs.asset_subtype_id
LEFT JOIN transam_assets AS location ON location.id = transamAs.location_id
LEFT JOIN manufacturers AS manufacturer ON manufacturer.id = transamAs.manufacturer_id
Expand Down Expand Up @@ -931,7 +938,7 @@ CREATE OR REPLACE VIEW infrastructure_asset_table_views AS
-- ----------------------------------------------------------------------------------------------------------------
-- ----------------------------------------------------------------------------------------------------------------
DROP VIEW if exists revenue_vehicle_asset_table_views;
CREATE OR REPLACE VIEW revenue_vehicle_asset_table_views AS
CREATE OR REPLACE VIEW revenue_vehicle_asset_table_views AS
SELECT
rv.id,
rv.id AS 'revenue_vehicle_id',
Expand Down Expand Up @@ -1105,6 +1112,7 @@ CREATE OR REPLACE VIEW revenue_vehicle_asset_table_views AS
policy.depreciation_interval_type_id AS 'transam_asset_org_policy_depreciation_interval_type_id',
policy.description AS 'transam_asset_org_policy_description',
policy.id AS 'transam_asset_org_policy_id',
policy.id AS 'policy_id',
policy.object_key AS 'transam_asset_org_policy_object_key',
policy.organization_id AS 'transam_asset_org_policy_organization_id',
policy.parent_id AS 'transam_asset_org_policy_parent_id',
Expand Down Expand Up @@ -1296,13 +1304,8 @@ CREATE OR REPLACE VIEW service_vehicle_asset_table_views AS
fta_asset_class.fta_asset_category_id AS 'transit_asset_fta_asset_class_fta_asset_category_id',
fta_asset_class.name AS 'transit_asset_fta_asset_class_name',

fta_vehicle_type.active AS 'transit_asset_fta_type_active',
fta_vehicle_type.code AS 'transit_asset_fta_type_code',
fta_vehicle_type.default_useful_life_benchmark AS 'transit_asset_fta_type_default_useful_life_benchmark',
fta_vehicle_type.description AS 'transit_asset_fta_type_description',
fta_vehicle_type.fta_asset_class_id AS 'transit_asset_fta_type_fta_asset_class_id',
fta_vehicle_type.name AS 'transit_asset_fta_type_name',
fta_vehicle_type.useful_life_benchmark_unit AS 'transit_asset_fta_type_useful_life_benchmark_unit',
fta_support_vehicle_type.active AS 'transit_asset_fta_type_active',
fta_support_vehicle_type.name AS 'transit_asset_fta_type_name',

transamAs.asset_subtype_id AS 'transam_asset_asset_subtype_id',
transamAs.asset_tag AS 'asset_tag',
Expand Down Expand Up @@ -1398,6 +1401,7 @@ CREATE OR REPLACE VIEW service_vehicle_asset_table_views AS
policy.depreciation_interval_type_id AS 'transam_asset_org_policy_depreciation_interval_type_id',
policy.description AS 'transam_asset_org_policy_description',
policy.id AS 'transam_asset_org_policy_id',
policy.id AS 'policy_id',
policy.object_key AS 'transam_asset_org_policy_object_key',
policy.organization_id AS 'transam_asset_org_policy_organization_id',
policy.parent_id AS 'transam_asset_org_policy_parent_id',
Expand Down Expand Up @@ -1472,7 +1476,7 @@ CREATE OR REPLACE VIEW service_vehicle_asset_table_views AS
LEFT JOIN chasses AS chassis ON chassis.id = sv.chassis_id
LEFT JOIN fuel_types AS fuel_type ON fuel_type.id = sv.fuel_type_id
LEFT JOIN fta_asset_classes AS fta_asset_class ON fta_asset_class.id = transitAs.fta_asset_class_id
LEFT JOIN fta_vehicle_types AS fta_vehicle_type ON fta_vehicle_type.id = transitAs.fta_type_id
LEFT JOIN fta_support_vehicle_types AS fta_support_vehicle_type ON fta_support_vehicle_type.id = transitAs.fta_type_id
LEFT JOIN asset_subtypes AS ast ON ast.id = transamAs.asset_subtype_id
LEFT JOIN transam_assets AS location ON location.id = transamAs.location_id
LEFT JOIN manufacturers AS manufacturer ON manufacturer.id = transamAs.manufacturer_id
Expand Down
Loading

0 comments on commit 5b473d6

Please sign in to comment.