From a1897e5d322ca753ffd6073eeda84cc5f057bf5a Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 22 Jun 2018 07:40:00 +0100 Subject: Reverse the jobs order on the mini environments show page It's more useful to have the most recent jobs at the top. --- app/controllers/mini_environments_controller.rb | 6 ------ app/jobs/mini_environment_job.rb | 2 +- app/views/mini_environments/show.html.erb | 4 +++- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/controllers/mini_environments_controller.rb b/app/controllers/mini_environments_controller.rb index 837a503..5081801 100644 --- a/app/controllers/mini_environments_controller.rb +++ b/app/controllers/mini_environments_controller.rb @@ -158,10 +158,4 @@ class MiniEnvironmentsController < ApplicationController render 'show' end - - def jobs - MiniEnvironmentJob.jobs(@mini_environment.id) - end - - helper_method :jobs end diff --git a/app/jobs/mini_environment_job.rb b/app/jobs/mini_environment_job.rb index 1e41954..92f9919 100644 --- a/app/jobs/mini_environment_job.rb +++ b/app/jobs/mini_environment_job.rb @@ -39,6 +39,6 @@ class MiniEnvironmentJob < Que::Job job_class: name ).where( "args->>0 = '#{mini_environment_id}'" - ).to_a + ) end end diff --git a/app/views/mini_environments/show.html.erb b/app/views/mini_environments/show.html.erb index a4d8588..ac4a2bf 100644 --- a/app/views/mini_environments/show.html.erb +++ b/app/views/mini_environments/show.html.erb @@ -62,7 +62,9 @@ License along with the GOV.UK Mini Environment Admin. If not, see
<%= render( partial: 'shared/jobs', - locals: { jobs: jobs } + locals: { + jobs: MiniEnvironmentJob.jobs(@mini_environment.id).order(id: :desc) + } ) %>
-- cgit v1.2.3