sql-jarvis 2.1.6 → 2.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91f27080fce44b6ea0ee444d2b790dddcaa7a9ee8b600f85e020622d2c83e455
4
- data.tar.gz: 6dd4fcbd656d5d3e8c664173d788c5e79f61087079682560578f13a95eaa0c6f
3
+ metadata.gz: cfb54328ee2d275f1aab831bdc7d52fddff2b7f52231774a1723aa25fcac8a82
4
+ data.tar.gz: a7dd3acceb9459afcaaf946336fb23c4299e5b341aad2e169ba0cc074039e38c
5
5
  SHA512:
6
- metadata.gz: 57be82558a33daf54f8b2c869d287fb6ef77c3a6260723a585321dc66b9b1e1681704186d257b5143a7b6e91e255821bd35a851dac8518d1205c73837a5389d9
7
- data.tar.gz: 24fbb87c6b50ee64309e0e4b02db2dcdb01c64df7ddfa71855116289265732bf07c02c04df3a50ca586c8523718cdc97e44c5b1bf885fb31d95456c90eabb5d6
6
+ metadata.gz: 602a0748fcb3f50223cb5450d10dce80e03fd10f3e1d52451880b5fa3040f24f7114fa3b5debce7ee76cf47f6f9f6f10ec24e4257b7f098adb534ecc0d004e19
7
+ data.tar.gz: 649a9f8b5cedbcde958436a7694a4ede682dab551416ed7646456787d4122af780250ac465c9d31a0f8d3253c63bc454948e47a3e7d352d686d46ff9707e8ae7
@@ -1,6 +1,7 @@
1
1
  module Blazer
2
2
  class ChecksController < BaseController
3
3
  before_action :set_check, only: [:edit, :update, :destroy, :run]
4
+ before_action :set_new_check, only: [:new]
4
5
  before_action :set_accessible, only: [:new, :edit]
5
6
 
6
7
  def index
@@ -10,7 +11,6 @@ module Blazer
10
11
  end
11
12
 
12
13
  def new
13
- @check = Blazer::Check.new(query_id: params[:query_id])
14
14
  end
15
15
 
16
16
  def create
@@ -54,15 +54,20 @@ module Blazer
54
54
  @check = Blazer::Check.find(params[:id])
55
55
  end
56
56
 
57
+ def set_new_check
58
+ @check = Blazer::Check.new(query_id: params[:query_id])
59
+ end
60
+
57
61
  def set_accessible
58
- @slack_mentions ||= get_slack_mentions + @check.slack_members.each_with_object([]) { |m, list| list << [m, m] if m.present? }
62
+ existed_members = @check&.slack_members.presence || []
63
+ @slack_mentions ||= get_slack_mentions + existed_members.each_with_object([]) { |m, list| list << [m, m] if m.present? }
59
64
  ensure
60
65
  @slack_mentions ||= []
61
66
  end
62
67
 
63
68
  def get_slack_mentions
64
69
  return [] unless Blazer.settings.key?('slack_mentions')
65
- Blazer::RunStatement.new.perform(Blazer.data_sources[@check.query.data_source], Blazer.settings['slack_mentions'], {}).rows.map do |row|
70
+ Blazer::RunStatement.new.perform(Blazer.data_sources[@check.query&.data_source], Blazer.settings['slack_mentions'], {}).rows.map do |row|
66
71
  [row.last, "[#{row.first}] #{row.second} - ##{row.last}"]
67
72
  end
68
73
  rescue
@@ -1,3 +1,3 @@
1
1
  module Blazer
2
- VERSION = '2.1.6'
2
+ VERSION = '2.1.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sql-jarvis
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.6
4
+ version: 2.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-22 00:00:00.000000000 Z
11
+ date: 2023-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties