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

Production release 4.9.14 #863

Merged
merged 56 commits into from
Dec 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
c3d3651
OperatorInFeed: Unique on (feed, gtfs_agency_id)
irees Aug 18, 2016
7f2b1c6
Feed: includes_operators / does_not_include_operators finds by (opera…
irees Aug 18, 2016
03a2286
Feed: distinct operators through operators_in_feed
irees Aug 18, 2016
c7d5f3a
Feed JSON schema: doesNotIncludeOperators now requires gtfsAgencyId
irees Aug 18, 2016
e886a5f
Feed spec: Modifying OIF gtfs_agency_id is now 2 step: add new OIF, r…
irees Aug 18, 2016
0f59e4c
Feed spec: doesNotIncludeOperators requires gtfs_agency_id
irees Aug 18, 2016
e11ba8f
OperatorsInFeed spec
irees Aug 18, 2016
03c12f1
issue created for missing stop conflate results
doublestranded Oct 27, 2016
9c25c57
null island stop_inaccurate issue
doublestranded Oct 28, 2016
ce6a4ca
specs of no-geom stops pass
doublestranded Oct 28, 2016
d8d3367
Merge remote-tracking branch 'origin' into null-island-stop-issues
doublestranded Nov 17, 2016
5a5321a
checking nil no longer necessary
doublestranded Nov 17, 2016
d313d62
fixing jsonapi
doublestranded Nov 18, 2016
9696dd5
copying operator geoms over to feed
doublestranded Nov 21, 2016
246e1e6
Changelog [ci skip]
irees Nov 21, 2016
eacec0d
Merge pull request #860 from transitland/sample-changeset-with-feed-g…
doublestranded Nov 22, 2016
d0aef71
feed issue associations and serialization
doublestranded Nov 22, 2016
c9d760a
issue serializer hash
doublestranded Nov 28, 2016
71475d5
changing to changeset id
doublestranded Nov 28, 2016
7e747de
Merge pull request #865 from transitland/feed-fetch-issue-associations
doublestranded Nov 28, 2016
58edbee
Migration: add FeedVersion earliest_calendar_date / latest_calendar_d…
irees Nov 29, 2016
010a66c
Annotation updates
irees Nov 29, 2016
75d046e
FeedVersion calendar scopes
irees Nov 29, 2016
e649aa8
rename to where_
irees Nov 29, 2016
1401592
FeedVersions controller: add calendar coverage queries
irees Nov 29, 2016
0a041a0
FeedVersion spec: where_calendar_coverage_begins_at_or_before
irees Nov 29, 2016
34e4f24
Additional specs
irees Dec 2, 2016
7d4910c
FeedVersion controller specs
irees Dec 2, 2016
9fa43e0
Merge branch 'master' into oif-allow-duplicates
irees Dec 3, 2016
3d4782e
Spec for multiple gtfs agency_id's pointing to same Operator
irees Dec 3, 2016
941d3bd
Merge pull request #743 from transitland/oif-allow-duplicates
irees Dec 3, 2016
04303a7
update gems
drewda Dec 5, 2016
9e4ad18
Merge pull request #870 from transitland/update-gems
drewda Dec 5, 2016
8d1021e
Merge pull request #867 from transitland/feed-filter-calendar-dates
irees Dec 5, 2016
da6d9ff
Merge remote-tracking branch 'origin' into null-island-stop-issues
doublestranded Dec 6, 2016
dbca1df
throwing out nil stop geoms for tests
doublestranded Dec 6, 2016
60ccd9b
Revert "throwing out nil stop geoms for tests"
doublestranded Dec 6, 2016
5876581
Merge pull request #845 from transitland/null-island-stop-issues
doublestranded Dec 6, 2016
a9751e6
FeedFetcherService: Run feedvalidator
irees Dec 7, 2016
9e7a560
Remove FeedEater feedvalidator
irees Dec 7, 2016
36389e5
FeedVersion: add file_feedvalidator
irees Dec 7, 2016
ba3cafe
gem update: webmock
irees Dec 7, 2016
c725af4
Check env vars before running feedvalidator
irees Dec 7, 2016
7a43009
Better tmpfile handling
irees Dec 7, 2016
bb232c3
FeedVersionUploaderFeedvalidator attachment handler
irees Dec 7, 2016
400a3a8
Mount FeedVersionUploaderFeedvalidator
irees Dec 7, 2016
b5d9efa
Download url for feedvalidator results
irees Dec 7, 2016
20b8c1b
Clearer check
irees Dec 7, 2016
c9a15c1
FeedVersion serializer: add feedvalidator_url
irees Dec 7, 2016
4782845
Merge pull request #872 from transitland/feedvalidator-attachment
irees Dec 7, 2016
b685b96
Serializer fix
irees Dec 7, 2016
417296c
Only run feedvalidator on new, unseen FeedVersions
irees Dec 7, 2016
afeec96
Spec update
irees Dec 7, 2016
3ad6725
Merge pull request #873 from transitland/feedvalidator-attachment-fixes
irees Dec 7, 2016
e8fc74b
FeedVersion serializer: url [ci skip]
irees Dec 7, 2016
dc6058c
Merge pull request #874 from transitland/feed-version-serializer-url
irees Dec 7, 2016
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
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,28 @@

## [Unreleased](https://github.com/transitland/transitland-datastore/tree/HEAD)

[Full Changelog](https://github.com/transitland/transitland-datastore/compare/4.9.12...HEAD)
[Full Changelog](https://github.com/transitland/transitland-datastore/compare/4.9.13...HEAD)

**Merged pull requests:**

- Production release 4.9.13 [\#858](https://github.com/transitland/transitland-datastore/pull/858) ([irees](https://github.com/irees))

## [4.9.13](https://github.com/transitland/transitland-datastore/tree/4.9.13) (2016-11-21)
[Full Changelog](https://github.com/transitland/transitland-datastore/compare/4.9.12...4.9.13)

**Implemented enhancements:**

- When bulk deactivating issues, make sure it's done asynchronously [\#787](https://github.com/transitland/transitland-datastore/issues/787)

**Closed issues:**

- Override stops controller to use 'stops' as root [\#862](https://github.com/transitland/transitland-datastore/issues/862)
- Save Feed fetch errors as issues [\#820](https://github.com/transitland/transitland-datastore/issues/820)

**Merged pull requests:**

- Stop serializer root fix [\#861](https://github.com/transitland/transitland-datastore/pull/861) ([irees](https://github.com/irees))
- feed fetch errors create issues [\#844](https://github.com/transitland/transitland-datastore/pull/844) ([doublestranded](https://github.com/doublestranded))
- Production release 4.9.12 [\#843](https://github.com/transitland/transitland-datastore/pull/843) ([irees](https://github.com/irees))

## [4.9.12](https://github.com/transitland/transitland-datastore/tree/4.9.12) (2016-11-14)
Expand Down
76 changes: 39 additions & 37 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ GEM
activemodel (= 4.2.7.1)
activesupport (= 4.2.7.1)
arel (~> 6.0)
activerecord-import (0.16.1)
activerecord-import (0.16.2)
activerecord (>= 3.2)
activerecord-postgis-adapter (3.1.4)
activerecord (~> 4.2)
Expand All @@ -88,12 +88,14 @@ GEM
rake (>= 10.4, < 12.0)
arel (6.0.3)
ast (2.3.0)
aws-sdk (2.6.12)
aws-sdk-resources (= 2.6.12)
aws-sdk-core (2.6.12)
aws-sdk (2.6.32)
aws-sdk-resources (= 2.6.32)
aws-sdk-core (2.6.32)
aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
aws-sdk-resources (2.6.12)
aws-sdk-core (= 2.6.12)
aws-sdk-resources (2.6.32)
aws-sdk-core (= 2.6.32)
aws-sigv4 (1.0.0)
bcrypt (3.1.11)
better_errors (2.1.1)
coderay (>= 1.0.0)
Expand All @@ -111,7 +113,7 @@ GEM
chronic (0.10.2)
coderay (1.1.1)
concurrent-ruby (1.0.2)
connection_pool (2.2.0)
connection_pool (2.2.1)
crack (0.4.3)
safe_yaml (~> 1.0.0)
database_cleaner (1.5.3)
Expand All @@ -124,7 +126,7 @@ GEM
warden (~> 1.2.3)
diff-lcs (1.2.5)
docile (1.1.5)
domain_name (0.5.20160826)
domain_name (0.5.20161129)
unf (>= 0.0.5, < 1.0.0)
email_validator (1.6.0)
activemodel
Expand All @@ -137,12 +139,12 @@ GEM
factory_girl_rails (4.7.0)
factory_girl (~> 4.7.0)
railties (>= 3.0.0)
faraday (0.9.2)
faraday (0.10.0)
multipart-post (>= 1.2, < 3)
ffaker (2.2.0)
ffaker (2.3.0)
figaro (1.1.1)
thor (~> 0.14)
fog-aws (0.12.0)
fog-aws (0.13.0)
fog-core (~> 1.38)
fog-json (~> 1.0)
fog-xml (~> 0.1)
Expand All @@ -162,7 +164,7 @@ GEM
formatador (0.2.5)
globalid (0.3.7)
activesupport (>= 4.1.0)
hashdiff (0.3.0)
hashdiff (0.3.1)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (0.7.0)
Expand All @@ -179,7 +181,7 @@ GEM
jsonapi-renderer (0.1.1.beta1)
kgio (2.10.0)
logstash-event (1.2.02)
logstasher (1.0.1)
logstasher (1.1.0)
activerecord (>= 4.0)
activesupport (>= 4.0)
logstash-event (~> 1.2.0)
Expand All @@ -191,25 +193,25 @@ GEM
marginalia (1.4.0)
actionpack (>= 2.3)
activerecord (>= 2.3)
memory_profiler (0.9.6)
memory_profiler (0.9.7)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.9.1)
minitest (5.10.1)
multi_json (1.12.1)
multipart-post (2.0.0)
netrc (0.11.0)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
oj (2.17.5)
oj (2.18.0)
oj_mimic_json (1.0.1)
orm_adapter (0.5.0)
parser (2.3.1.4)
parser (2.3.3.1)
ast (~> 2.2)
pg (0.19.0)
pghero (1.6.0)
pghero (1.6.2)
activerecord
polyamorous (1.1.0)
activerecord (>= 3.0)
Expand All @@ -218,7 +220,7 @@ GEM
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-byebug (3.4.0)
pry-byebug (3.4.1)
byebug (~> 9.0)
pry (~> 0.10)
pry-rails (0.3.4)
Expand All @@ -229,7 +231,7 @@ GEM
pry-stack_explorer (0.4.9.2)
binding_of_caller (>= 0.7)
pry (>= 0.9.11)
rack (1.6.4)
rack (1.6.5)
rack-cors (0.4.0)
rack-protection (1.5.3)
rack
Expand Down Expand Up @@ -268,17 +270,17 @@ GEM
raindrops (0.17.0)
rake (11.3.0)
rcsv (0.3.1)
redis (3.3.1)
redis-actionpack (5.0.0)
actionpack (>= 4.0.0, < 6)
redis-rack (~> 2.0.0.pre)
redis-store (~> 1.2.0.pre)
redis (3.3.2)
redis-actionpack (5.0.1)
actionpack (>= 4.0, < 6)
redis-rack (>= 1, < 3)
redis-store (>= 1.1.0, < 1.4.0)
redis-activesupport (5.0.1)
activesupport (>= 3, < 6)
redis-store (~> 1.2.0)
redis-rack (2.0.0.pre)
rack (> 1.5, < 3)
redis-store (~> 1.2.0.pre)
redis-rack (1.6.0)
rack (~> 1.5)
redis-store (~> 1.2.0)
redis-rails (5.0.1)
redis-actionpack (~> 5.0.0)
redis-activesupport (~> 5.0.0)
Expand Down Expand Up @@ -325,21 +327,21 @@ GEM
rspec_junit_formatter (0.2.2)
builder (< 4)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (0.44.1)
rubocop (0.46.0)
parser (>= 2.3.1.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
rubocop-rspec (1.7.0)
rubocop-rspec (1.8.0)
rubocop (>= 0.42.0)
ruby-graphviz (1.2.2)
ruby-progressbar (1.8.1)
rubyzip (1.2.0)
safe_yaml (1.0.4)
sentry-raven (2.1.2)
faraday (>= 0.7.6, < 0.10.x)
sidekiq (4.2.3)
sentry-raven (2.2.0)
faraday (>= 0.7.6, < 1.0)
sidekiq (4.2.7)
concurrent-ruby (~> 1.0)
connection_pool (~> 2.2, >= 2.2.0)
rack-protection (>= 1.5.0)
Expand Down Expand Up @@ -373,7 +375,7 @@ GEM
activesupport (>= 3.0)
polyamorous (~> 1.1.0)
text (1.3.1)
thor (0.19.1)
thor (0.19.4)
thread_safe (0.3.5)
tilt (2.0.5)
timecop (0.8.1)
Expand All @@ -383,14 +385,14 @@ GEM
unf_ext
unf_ext (0.0.7.2)
unicode-display_width (1.1.1)
unicorn (5.1.0)
unicorn (5.2.0)
kgio (~> 2.6)
raindrops (~> 0.7)
uniform_notifier (1.10.0)
vcr (3.0.3)
warden (1.2.6)
rack (>= 1.0)
webmock (2.1.0)
webmock (2.3.1)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
Expand Down Expand Up @@ -464,4 +466,4 @@ DEPENDENCIES
whenever

BUNDLED WITH
1.13.2
1.13.6
18 changes: 18 additions & 0 deletions app/controllers/api/v1/feed_versions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,24 @@ def index
@feed_versions = @feed_versions.where(sha1: sha1s)
end

if params[:calendar_coverage_begins_at_or_before].present?
@feed_versions = @feed_versions.where_calendar_coverage_begins_at_or_before(
params[:calendar_coverage_begins_at_or_before]
)
end

if params[:calendar_coverage_begins_at_or_after].present?
@feed_versions = @feed_versions.where_calendar_coverage_begins_at_or_after(
params[:calendar_coverage_begins_at_or_after]
)
end

if params[:calendar_coverage_includes].present?
@feed_versions = @feed_versions.where_calendar_coverage_includes(
params[:calendar_coverage_includes]
)
end

if params[:feed_onestop_id].present?
feed_onestop_ids = params[:feed_onestop_id].split(',')
@feed_versions = @feed_versions.where(feed: Feed.where(onestop_id: feed_onestop_ids))
Expand Down
17 changes: 14 additions & 3 deletions app/models/feed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,16 @@ class Feed < BaseFeed
include HasTags
include UpdatedSince
include HasAGeographicGeometry
include IsAnEntityWithIssues

has_many :feed_versions, -> { order 'created_at DESC' }, dependent: :destroy, as: :feed
has_many :feed_version_imports, -> { order 'created_at DESC' }, through: :feed_versions
belongs_to :active_feed_version, class_name: 'FeedVersion'

has_many :operators_in_feed
has_many :operators, through: :operators_in_feed
has_many :operators, -> { distinct }, through: :operators_in_feed

has_many :issues, through: :entities_with_issues

has_many :entities_imported_from_feed
has_many :imported_operators, through: :entities_imported_from_feed, source: :entity, source_type: 'Operator'
Expand Down Expand Up @@ -176,7 +179,11 @@ def after_create_making_history(changeset)
def before_update_making_history(changeset)
(self.includes_operators || []).each do |included_operator|
operator = Operator.find_by!(onestop_id: included_operator[:operator_onestop_id])
existing_relationship = OperatorInFeed.find_by(operator: operator, feed: self)
existing_relationship = OperatorInFeed.find_by(
operator: operator,
gtfs_agency_id: included_operator[:gtfs_agency_id],
feed: self
)
if existing_relationship
existing_relationship.update_making_history(
changeset: changeset,
Expand All @@ -199,7 +206,11 @@ def before_update_making_history(changeset)
end
(self.does_not_include_operators || []).each do |not_included_operator|
operator = Operator.find_by!(onestop_id: not_included_operator[:operator_onestop_id])
existing_relationship = OperatorInFeed.find_by(operator: operator, feed: self)
existing_relationship = OperatorInFeed.find_by(
operator: operator,
gtfs_agency_id: not_included_operator[:gtfs_agency_id],
feed: self
)
if existing_relationship
existing_relationship.destroy_making_history(changeset: changeset)
end
Expand Down
29 changes: 28 additions & 1 deletion app/models/feed_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@
# file_raw :string
# sha1_raw :string
# md5_raw :string
# file_feedvalidator :string
#
# Indexes
#
# index_feed_versions_on_feed_type_and_feed_id (feed_type,feed_id)
# index_feed_versions_on_earliest_calendar_date (earliest_calendar_date)
# index_feed_versions_on_feed_type_and_feed_id (feed_type,feed_id)
# index_feed_versions_on_latest_calendar_date (latest_calendar_date)
#

class FeedVersion < ActiveRecord::Base
Expand All @@ -40,6 +43,7 @@ class FeedVersion < ActiveRecord::Base

mount_uploader :file, FeedVersionUploader
mount_uploader :file_raw, FeedVersionUploaderRaw
mount_uploader :file_feedvalidator, FeedVersionUploaderFeedvalidator

validates :sha1, presence: true, uniqueness: true
validates :feed, presence: true
Expand All @@ -50,6 +54,22 @@ class FeedVersion < ActiveRecord::Base
joins('INNER JOIN current_feeds ON feed_versions.id = current_feeds.active_feed_version_id')
}

scope :where_calendar_coverage_begins_at_or_before, -> (date) {
date = date.is_a?(Date) ? date : Date.parse(date)
where('earliest_calendar_date <= ?', date)
}

scope :where_calendar_coverage_begins_at_or_after, -> (date) {
date = date.is_a?(Date) ? date : Date.parse(date)
where('earliest_calendar_date >= ?', date)
}

scope :where_calendar_coverage_includes, -> (date) {
date = date.is_a?(Date) ? date : Date.parse(date)
where('earliest_calendar_date <= ?', date)
.where('latest_calendar_date >= ?', date)
}

def succeeded(timestamp)
self.update(imported_at: timestamp)
self.feed.update(last_imported_at: self.imported_at)
Expand Down Expand Up @@ -102,6 +122,13 @@ def download_url
end
end

def feedvalidator_url
if self.try(:file_feedvalidator).try(:url)
# we don't want to include any query parameters
self.file_feedvalidator.url.split('?').first
end
end

private

def compute_and_set_hashes
Expand Down
1 change: 1 addition & 0 deletions app/models/issue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Issue < ActiveRecord::Base
enumerize :issue_type,
in: ['stop_position_inaccurate',
'stop_rsp_distance_gap',
'missing_stop_conflation_result',
'distance_calculation_inaccurate',
'rsp_line_inaccurate',
'route_color',
Expand Down
2 changes: 1 addition & 1 deletion app/models/json_schemas/feed.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"uniqueItems": true,
"items": {
"type": "object",
"required": ["operatorOnestopId"],
"required": ["operatorOnestopId", "gtfsAgencyId"],
"operatorOnestopId": {
"type": "string",
"format": "operator-onestop-id"
Expand Down
Loading