gloo 3.9.1 → 3.10.0

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: 41379e3f9f02c925e8f8db71c54d6cf726f4ba7e8944e6ed622946587378714e
4
- data.tar.gz: ff6418c1725c5db6f3d0d74e59bd8386e0983ca25d99cb623ddc46f80b0acb8f
3
+ metadata.gz: e433f2baf8be33d331b3bd9274885bfd2d4d5f82d43c82b56c9de1be39f49a65
4
+ data.tar.gz: 3bff8acad38706bc7938461cccb0ea0b6e242cdc7ce75560c3ca0c4ada06cb63
5
5
  SHA512:
6
- metadata.gz: 74a247a591e58ca1518c483b4274490b24a4042dd73d2ebe1da42a5220e0bdb52976bf1751aaeb6db41477f769e02addf411d59d2896dc0841d7daef88838524
7
- data.tar.gz: 65f189d2e4a7cab80c0f14114dac393a863381a8da34a545af2bbd752561c165de471b2f8a5016711ef6bb57464403af7365d907e79095bf64c78f33ae9dee1d
6
+ metadata.gz: 4738b2649a53f3a78eb52cf3c6805156eaeb5c4c005a1f4779aabd3b37a92ba23d49c8ab80f072514df816eeeced82c89d271077d1dc7234a1a62e097a819606
7
+ data.tar.gz: 37cb224b189049b0827652c4317352cac2ace041908b18ae075b200b9519ba5060e74ec0dba0ae6108f0edc1c52da52c299c49fff09af05cc6877623523d0555
data/lib/VERSION CHANGED
@@ -1 +1 @@
1
- 3.9.1
1
+ 3.10.0
data/lib/VERSION_NOTES CHANGED
@@ -1,3 +1,10 @@
1
+ 3.10.0 - 2025.03.09
2
+ - Fixes bug with page parameters
3
+ - Fixes bug with date-times in SQL
4
+ - Use alias redirect in SQL query
5
+ - adds date time messages to get begin, end of day, week, month, year
6
+
7
+
1
8
  3.9.1 - 2025.02.25
2
9
  adds tag helper for apple touch icon
3
10
 
@@ -89,6 +89,7 @@ module Gloo
89
89
  begin
90
90
  clear_results
91
91
 
92
+ log_query sql_value, param_array
92
93
  result = db.query( sql_value, param_array )
93
94
  process_result( result, db )
94
95
  rescue => e
@@ -125,8 +126,8 @@ module Gloo
125
126
  # Write the query to the log.
126
127
  #
127
128
  def log_query sql, params
128
- @engine.log.info "QUERY PARAMS: #{params}" if params
129
- @engine.log.info "QUERY: #{sql}"
129
+ @engine.log.info "SQL PARAMS: #{params}" if params
130
+ @engine.log.info "SQL: #{sql}"
130
131
  end
131
132
 
132
133
 
@@ -173,6 +174,7 @@ module Gloo
173
174
  o = find_child SQL
174
175
  return nil unless o
175
176
 
177
+ o = Gloo::Objs::Alias.resolve_alias( @engine, o )
176
178
  return o.value
177
179
  end
178
180
 
@@ -41,6 +41,15 @@ module Gloo
41
41
  end
42
42
  end
43
43
 
44
+ #
45
+ # Value for a SQL query.
46
+ #
47
+ def sql_value
48
+ return nil if self.value.blank?
49
+
50
+ return Chronic.parse( self.value )
51
+ end
52
+
44
53
  # ---------------------------------------------------------------------
45
54
  # Messages
46
55
  # ---------------------------------------------------------------------
@@ -41,7 +41,16 @@ module Gloo
41
41
  self.value = self.value.strftime( DEFAULT_FORMAT )
42
42
  end
43
43
  end
44
-
44
+
45
+ #
46
+ # Value for a SQL query.
47
+ #
48
+ def sql_value
49
+ return nil if self.value.blank?
50
+
51
+ return Chronic.parse( self.value )
52
+ end
53
+
45
54
  # ---------------------------------------------------------------------
46
55
  # Messages
47
56
  # ---------------------------------------------------------------------
@@ -50,9 +59,85 @@ module Gloo
50
59
  # Get a list of message names that this object receives.
51
60
  #
52
61
  def self.messages
