effective_reports 0.4.5 → 0.4.7
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/models/effective/report.rb +41 -2
- data/app/views/admin/reports/_report.html.haml +4 -0
- data/lib/effective_reports/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72c4899782bb1f08e5db2cea07f9f5572d496cbd754ccc2905df308b46d19d61
|
4
|
+
data.tar.gz: 7b500e62c9796dcfa5cf5be4fdade189f5863bf129b74f3b0c08a759e7508af2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36c6c329a44d8822fe1a3eec1cd528bea7045f4b51b8c2064ccc0ef0c6766cd093bd4530fa6f9a86f5eb8bf376b21ca33acab79ce0fb37253584fffccd855c73
|
7
|
+
data.tar.gz: 63001d87f4d6eb913f30173f4c5dffff0dfe10278d68c42b7a7cf32fbc88c7a804c7596ad2ce475cfb0155a31954e500f6ebe7e98957fcdcd07ce4c0135ffb65
|
@@ -84,10 +84,12 @@ module Effective
|
|
84
84
|
report_columns.find { |column| column.name == 'email' } || report_columns.find { |column| column.name.include?('email') }
|
85
85
|
end
|
86
86
|
|
87
|
-
def
|
87
|
+
def emailable_report_column
|
88
88
|
report_columns.find { |column| column.name == 'user' } ||
|
89
89
|
report_columns.find { |column| column.name == 'owner' } ||
|
90
|
-
report_columns.find { |column| column.name.include?('user') }
|
90
|
+
report_columns.find { |column| column.name.include?('user') } ||
|
91
|
+
report_columns.find { |column| column.name == 'organization' } ||
|
92
|
+
report_columns.find { |column| column.name.include?('organization') }
|
91
93
|
end
|
92
94
|
|
93
95
|
# Used to build the Reports form
|
@@ -116,6 +118,43 @@ module Effective
|
|
116
118
|
scopes
|
117
119
|
end
|
118
120
|
|
121
|
+
# Return a string you can copy and paste into a seeds file
|
122
|
+
def seeds
|
123
|
+
seeds = [
|
124
|
+
"report = Effective::Report.where(title: \"#{title}\", reportable_class_name: \"#{reportable_class_name}\").first_or_initialize",
|
125
|
+
("report.assign_attributes(description: \"#{description}\")" if description.present?),
|
126
|
+
].compact
|
127
|
+
|
128
|
+
seeds += report_columns.map do |column|
|
129
|
+
attributes = column.dup.attributes.except('name', 'report_id', 'position', 'as').compact
|
130
|
+
attributes.delete('filter') unless attributes['filter']
|
131
|
+
|
132
|
+
if attributes.present?
|
133
|
+
attributes = attributes.map { |k, v| "#{k}: #{v.inspect}" }.join(', ')
|
134
|
+
"report.col(:#{column.name}, #{attributes})"
|
135
|
+
else
|
136
|
+
"report.col(:#{column.name})"
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
seeds += report_scopes.map do |scope|
|
141
|
+
attributes = scope.dup.attributes.except('name', 'report_id', 'position').compact
|
142
|
+
|
143
|
+
if attributes.present?
|
144
|
+
attributes = attributes.map { |k, v| "#{k}: #{v.inspect}" }.join(', ')
|
145
|
+
"report.scope(:#{scope.name}, #{attributes})"
|
146
|
+
else
|
147
|
+
"report.scope(:#{scope.name})"
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
seeds += [
|
152
|
+
"report.save!"
|
153
|
+
]
|
154
|
+
|
155
|
+
seeds.join("\n")
|
156
|
+
end
|
157
|
+
|
119
158
|
def duplicate
|
120
159
|
Effective::Report.new(attributes.except('id', 'updated_at', 'created_at')).tap do |report|
|
121
160
|
report.title = title + ' (Copy)'
|
@@ -14,6 +14,10 @@
|
|
14
14
|
= collapse('Show SQL') do
|
15
15
|
%p= report.collection.to_sql
|
16
16
|
|
17
|
+
= collapse('Show Seeds') do
|
18
|
+
%small
|
19
|
+
%pre= report.seeds
|
20
|
+
|
17
21
|
- if (notifications = report.try(:notifications)).present?
|
18
22
|
%p.mt-3
|
19
23
|
The following notifications are sent based on this report:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_reports
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|