forest_liana 7.0.0.beta.4 → 7.0.0.beta.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 +4 -4
- data/app/controllers/forest_liana/actions_controller.rb +2 -2
- data/app/controllers/forest_liana/associations_controller.rb +2 -2
- data/app/controllers/forest_liana/resources_controller.rb +15 -6
- data/app/controllers/forest_liana/scopes_controller.rb +20 -0
- data/app/controllers/forest_liana/smart_actions_controller.rb +39 -3
- data/app/controllers/forest_liana/stats_controller.rb +5 -5
- data/app/services/forest_liana/filters_parser.rb +8 -4
- data/app/services/forest_liana/has_many_dissociator.rb +2 -2
- data/app/services/forest_liana/has_many_getter.rb +2 -2
- data/app/services/forest_liana/leaderboard_stat_getter.rb +20 -14
- data/app/services/forest_liana/line_stat_getter.rb +4 -2
- data/app/services/forest_liana/permissions_checker.rb +3 -4
- data/app/services/forest_liana/permissions_getter.rb +2 -2
- data/app/services/forest_liana/pie_stat_getter.rb +6 -3
- data/app/services/forest_liana/resource_getter.rb +6 -3
- data/app/services/forest_liana/resource_updater.rb +5 -2
- data/app/services/forest_liana/resources_getter.rb +6 -5
- data/app/services/forest_liana/scope_manager.rb +102 -0
- data/app/services/forest_liana/search_query_builder.rb +6 -3
- data/app/services/forest_liana/stat_getter.rb +2 -1
- data/app/services/forest_liana/value_stat_getter.rb +4 -2
- data/config/routes.rb +3 -0
- data/lib/forest_liana/version.rb +1 -1
- data/spec/dummy/app/controllers/forest/islands_controller.rb +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/lib/forest_liana/collections/island.rb +7 -0
- data/spec/requests/actions_controller_spec.rb +100 -12
- data/spec/requests/resources_spec.rb +2 -0
- data/spec/services/forest_liana/filters_parser_spec.rb +1 -1
- data/spec/services/forest_liana/has_many_getter_spec.rb +116 -0
- data/spec/services/forest_liana/line_stat_getter_spec.rb +14 -6
- data/spec/services/forest_liana/permissions_checker_acl_disabled_spec.rb +1 -3
- data/spec/services/forest_liana/pie_stat_getter_spec.rb +114 -0
- data/spec/services/forest_liana/resource_updater_spec.rb +116 -0
- data/spec/services/forest_liana/resources_getter_spec.rb +68 -1
- data/spec/services/forest_liana/scope_manager_spec.rb +232 -0
- data/spec/services/forest_liana/value_stat_getter_spec.rb +96 -0
- metadata +18 -13
- data/app/services/forest_liana/scope_validator.rb +0 -98
- data/test/services/forest_liana/has_many_getter_test.rb +0 -75
- data/test/services/forest_liana/pie_stat_getter_test.rb +0 -29
- data/test/services/forest_liana/resource_updater_test.rb +0 -86
- data/test/services/forest_liana/scope_validator_test.rb +0 -185
- data/test/services/forest_liana/value_stat_getter_test.rb +0 -71
@@ -1,71 +0,0 @@
|
|
1
|
-
module ForestLiana
|
2
|
-
class ValueStatGetterTest < ActiveSupport::TestCase
|
3
|
-
test 'Value stat getter with a simple filter' do
|
4
|
-
stat = ValueStatGetter.new(BooleanField, {
|
5
|
-
type: "Value",
|
6
|
-
collection: "boolean_field",
|
7
|
-
timezone: "Europe/Paris",
|
8
|
-
aggregate: "Count",
|
9
|
-
filters: {
|
10
|
-
field: "field",
|
11
|
-
operator: 'equal',
|
12
|
-
value: "true"
|
13
|
-
}.to_json
|
14
|
-
})
|
15
|
-
|
16
|
-
stat.perform
|
17
|
-
assert stat.record.value[:countCurrent] == 0
|
18
|
-
end
|
19
|
-
|
20
|
-
test 'Value stat getter with a filter on a belongs_to integer field' do
|
21
|
-
stat = ValueStatGetter.new(BelongsToField, {
|
22
|
-
type: "Value",
|
23
|
-
collection: "belongs_to_field",
|
24
|
-
timezone: "Europe/Paris",
|
25
|
-
aggregate: "Count",
|
26
|
-
filters: {
|
27
|
-
field: "has_one_field:id",
|
28
|
-
operator: 'equal',
|
29
|
-
value: 3
|
30
|
-
}.to_json
|
31
|
-
})
|
32
|
-
|
33
|
-
stat.perform
|
34
|
-
assert stat.record.value[:countCurrent] == 1
|
35
|
-
end
|
36
|
-
|
37
|
-
test 'Value stat getter with a filter on a belongs_to boolean field' do
|
38
|
-
stat = ValueStatGetter.new(BelongsToField, {
|
39
|
-
type: "Value",
|
40
|
-
collection: "belongs_to_field",
|
41
|
-
timezone: "Europe/Paris",
|
42
|
-
aggregate: "Count",
|
43
|
-
filters: {
|
44
|
-
field: "has_one_field:checked",
|
45
|
-
operator: 'equal',
|
46
|
-
value: "false"
|
47
|
-
}.to_json
|
48
|
-
})
|
49
|
-
|
50
|
-
stat.perform
|
51
|
-
assert stat.record.value[:countCurrent] == 0
|
52
|
-
end
|
53
|
-
|
54
|
-
test 'Value stat getter with a filter on a belongs_to enum field' do
|
55
|
-
stat = ValueStatGetter.new(BelongsToField, {
|
56
|
-
type: "Value",
|
57
|
-
collection: "belongs_to_field",
|
58
|
-
timezone: "Europe/Paris",
|
59
|
-
aggregate: "Count",
|
60
|
-
filters: {
|
61
|
-
field: "has_one_field:status",
|
62
|
-
operator: 'equal',
|
63
|
-
value: "pending"
|
64
|
-
}.to_json
|
65
|
-
})
|
66
|
-
|
67
|
-
stat.perform
|
68
|
-
assert stat.record.value[:countCurrent] == 1
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|