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

MAP-1645: Send van depots to the analytical platform #2369

Merged
merged 1 commit into from
Oct 16, 2024
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: 1 addition & 0 deletions app/models/journey.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def for_feed
.merge(to_location.for_feed(prefix: :to))
.merge(supplier.for_feed)
.merge(vehicle_registration:)
.merge(vehicle_depot:)
end

def vehicle_registration
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/journeys.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
association(:from_location, factory: :location)
association(:to_location, :court, factory: :location)
client_timestamp { Time.zone.now.utc + rand(-60..60).seconds } # NB: the client_timestamp will never be perfectly in sync with system clock
vehicle { { id: '12345678ABC', registration: 'AB12 CDE' } }
vehicle { { id: '12345678ABC', registration: 'AB12 CDE', depot: 'Depot 1' } }
date { Time.zone.today }

# NB we need to initialize_state because FactoryBot fires the after_initialize callback before the attributes are initialised!
Expand Down
1 change: 1 addition & 0 deletions spec/models/journey_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
'date': be_a(Date),
'state': 'proposed',
'vehicle_registration': 'AB12 CDE',
'vehicle_depot': 'Depot 1',
'client_timestamp': be_a(Time),
'created_at': be_a(Time),
'updated_at': be_a(Time),
Expand Down
4 changes: 2 additions & 2 deletions spec/requests/api/journeys_controller_update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@

it 'does not update the underlying journey vehicle' do
do_patch
expect(journey.vehicle).to eql('id' => '12345678ABC', 'registration' => 'AB12 CDE')
expect(journey.vehicle).to eql('id' => '12345678ABC', 'registration' => 'AB12 CDE', 'depot' => 'Depot 1')
end
end

Expand Down Expand Up @@ -218,7 +218,7 @@

it 'does not update the underlying journey vehicle' do
do_patch
expect(journey.vehicle).to eql('id' => '12345678ABC', 'registration' => 'AB12 CDE')
expect(journey.vehicle).to eql('id' => '12345678ABC', 'registration' => 'AB12 CDE', 'depot' => 'Depot 1')
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/serializers/journey_serializer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
end

it 'contains vehicle attributes' do
expect(result[:data][:attributes][:vehicle]).to eql(id: '12345678ABC', registration: 'AB12 CDE')
expect(result[:data][:attributes][:vehicle]).to eql(id: '12345678ABC', registration: 'AB12 CDE', depot: 'Depot 1')
end

it 'contains a `from_location` relationship' do
Expand Down
2 changes: 1 addition & 1 deletion spec/serializers/journeys_serializer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
end

it 'contains vehicle attributes' do
expect(result[:data][:attributes][:vehicle]).to eql(id: '12345678ABC', registration: 'AB12 CDE')
expect(result[:data][:attributes][:vehicle]).to eql(id: '12345678ABC', registration: 'AB12 CDE', depot: 'Depot 1')
end

it 'contains a `from_location` relationship' do
Expand Down
Loading