eitil 1.1.8 → 1.1.12
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/eitil_core/lib/eitil_core/active_record/hash_to_relation.rb +6 -1
- data/eitil_core/lib/eitil_core/application_controller/permit_model_atts.rb +23 -4
- data/eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/sum_data.rb +17 -9
- data/eitil_integrate/lib/eitil_integrate/application_exporter/log_state.rb +1 -1
- data/eitil_integrate/lib/eitil_integrate/application_exporter/style_cells.rb +2 -0
- data/lib/eitil/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: 707b27f67c74dec844efce22b99755420d624a11060e5c7fafdd0a4b3b4ce60a
|
4
|
+
data.tar.gz: 47c775e85c7f8d04466c802b8b717a8c6c478c982b0d34935e21f1846bff7d11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06023f05445799146cf9a4e43e4a9247f89281ee59a5770b909541641024052ef8c34ae9ab07dfd03191f0c43484ed84f2c5d2c321b89bf4958261f73f086171
|
7
|
+
data.tar.gz: 52aa15d5003c3234703426e365d1488442cd8e4230c7423489cd4713c2ef3bc2aea662ca984ef104cece728e2c6397d7ce29a828c50fd4734b7fba3ce9f552c6
|
@@ -7,7 +7,12 @@ class Array
|
|
7
7
|
|
8
8
|
def to_relation
|
9
9
|
|
10
|
-
|
10
|
+
# Return an empty ActiveRecord_Relation instance when no objects are present,
|
11
|
+
# instead of returning the empty array itself. The reason being, that when you
|
12
|
+
# always return an association, you won't run into problems with undefined methods
|
13
|
+
# called later on, expecting an association instead of an array.
|
14
|
+
|
15
|
+
return ApplicationRecord.none unless self.present?
|
11
16
|
|
12
17
|
unless self.all? { |item| item.class.ancestors.include? ApplicationRecord }
|
13
18
|
raise_error "InvalidArrayError", ".to_relation requires that all array items are model instances"
|
@@ -1,14 +1,18 @@
|
|
1
1
|
|
2
2
|
# require "eitil_core/application_controller/permit_model_atts"
|
3
3
|
|
4
|
+
require "pry"
|
5
|
+
|
4
6
|
module ActionController
|
5
7
|
class Parameters
|
6
8
|
|
7
|
-
def permit_model_atts(*models, include: nil, except: nil)
|
9
|
+
def permit_model_atts(*models, include: nil, except: nil, arrays: nil, hashes: nil)
|
8
10
|
|
9
|
-
models = models.is_a?(Array)
|
10
|
-
except = except.is_a?(Array)
|
11
|
+
models = models.is_a?(Array) ? models : [models]
|
12
|
+
except = except.is_a?(Array) ? except : [except]
|
11
13
|
include = include.is_a?(Array) ? include : [include]
|
14
|
+
arrays = arrays.is_a?(Array) ? arrays : [arrays]
|
15
|
+
hashes = hashes.is_a?(Array) ? hashes : [hashes]
|
12
16
|
|
13
17
|
columns = models.map do |model|
|
14
18
|
model.columns_hash.keys.map &:to_sym
|
@@ -17,8 +21,23 @@ module ActionController
|
|
17
21
|
default_reject = %i( id updated_at created_at )
|
18
22
|
given_reject = except.map { |key| key&.to_sym }
|
19
23
|
accepted_values = columns + include - default_reject - given_reject
|
24
|
+
|
25
|
+
arrays = arrays.all?(&:present?) ? arrays.each_with_object({}) { |i,h| h[i] = [] } : nil
|
26
|
+
hashes = hashes.all?(&:present?) ? hashes.each_with_object({}) { |i,h| h[i] = {} } : nil
|
27
|
+
|
28
|
+
if arrays.blank? and hashes.blank?
|
29
|
+
return self.permit(*accepted_values)
|
30
|
+
|
31
|
+
elsif arrays.blank?
|
32
|
+
return self.permit(*accepted_values, **hashes)
|
33
|
+
|
34
|
+
elsif hashes.blank?
|
35
|
+
return self.permit(*accepted_values, **arrays)
|
36
|
+
|
37
|
+
else
|
38
|
+
return self.permit(*accepted_values, **arrays, **hashes)
|
20
39
|
|
21
|
-
|
40
|
+
end
|
22
41
|
end
|
23
42
|
|
24
43
|
end
|
@@ -34,18 +34,26 @@ module EitilIntegrate::RubyXL
|
|
34
34
|
|
35
35
|
end
|
36
36
|
|
37
|
-
#
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
#
|
44
|
-
|
37
|
+
# ALERT: the outcomment below is made to skip formatting days at all, so that
|
38
|
+
# – following eitje business logic – we currently only return an hh:mm notation
|
39
|
+
|
40
|
+
# # parsing times into maxes (60 m, 24 h, ∞ days)
|
41
|
+
# th += tm / 60
|
42
|
+
# tm = tm % 60
|
43
|
+
# td += th / 24
|
44
|
+
# th = th % 24
|
45
|
+
|
46
|
+
# # formatting strings
|
47
|
+
# sd = td.to_s
|
48
|
+
|
45
49
|
sh = th.to_s.rjust(2,'0')
|
46
50
|
sm = tm.to_s.rjust(2,'0')
|
47
51
|
|
48
|
-
|
52
|
+
# ALERT: the outcomment below is made to skip formatting days at all, so that
|
53
|
+
# – following eitje business logic – we currently only return an hh:mm notation
|
54
|
+
|
55
|
+
# [[sd, sh, sm].join(':')]
|
56
|
+
[[sh, sm].join(':')]
|
49
57
|
end
|
50
58
|
|
51
59
|
def format_time(time)
|
@@ -59,6 +59,8 @@ module EitilIntegrate::RubyXL
|
|
59
59
|
base_style_x_columns_width (0...n_columns), width
|
60
60
|
end
|
61
61
|
|
62
|
+
alias_method :base_style_first_x_columns_width, :style_first_x_columns_width
|
63
|
+
|
62
64
|
def style_x_columns_width(column_indices = [], width)
|
63
65
|
column_indices.each { |i| @sheet.change_column_width(i, width) }
|
64
66
|
end
|
data/lib/eitil/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eitil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jurriaan Schrofer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|