standardapi 6.0.0.14 → 6.0.0.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57e9eb8d2b72416e613c4231e25fb67709bd38ec93607e12dab2705fdf2e05b2
4
- data.tar.gz: a5d03ecbbdc3529f6aec1546a933c8353f6f6a1b5cc2aefc7cc0dda1b55fb52c
3
+ metadata.gz: bbc6b3f7345e1df82060abcc37ee0bcf5f11b88863e1cdab4299f514129b44f6
4
+ data.tar.gz: cae2c3d6859933c99ac13f0704e35997e3c10603f53d325b3a8ace63607fce94
5
5
  SHA512:
6
- metadata.gz: 03aa6f252f8fed9a81cfce311cc5596798505f0b683bfb4a5a8c5cc55232c73cd8ed1ee1fa78aa642a5e6ba01bd4e5ee1e142e3d197104b7248e06cc64a91499
7
- data.tar.gz: 2f47d3025a871845b0b9e50ac3ff014c94cfecb8ebf2d216d7fb171b5ff37aa3b980432a73498ef31b658768e52a646fe2547d5e80b3bbbf4a394bdd4c19a561
6
+ metadata.gz: 75a1555b14bbbcfd99f2dcd31cbba472a157c0066a22d597cd1fff9daa7c4f53e1c6461c21c8adde888715a90df07ae7e4e8eb48467b702a7ba45e6dba21de10
7
+ data.tar.gz: a9deedd375a788e22502b4caea542fdbe935ac6f4d594d8e46ceb79bcf9202e5813b795df9c60c7360ef84a9068b5388d862e95734e9bd05f427f4286ff3d114
@@ -15,16 +15,17 @@ module StandardAPI
15
15
 
16
16
  if math_column
17
17
  column = math_column
18
- selects = [{ count: column.name}, { maximum: column.name }, { minimum: column.name }, { average: column.name }]
18
+ selects = [{ count: column.name }, { maximum: column.name }, { minimum: column.name }, { average: column.name }]
19
19
  else
20
20
  column = model.columns.sample
21
- selects = [{ count: column.name}]
21
+ selects = [{ count: column.name }]
22
22
  end
23
23
 
24
24
  get resource_path(:calculate, select: selects, format: :json)
25
25
  assert_response :ok
26
26
  calculations = @controller.instance_variable_get('@calculations')
27
- assert_equal [[model.count(column.name), model.maximum(column.name), model.minimum(column.name), model.average(column.name).to_f]], calculations
27
+ assert_equal [selects.map { |s| model.send(s.keys.first, column.name) }],
28
+ calculations
28
29
  end
29
30
 
30
31
  test '#calculate.json params[:where]' do
@@ -44,14 +45,10 @@ module StandardAPI
44
45
  predicate = { id: { gt: m1.id } }
45
46
 
46
47
  get resource_path(:calculate, where: predicate, select: selects, format: :json)
47
-
48
- # assert_response :ok
49
- # assert_equal [[
50
- # model.filter(predicate).count(column),
51
- # model.filter(predicate).maximum(column),
52
- # model.filter(predicate).minimum(column),
53
- # model.filter(predicate).average(column).to_f
54
- # ]], @controller.instance_variable_get('@calculations')
48
+ assert_response :ok
49
+ calculations = @controller.instance_variable_get('@calculations')
50
+ # assert_equal [selects.map { |s| model.send(s.keys.first, column.name) }],
51
+ # calculations
55
52
  end
56
53
 
57
54
  test '#calculate.json mask' do
@@ -1,3 +1,3 @@
1
1
  module StandardAPI
2
- VERSION = '6.0.0.14'
2
+ VERSION = '6.0.0.15'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standardapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0.14
4
+ version: 6.0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Bracy