slack-smart-bot 1.12.4 → 1.12.5

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: 27a01c9632e3e892e2c21142658a3c77e8a11ab0d6a025abc6b9ccaf189b9af5
4
- data.tar.gz: 916f5a09a3e121f768ca5a07e4721c5b33ee9c475a6697047ab83c9026e9b27d
3
+ metadata.gz: 36ca224f2a96256ac106440459efac5a513b0ebabac65494d6a070e1faa5abf3
4
+ data.tar.gz: 3aac3bb4b43dc458876c8bd12157bd9e428eb5d684d69861dc174898b8c5cf9e
5
5
  SHA512:
6
- metadata.gz: 002ecefc0542c4240f011930fd92d6330ff6d67bab530f7988b453696ff9936767ca88fc9d15e101d906744a27fc6921546e35f2a0e9e5856bed62848c827166
7
- data.tar.gz: dbabcdb3e6f40da61085cad5ebbbe24a260c9f9a952dc7782f380ed58133fab811985546051636c69788c407d6c39664d419e1ea610a9b7d9019bf81bb619481
6
+ metadata.gz: f99650a5ee15bab2a367dbc3de6be5cf00e7e01cd083a0a6f5cc425e51893609dba819f31191da74ace36e03a64b13fa6dae346ab24bddbbfbb0883bad5eccc9
7
+ data.tar.gz: 8f6904c2f655f09a0bdad49e4fe6da578524ccd8b82c0a00c4574398d01e4c7c109aeeb62868469471baf17a26c7778170e707e7ab87f2fe9065df7614db0b93
@@ -76,6 +76,7 @@ class SlackSmartBot
76
76
  end
77
77
  tzone_users = {}
78
78
  job_title_users = {}
79
+ users_by_job_title = {}
79
80
 
80
81
  unless wrong
81
82
  if on_dm_master or (from_user.id == user) # normal user can only see own stats
@@ -320,10 +321,12 @@ class SlackSmartBot
320
321
  end
321
322
  end
322
323
  if rows[0].key?(:job_title) #then save_stats is saving the job title already
323
- rows.job_title.each do |job_title|
324
+ rows.job_title.each_with_index do |job_title, idx|
324
325
  unless job_title == ''
325
326
  job_title_users[job_title] ||= 0
326
327
  job_title_users[job_title] += 1
328
+ users_by_job_title[job_title] ||= []
329
+ users_by_job_title[job_title] << rows.user_name[idx]
327
330
  end
328
331
  end
329
332
  else
@@ -332,17 +335,25 @@ class SlackSmartBot
332
335
  unless rows[i].values[12] == ''
333
336
  job_title_users[rows[i].values[12]] ||= 0
334
337
  job_title_users[rows[i].values[12]] += 1
338
+ users_by_job_title[rows[i].values[12]] ||= []
339
+ users_by_job_title[rows[i].values[12]] << rows.user_name[i]
335
340
  end
336
341
  else
337
342
  user_info = @users.select { |u| u.id == usr or (u.key?(:enterprise_user) and u.enterprise_user.id == usr) }[-1]
338
343
  unless user_info.nil? or user_info.is_app_user or user_info.is_bot
339
344
  job_title_users[user_info.profile.title] ||= 0
340
345
  job_title_users[user_info.profile.title] += 1
346
+ users_by_job_title[user_info.profile.title] ||= []
347
+ users_by_job_title[user_info.profile.title] << rows.user_name[i]
341
348
  end
342
349
  end
343
350
  end
344
351
  end
345
-
352
+ total_users_by_job_title = 0
353
+ users_by_job_title.each do |job_title, users|
354
+ users.uniq!
355
+ total_users_by_job_title += users.size
356
+ end
346
357
  if users.size > 10
347
358
  message << "*Users* - #{users.size} (Top 10)"
348
359
  else
@@ -404,7 +415,21 @@ class SlackSmartBot
404
415
  total_unknown = total_without_routines - total_known
405
416
  message << "\tUnknown: #{total_unknown} (#{(total_unknown.to_f*100/total_without_routines).round(2)}%)" if total_unknown > 0
406
417
  end
407
-
418
+ if users_by_job_title.size > 0
419
+ if users_by_job_title.size > 10
420
+ message << "*Num Users by Job Title* (Top 10)"
421
+ else
422
+ message << "*Num Users by Job Title*"
423
+ end
424
+ i = 0
425
+ users_by_job_title.sort_by {|k,v| -v.size}.each do |jtitle, users|
426
+ i += 1
427
+ if i <= 10
428
+ jtitle = 'Unknown' if jtitle.to_s == ''
429
+ message << "\t#{jtitle}: #{users.size} (#{(users.size.to_f*100/total_users_by_job_title).round(2)}%)"
430
+ end
431
+ end
432
+ end
408
433
  end
409
434
  commands_attachment = []
410
435
 
data/whats_new.txt CHANGED
@@ -1,4 +1,4 @@
1
- *Version 1.12.4* Released 2022-Nov-01
1
+ *Version 1.12.5* Released 2022-Nov-01
2
2
 
3
3
  *For General users*
4
4
  - `run repl` accepts local parameters and precode to be supplied (<https://github.com/MarioRuiz/slack-smart-bot/issues/60|#60>).
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-smart-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.4
4
+ version: 1.12.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Ruiz
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-02 00:00:00.000000000 Z
11
+ date: 2022-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slack-ruby-client
@@ -126,20 +126,6 @@ dependencies:
126
126
  - - "~>"
127
127
  - !ruby/object:Gem::Version
128
128
  version: '3.9'
129
- - !ruby/object:Gem::Dependency
130
- name: console
131
- requirement: !ruby/object:Gem::Requirement
132
- requirements:
133
- - - "~>"
134
- - !ruby/object:Gem::Version
135
- version: 1.15.0
136
- type: :runtime
137
- prerelease: false
138
- version_requirements: !ruby/object:Gem::Requirement
139
- requirements:
140
- - - "~>"
141
- - !ruby/object:Gem::Version
142
- version: 1.15.0
143
129
  description: "Create a Slack bot that is smart and so easy to expand, create new bots
144
130
  on demand, run ruby code on chat, create shortcuts... \n The main scope of this
145
131
  gem is to be used internally in the company so teams can create team channels with
@@ -304,15 +290,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
304
290
  requirements:
305
291
  - - ">="
306
292
  - !ruby/object:Gem::Version
307
- version: '2.7'
293
+ version: 2.7.3
308
294
  required_rubygems_version: !ruby/object:Gem::Requirement
309
295
  requirements:
310
296
  - - ">="
311
297
  - !ruby/object:Gem::Version
312
298
  version: '0'
313
299
  requirements: []
314
- rubygems_version: 3.1.2
315
- signing_key:
300
+ rubygems_version: 3.1.6
301
+ signing_key:
316
302
  specification_version: 4
317
303
  summary: Create a Slack bot that is smart and so easy to expand, create new bots on
318
304
  demand, run ruby code on chat, create shortcuts...