Skip to content

Commit

Permalink
Send van depots to the analytical platform
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyprivett committed Oct 16, 2024
1 parent d0e740f commit 5d68202
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 5 deletions.
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

0 comments on commit 5d68202

Please sign in to comment.