53
- return super + %w[now is_today is_future is_past is_yesterday is_tomorrow is_this_week]
62
+ return super + %w[now is_today is_future
63
+ is_past is_yesterday is_tomorrow is_this_week
64
+ begin_day end_day begin_week end_week
65
+ begin_month end_month begin_year end_year]
66
+ end
67
+
68
+ #
69
+ # Set the value to the beginning of the month.
70
+ #
71
+ def msg_begin_month
72
+ dt = DtTools.beginning_of_month( self.value.to_time )
73
+ self.set_value dt
74
+ @engine.heap.it.set_to dt
75
+ end
76
+
77
+ #
78
+ # Set the value to the end of the month.
79
+ #
80
+ def msg_end_month
81
+ dt = DtTools.end_of_month( self.value.to_time )
82
+ self.set_value dt
83
+ @engine.heap.it.set_to dt
84
+ end
85
+
86
+ #
87
+ # Set the value to the beginning of the year.
88
+ #
89
+ def msg_begin_year
90
+ dt = self.value.to_time.beginning_of_year
91
+ self.set_value dt
92
+ @engine.heap.it.set_to dt
93
+ end
94
+
95
+ #
96
+ # Set the value to the end of the year.
97
+ #
98
+ def msg_end_year
99
+ dt = self.value.to_time.end_of_year
100
+ self.set_value dt
101
+ @engine.heap.it.set_to dt
102
+ end
103
+
104
+ #
105
+ # Set the value to the beginning of the week.
106
+ #
107
+ def msg_begin_week
108
+ dt = self.value.to_time.beginning_of_week( start_day = :sunday )
109
+ self.set_value dt
110
+ @engine.heap.it.set_to dt
111
+ end
112
+
113
+ #
114
+ # Set the value to the end of the week.
115
+ #
116
+ def msg_end_week
117
+ dt = self.value.to_time.end_of_week( start_day = :sunday )
118
+ self.set_value dt
119
+ @engine.heap.it.set_to dt
54
120
  end
55
121
 
122
+ #
123
+ # Set the value to the beginning of the day.
124
+ #
125
+ def msg_begin_day
126
+ dt = self.value.to_time.beginning_of_day
127
+ self.set_value dt
128
+ @engine.heap.it.set_to dt
129
+ end
130
+
131
+ #
132
+ # Set the value to the end of the day.
133
+ #
134
+ def msg_end_day
135
+ dt = self.value.to_time.end_of_day
136
+ self.set_value dt
137
+ @engine.heap.it.set_to dt
138
+ end
139
+
140
+ #
56
141
  #
57
142
  # Tell the datetime to check if it is today.
58
143
  #
@@ -114,7 +199,8 @@ module Gloo
114
199
  self.set_value( DateTime.now )
115
200
  @engine.heap.it.set_to self.value
116
201
  end
117
-
202
+
118
203
  end
119
204
  end
120
205
  end
206
+
@@ -3,6 +3,7 @@
3
3
  #
4
4
  # A Date and Time object.
5
5
  #
6
+ require 'active_support/time'
6
7
 
7
8
  class DtTools
8
9
 
@@ -97,4 +98,30 @@ class DtTools
97
98
  return true
98
99
  end
99
100
 
101
+
102
+ # ---------------------------------------------------------------------
103
+ # Begin/end Helpers
104
+ # ---------------------------------------------------------------------
105
+
106
+ def self.get_utc_offset t
107
+ utc_offset = ActiveSupport::TimeZone[ t.zone ].utc_offset
108
+ return utc_offset
109
+ end
110
+
111
+ #
112
+ # Returns the beginning of the month for the given time.
113
+ #
114
+ def self.beginning_of_month t
115
+ utc_offset = get_utc_offset t
116
+ Time.new(t.year, t.month, 1, 0, 0, 0, utc_offset)
117
+ end
118
+
119
+ #
120
+ # Returns the end of the month for the given time.
121
+ #
122
+ def self.end_of_month t
123
+ utc_offset = get_utc_offset t
124
+ Time.new(t.year, t.month, t.end_of_month.day, 23, 59, 59, utc_offset)
125
+ end
126
+
100
127
  end
@@ -41,6 +41,15 @@ module Gloo
41
41
  end
42
42
  end
43
43
 
44
+ #
45
+ # Value for a SQL query.
46
+ #
47
+ def sql_value
48
+ return nil if self.value.blank?
49
+
50
+ return Chronic.parse( self.value )
51
+ end
52
+
44
53
  # ---------------------------------------------------------------------
45
54
  # Messages
46
55
  # ---------------------------------------------------------------------
@@ -107,10 +107,9 @@ module Gloo
107
107
  end
108
108
 
109
109
  #
110
- # Get the params hash from the child object.
111
- # Returns nil if there is none.
110
+ # Init params container with request values.
112
111
  #
113
- def params_hash
112
+ def init_params
114
113
  params_can = find_child PARAMS
115
114
  return nil unless params_can
116
115
 
@@ -134,6 +133,15 @@ module Gloo
134
133
  o.set_value( v ) if o
135
134
  end
136
135
  end
136
+ end
137
+
138
+ #
139
+ # Get the params hash from the child object.
140
+ # Returns nil if there is none.
141
+ #
142
+ def params_hash
143
+ params_can = find_child PARAMS
144
+ return nil unless params_can
137
145
 
138
146
  h = {}
139
147
  params_can.children.each do |o|
@@ -350,10 +358,13 @@ module Gloo
350
358
  # TODO : refactor this
351
359
  set_id if @request
352
360
 
361
+ # Put params from request into params container.
362
+ init_params
363
+
353
364
  # Run the on prerender script
354
365
  run_on_prerender
355
366
 
356
- # Set Params before running on render
367
+ # Get Params hash before running on render
357
368
  params = params_hash
358
369
 
359
370
  run_on_render
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gloo
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.1
4
+ version: 3.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Crane
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-25 00:00:00.000000000 Z
11
+ date: 2025-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler