Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removing identifiers #1011

Merged
merged 3 commits into from
Mar 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/controllers/api/v1/feeds_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def index
@feeds = Feed.where('')
@feeds = AllowFiltering.by_onestop_id(@feeds, params)
@feeds = AllowFiltering.by_tag_keys_and_values(@feeds, params)
@feeds = AllowFiltering.by_identifer_and_identifier_starts_with(@feeds, params)
@feeds = AllowFiltering.by_updated_since(@feeds, params)

# Geometry
Expand Down
3 changes: 0 additions & 3 deletions app/controllers/api/v1/operators_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def index
@operators = Operator.where('')
@operators = AllowFiltering.by_onestop_id(@operators, params)
@operators = AllowFiltering.by_tag_keys_and_values(@operators, params)
@operators = AllowFiltering.by_identifer_and_identifier_starts_with(@operators, params)
@operators = AllowFiltering.by_updated_since(@operators, params)

# Imported From Feed
Expand Down Expand Up @@ -100,8 +99,6 @@ def aggregate

def query_params
params.slice(
:identifier,
:identifier_starts_with,
:lat,
:lon,
:r,
Expand Down
1 change: 0 additions & 1 deletion app/controllers/api/v1/route_stop_patterns_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def index
@rsps = RouteStopPattern.where('')
@rsps = AllowFiltering.by_onestop_id(@rsps, params)
@rsps = AllowFiltering.by_tag_keys_and_values(@rsps, params)
@rsps = AllowFiltering.by_identifer_and_identifier_starts_with(@rsps, params)
@rsps = AllowFiltering.by_updated_since(@rsps, params)

# Imported From Feed
Expand Down
3 changes: 0 additions & 3 deletions app/controllers/api/v1/routes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def index
@routes = Route.where('')
@routes = AllowFiltering.by_onestop_id(@routes, params)
@routes = AllowFiltering.by_tag_keys_and_values(@routes, params)
@routes = AllowFiltering.by_identifer_and_identifier_starts_with(@routes, params)
@routes = AllowFiltering.by_updated_since(@routes, params)

# Imported From Feed
Expand Down Expand Up @@ -106,8 +105,6 @@ def show

def query_params
params.slice(
:identifier,
:identifier_starts_with,
:operated_by,
:operatedBy,
:color,
Expand Down
3 changes: 0 additions & 3 deletions app/controllers/api/v1/stop_stations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def index
@stops = Stop.where(type: nil)
@stops = AllowFiltering.by_onestop_id(@stops, params)
@stops = AllowFiltering.by_tag_keys_and_values(@stops, params)
@stops = AllowFiltering.by_identifer_and_identifier_starts_with(@stops, params)
@stops = AllowFiltering.by_updated_since(@stops, params)

# Imported From Feed
Expand Down Expand Up @@ -121,8 +120,6 @@ def paginated_json_collection(collection)

def query_params
params.slice(
:identifier,
:identifier_starts_with,
:served_by,
:servedBy,
:lat,
Expand Down
3 changes: 0 additions & 3 deletions app/controllers/api/v1/stops_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def index
@stops = Stop.where('')
@stops = AllowFiltering.by_onestop_id(@stops, params)
@stops = AllowFiltering.by_tag_keys_and_values(@stops, params)
@stops = AllowFiltering.by_identifer_and_identifier_starts_with(@stops, params)
@stops = AllowFiltering.by_updated_since(@stops, params)

# Imported From Feed
Expand Down Expand Up @@ -93,8 +92,6 @@ def paginated_json_collection(collection)

def query_params
params.slice(
:identifier,
:identifier_starts_with,
:served_by,
:servedBy,
:lat,
Expand Down
9 changes: 0 additions & 9 deletions app/controllers/concerns/allow_filtering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,6 @@ def self.by_updated_since(collection, params)
collection
end

def self.by_identifer_and_identifier_starts_with(collection, params)
if params[:identifier].present?
collection = collection.with_identifier_or_name(params[:identifier])
elsif params[:identifier_starts_with].present?
collection = collection.with_identifier_starting_with(params[:identifier_starts_with])
end
collection
end

def self.by_boolean_attribute(collection, params, boolean_attribute_name)
unless params[boolean_attribute_name].nil?
conditions = {}
Expand Down
18 changes: 0 additions & 18 deletions app/models/concerns/is_an_entity_with_identifiers.rb

This file was deleted.

4 changes: 1 addition & 3 deletions app/models/feed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ class Feed < BaseFeed
:includes_operators,
:does_not_include_operators
],
protected_attributes: [
:identifiers
]
protected_attributes: []
})

def update_associations(changeset)
Expand Down
14 changes: 0 additions & 14 deletions app/models/json_schemas/operator.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,6 @@
"$ref": "./imported_from_feed.json"
}
},
"identifiedBy": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
},
"notIdentifiedBy": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
},
"serves": {
"type": "array",
"uniqueItems": true,
Expand Down
14 changes: 0 additions & 14 deletions app/models/json_schemas/route.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,6 @@
"$ref": "./imported_from_feed.json"
}
},
"identifiedBy": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
},
"notIdentifiedBy": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
},
"serves": {
"type": "array",
"uniqueItems": true,
Expand Down
7 changes: 0 additions & 7 deletions app/models/json_schemas/route_stop_pattern.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@
"$ref": "./imported_from_feed.json"
}
},
"identifiedBy": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
},
"onestopId": {"type": "string"},
"newOnestopId": {"type": "string"},
"onestopIdsToMerge": {
Expand Down
14 changes: 0 additions & 14 deletions app/models/json_schemas/stop.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,6 @@
"$ref": "./imported_from_feed.json"
}
},
"identifiedBy": {
"type": ["array", "null"],
"uniqueItems": true,
"items": {
"type": "string"
}
},
"notIdentifiedBy": {
"type": ["array", "null"],
"uniqueItems": true,
"items": {
"type": "string"
}
},
"servedBy": {
"type": ["array", "null"],
"uniqueItems": true,
Expand Down
20 changes: 6 additions & 14 deletions app/models/operator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# geometry :geography({:srid geometry, 4326
# created_or_updated_in_changeset_id :integer
# version :integer
# identifiers :string default([]), is an Array
# timezone :string
# short_name :string
# website :string
Expand All @@ -22,12 +21,11 @@
#
# Indexes
#
# #c_operators_cu_in_changeset_id_index (created_or_updated_in_changeset_id)
# index_current_operators_on_geometry (geometry)
# index_current_operators_on_identifiers (identifiers)
# index_current_operators_on_onestop_id (onestop_id) UNIQUE
# index_current_operators_on_tags (tags)
# index_current_operators_on_updated_at (updated_at)
# #c_operators_cu_in_changeset_id_index (created_or_updated_in_changeset_id)
# index_current_operators_on_geometry (geometry)
# index_current_operators_on_onestop_id (onestop_id) UNIQUE
# index_current_operators_on_tags (tags)
# index_current_operators_on_updated_at (updated_at)
#

class BaseOperator < ActiveRecord::Base
Expand All @@ -40,7 +38,6 @@ class Operator < BaseOperator
self.table_name_prefix = 'current_'

include HasAOnestopId
include IsAnEntityWithIdentifiers
include HasAGeographicGeometry
include HasTags
include UpdatedSince
Expand Down Expand Up @@ -69,14 +66,10 @@ def csv_row_values
virtual_attributes: [
:serves,
:does_not_serve,
:identified_by,
:not_identified_by,
:add_imported_from_feeds,
:not_imported_from_feeds
],
protected_attributes: [
:identifiers
],
protected_attributes: [],
sticky_attributes: [
:short_name,
:country,
Expand Down Expand Up @@ -169,7 +162,6 @@ def self.from_gtfs(entity, attrs={})
def set_default_values
if self.new_record?
self.tags ||= {}
self.identifiers ||= []
end
end

Expand Down
9 changes: 1 addition & 8 deletions app/models/route.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# created_at :datetime
# updated_at :datetime
# geometry :geography({:srid geometry, 4326
# identifiers :string default([]), is an Array
# vehicle_type :integer
# color :string
# edited_attributes :string default([]), is an Array
Expand All @@ -24,7 +23,6 @@
# c_route_cu_in_changeset (created_or_updated_in_changeset_id)
# index_current_routes_on_bikes_allowed (bikes_allowed)
# index_current_routes_on_geometry (geometry)
# index_current_routes_on_identifiers (identifiers)
# index_current_routes_on_onestop_id (onestop_id) UNIQUE
# index_current_routes_on_operator_id (operator_id)
# index_current_routes_on_tags (tags)
Expand All @@ -51,7 +49,6 @@ class Route < BaseRoute
self.table_name_prefix = 'current_'

include HasAOnestopId
include IsAnEntityWithIdentifiers
include HasAGeographicGeometry
include HasTags
include UpdatedSince
Expand Down Expand Up @@ -84,14 +81,10 @@ def csv_row_values
:serves,
:does_not_serve,
:operated_by,
:identified_by,
:not_identified_by,
:add_imported_from_feeds,
:not_imported_from_feeds
],
protected_attributes: [
:identifiers
],
protected_attributes: [],
sticky_attributes: [
:name,
:geometry,
Expand Down
9 changes: 1 addition & 8 deletions app/models/route_stop_pattern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# stop_pattern :string default([]), is an Array
# version :integer
# trips :string default([]), is an Array
# identifiers :string default([]), is an Array
# created_at :datetime not null
# updated_at :datetime not null
# created_or_updated_in_changeset_id :integer
Expand All @@ -21,7 +20,6 @@
# Indexes
#
# c_rsp_cu_in_changeset (created_or_updated_in_changeset_id)
# index_current_route_stop_patterns_on_identifiers (identifiers)
# index_current_route_stop_patterns_on_onestop_id (onestop_id) UNIQUE
# index_current_route_stop_patterns_on_route_id (route_id)
# index_current_route_stop_patterns_on_stop_pattern (stop_pattern)
Expand Down Expand Up @@ -71,7 +69,6 @@ def correct_stop_distances_length
end

include HasAOnestopId
include IsAnEntityWithIdentifiers
include HasAGeographicGeometry
include HasTags
include UpdatedSince
Expand All @@ -83,15 +80,11 @@ def correct_stop_distances_length
current_tracked_by_changeset({
kind_of_model_tracked: :onestop_entity,
virtual_attributes: [
:identified_by,
:not_identified_by,
:traversed_by,
:add_imported_from_feeds,
:not_imported_from_feeds
],
protected_attributes: [
:identifiers
],
protected_attributes: [],
sticky_attributes: [
:geometry
]
Expand Down
6 changes: 0 additions & 6 deletions app/models/stop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# name :string
# created_or_updated_in_changeset_id :integer
# version :integer
# identifiers :string default([]), is an Array
# timezone :string
# last_conflated_at :datetime
# type :string
Expand All @@ -24,7 +23,6 @@
#
# #c_stops_cu_in_changeset_id_index (created_or_updated_in_changeset_id)
# index_current_stops_on_geometry (geometry)
# index_current_stops_on_identifiers (identifiers)
# index_current_stops_on_onestop_id (onestop_id) UNIQUE
# index_current_stops_on_parent_stop_id (parent_stop_id)
# index_current_stops_on_tags (tags)
Expand All @@ -44,7 +42,6 @@ class Stop < BaseStop
validates :timezone, presence: true

include HasAOnestopId
include IsAnEntityWithIdentifiers
include HasAGeographicGeometry
include HasTags
include UpdatedSince
Expand Down Expand Up @@ -79,15 +76,12 @@ def csv_row_values
virtual_attributes: [
:served_by,
:not_served_by,
:identified_by,
:not_identified_by,
:includes_stop_transfers,
:does_not_include_stop_transfers,
:add_imported_from_feeds,
:not_imported_from_feeds
],
protected_attributes: [
:identifiers,
:last_conflated_at,
:type
],
Expand Down
Loading