iron_warbler 2.0.7.10 → 2.0.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7b7685e4696ff34f93ea5bd1a5f3931e1aa0718cb893de9ccb589234fd539e4
4
- data.tar.gz: c11b8fb78c052fee8584ce20e3c9673d74778945b4ba5d469e30f10e7521d7b7
3
+ metadata.gz: 65f060b11c141e0e77222f04ac71e621a321a10df855cf870619d8ea9788cae3
4
+ data.tar.gz: f9a91c391a96f82a9a8a21b9a20a0b6b8627af16e40649404d1b21eb7d2064d9
5
5
  SHA512:
6
- metadata.gz: a54e555e30a9197f6414c7989b652699a7d5bd087294889a6cc1fd5cf942818c8fb0ca3ab1eb50fa15f83be11f5e310caef40187c7e9097fe77721d3eb3e0fd0
7
- data.tar.gz: 1bd3bcef86e4980e6f45c96d3096a9bcbe7975425bac15b16129acaf2f5f4ccf0ccb1c3fab60e6e71b67bf4ab589c4999eb09871cd7190680c25fed1410a32c2
6
+ metadata.gz: 0e20e545d98a5581840acf01920f859a4bfdefee18048741102de18d820955b94abaac2554e7a17d2973b9b625c5f7a733a02e86425a4aa1fb380db4192a92f7
7
+ data.tar.gz: a5a87383b1f26ef92b63d535dff543804e74204aa338083cb864682b8eb7982cda7c63a54b434319c3f1c0aec7920b2f96c1b230a8a3777abb9e789ea6d1aa82
@@ -29,10 +29,11 @@ class Iro::AlertsController < Iro::ApplicationController
29
29
  @alert = Iro::Alert.find(params[:id])
30
30
  authorize! :update, @alert
31
31
  if @alert.update params[:alert].permit!
32
- redirect_to action: :index, notice: 'Alert was successfully updated.'
32
+ flash_notice 'ok'
33
33
  else
34
- render :edit
34
+ flash_alert @alert
35
35
  end
36
+ redirect_to action: :index, notice: 'Alert was successfully updated.'
36
37
  end
37
38
 
38
39
  ##
@@ -42,7 +43,8 @@ class Iro::AlertsController < Iro::ApplicationController
42
43
 
43
44
  def set_lists
44
45
  # @profiles_list = Wco::Profile.list
45
- @stocks_list = [[nil,nil]] + Iro::Stock.active.map { |s| [ s.ticker, s.ticker ] }
46
+ @stocks_list = Iro::Stock.list
47
+ puts! @stocks_list, '@stocks_list'
46
48
  end
47
49
 
48
50
 
@@ -3,11 +3,16 @@ class Iro::DatapointsController < Iro::ApplicationController
3
3
 
4
4
  ## params: d, k, v
5
5
  def create
6
+ authorize! :create, Iro::Datapoint
6
7
  begin
7
- Iro::Datapoint.create( k: params[:k], v: params[:v], created_at: params[:time] )
8
+ Iro::Datapoint.create!(
9
+ date: params[:d],
10
+ kind: params[:k],
11
+ value: params[:v],
12
+ )
8
13
  render json: { status: :ok }
9
- rescue ActiveRecord::NotNullViolation => exception
10
- render json: { status: :unauthorized }, status: :unauthorized
14
+ rescue Mongoid::Errors::Validations => e
15
+ render json: { status: 401 }, status: 401
11
16
  end
12
17
  end
13
18
 
@@ -24,8 +29,8 @@ class Iro::DatapointsController < Iro::ApplicationController
24
29
  ORDER BY
25
30
  d.date;"
26
31
 
27
- outs = ActiveRecord::Base.connection.execute(sql)
28
- puts! outs, 'outs'
32
+ # outs = ActiveRecord::Base.connection.execute(sql)
33
+ # puts! outs, 'outs'
29
34
 
30
35
  render json: outs
31
36
 
@@ -14,12 +14,13 @@ class Iro::Alert
14
14
 
15
15
  STATUS_ACTIVE = 'active'
16
16
  STATUS_INACTIVE = 'inactive'
17
- STATUSES = [ 'active', 'inactive' ]
17
+ STATUSES = [ nil, 'active', 'inactive' ]
18
+ field :status, default: STATUS_ACTIVE
18
19
  def self.active
19
20
  where( status: STATUS_ACTIVE )
20
21
  end
21
22
 
22
- field :class_name
23
+ field :class_name, default: 'Iro::Stock'
23
24
  validates :class_name, presence: true
24
25
 
25
26
  field :symbol
@@ -6,8 +6,14 @@ class Iro::Datapoint
6
6
  store_in collection: 'iro_datapoints'
7
7
 
8
8
  field :date
9
+ index({ kind: -1, date: -1 })
10
+
9
11
  field :value, type: Float
12
+ validates :value, presence: true
13
+
10
14
  field :kind
15
+ validates :kind, presence: true
16
+ index({ kind: -1 })
11
17
 
12
18
  def self.test_0trash
13
19
  add_fields = { '$addFields': {
@@ -10,20 +10,21 @@ class Iro::Stock
10
10
  def self.active
11
11
  where( status: STATUS_ACTIVE )
12
12
  end
13
- field :status
13
+ field :status, default: STATUS_ACTIVE
14
14
 
15
15
  field :ticker
16
16
  validates :ticker, uniqueness: true, presence: true
17
+ index({ ticker: -1 }, { unique: true })
17
18
 
18
19
  field :last, type: :float
19
20
 
20
- def self.list
21
- end
22
-
23
- def self.tickers_list
24
- [nil] + all.map( &:ticker )
25
- end
26
21
 
27
22
  # has_many :strategies, class_name: 'Iro::Strategy', inverse_of: :stock
28
23
 
24
+ def to_s
25
+ ticker
26
+ end
27
+ def self.list
28
+ [[nil,nil]] + all.map { |sss| [ sss.ticker, sss.ticker ] }
29
+ end
29
30
  end
@@ -11,13 +11,14 @@
11
11
  - if alert.new_record?
12
12
  %label New
13
13
  - else
14
- = f.select :status, options_for_select([ 'active', 'inactive' ], selected: alert.status )
14
+ %label Status
15
+ = f.select :status, options_for_select(Iro::Alert::STATUSES, selected: alert.status )
15
16
  -# .field
16
17
  -# %label Notify
17
18
  -# = f.select :profile_id, options_for_select( @profiles_list, selected: alert.profile_id )
18
19
  .field
19
20
  %label When
20
- = f.select :class_name, options_for_select([ nil, 'Iro::Stock', 'Iro::Option' ])
21
+ = f.select :class_name, options_for_select([ nil, 'Iro::Stock', 'Iro::Option' ], selected: alert.class_name )
21
22
  -# .field
22
23
  -# = f.label :kind
23
24
  -# = f.text_field :kind
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iron_warbler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.7.10
4
+ version: 2.0.7.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-08 00:00:00.000000000 Z
11
+ date: 2024-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: business_time
@@ -217,7 +217,7 @@ files:
217
217
  - app/controllers/iro/stocks_controller.rb
218
218
  - app/controllers/iro/strategies_controller.rb
219
219
  - app/helpers/iro/application_helper.rb
220
- - app/jobs/iro/application_job.rb
220
+ - app/jobs/iro/application_job.rb-trash
221
221
  - app/mailers/iro/alert_mailer.rb
222
222
  - app/mailers/iro/application_mailer.rb
223
223
  - app/models/iro/alert.rb