foreman-tasks 0.17.4 → 0.17.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 643cb1c2534982870c1596b11ae870ac9b2ae0bd044a7a8478860bc81cb3ef6f
|
4
|
+
data.tar.gz: 8af310f891f2a938f687ddb0cbc8f6bc1a0aa89b2c81302e544c20b113bc4979
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1695ffe92d34e48a3d06120aff778d46f3b522203b603421260eb86bb3368af5d3ec3b159168bcd0e14b309eb222512511921ce5c9a2af8ddcb727a15e234e64
|
7
|
+
data.tar.gz: 874641b33c524355abca31cf1d9016ff02ab51bf72a8efdc7893e1ec66baf0aab749c18f5f73723d87b44efd848dac45813beb4e2c7e8a4bd49f5ad593b9dac8
|
@@ -238,9 +238,10 @@ module ForemanTasks
|
|
238
238
|
|
239
239
|
def ordering_scope(scope, ordering_params)
|
240
240
|
sort_by = ordering_params[:sort_by] || 'started_at'
|
241
|
+
sort_by = 'foreman_tasks_tasks.' + sort_by if sort_by == 'started_at'
|
241
242
|
sort_order = ordering_params[:sort_order] || 'DESC'
|
242
243
|
scope = scope.select("*, coalesce(ended_at, current_timestamp) - coalesce(coalesce(started_at, ended_at), current_timestamp) as duration")
|
243
|
-
scope.order(sort_by
|
244
|
+
scope.order("#{sort_by} #{sort_order}")
|
244
245
|
end
|
245
246
|
|
246
247
|
def task_hash(task)
|
@@ -12,8 +12,8 @@ module ForemanTasks
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe 'GET /api/tasks' do
|
15
|
+
before { FactoryBot.create_list(:dynflow_task, 5, :user_create_task) }
|
15
16
|
it 'lists all tasks with default sorting' do
|
16
|
-
FactoryBot.create_list(:dynflow_task, 5, :user_create_task)
|
17
17
|
get :index
|
18
18
|
assert_response :success
|
19
19
|
data = JSON.parse(response.body)
|
@@ -21,12 +21,19 @@ module ForemanTasks
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'supports searching' do
|
24
|
-
FactoryBot.create_list(:dynflow_task, 5, :user_create_task)
|
25
24
|
get :index, params: { :search => 'label = Actions::User::Create' }
|
26
25
|
assert_response :success
|
27
26
|
data = JSON.parse(response.body)
|
28
27
|
_(data['results'].count).must_equal 5
|
29
28
|
end
|
29
|
+
|
30
|
+
it 'supports ordering by duration' do
|
31
|
+
get :index, params: { :sort_by => 'duration' }
|
32
|
+
assert_response :success
|
33
|
+
data = JSON.parse(response.body)
|
34
|
+
_(data.dig('sort', 'by')).must_equal 'duration'
|
35
|
+
_(data['results'].count).must_equal 5
|
36
|
+
end
|
30
37
|
end
|
31
38
|
|
32
39
|
describe 'GET /api/tasks/show' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.17.
|
4
|
+
version: 0.17.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Nečas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: foreman-tasks-core
|