slack-smart-bot 1.12.1 → 1.12.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ca72cea646786ecef45351b9572383eaf24ac21c0536d69f589ec05975a8bc0
|
4
|
+
data.tar.gz: 0a67ca50fe73a664368912ed37f8a0edf30744ae1d30e981873de68599ad7e2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca0195b49029b878b1d91b2ee361af405e862ef7f93e8a7fed3e982b61c6ce46946f882b22798d190c8a36241b772301c62ad85cffba2773a7705e7a8147537e
|
7
|
+
data.tar.gz: e34528eb142a56fae2d4a61bbc9455ac8aa3f72185085ea8eadb61468756365e29ae1689067a3b59478805d066ec7916db351e337010707130fa75772193c5b7
|
@@ -75,6 +75,7 @@ class SlackSmartBot
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
tzone_users = {}
|
78
|
+
job_title_users = {}
|
78
79
|
|
79
80
|
unless wrong
|
80
81
|
if on_dm_master or (from_user.id == user) # normal user can only see own stats
|
@@ -318,6 +319,30 @@ class SlackSmartBot
|
|
318
319
|
end
|
319
320
|
end
|
320
321
|
end
|
322
|
+
if rows[0].key?(:job_title) #then save_stats is saving the job title already
|
323
|
+
rows.job_title.each do |job_title|
|
324
|
+
unless job_title == ''
|
325
|
+
job_title_users[job_title] ||= 0
|
326
|
+
job_title_users[job_title] += 1
|
327
|
+
end
|
328
|
+
end
|
329
|
+
else
|
330
|
+
rows.user_id.each_with_index do |usr, i|
|
331
|
+
if rows[i].values.size >= 13 #then save_stats is saving the job_title already but not all the data
|
332
|
+
unless rows[i].values[12] == ''
|
333
|
+
job_title_users[rows[i].values[12]] ||= 0
|
334
|
+
job_title_users[rows[i].values[12]] += 1
|
335
|
+
end
|
336
|
+
else
|
337
|
+
user_info = @users.select { |u| u.id == usr or (u.key?(:enterprise_user) and u.enterprise_user.id == usr) }[-1]
|
338
|
+
unless user_info.nil? or user_info.is_app_user or user_info.is_bot
|
339
|
+
job_title_users[user_info.profile.title] ||= 0
|
340
|
+
job_title_users[user_info.profile.title] += 1
|
341
|
+
end
|
342
|
+
end
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
321
346
|
if users.size > 10
|
322
347
|
message << "*Users* - #{users.size} (Top 10)"
|
323
348
|
else
|
@@ -357,6 +382,17 @@ class SlackSmartBot
|
|
357
382
|
message << "\tUnknown: #{total_unknown} (#{(total_unknown.to_f*100/total_without_routines).round(2)}%)" if total_unknown > 0
|
358
383
|
end
|
359
384
|
|
385
|
+
if job_title_users.size > 0
|
386
|
+
message << "*Job Titles*"
|
387
|
+
total_known = 0
|
388
|
+
job_title_users.each do |jtitle, num|
|
389
|
+
message << "\t#{jtitle}: #{num} (#{(num.to_f*100/total_without_routines).round(2)}%)"
|
390
|
+
total_known+=num
|
391
|
+
end
|
392
|
+
total_unknown = total_without_routines - total_known
|
393
|
+
message << "\tUnknown: #{total_unknown} (#{(total_unknown.to_f*100/total_without_routines).round(2)}%)" if total_unknown > 0
|
394
|
+
end
|
395
|
+
|
360
396
|
end
|
361
397
|
commands_attachment = []
|
362
398
|
|
@@ -6,7 +6,7 @@ class SlackSmartBot
|
|
6
6
|
require "csv"
|
7
7
|
if !File.exist?("#{config.stats_path}.#{Time.now.strftime("%Y-%m")}.log")
|
8
8
|
CSV.open("#{config.stats_path}.#{Time.now.strftime("%Y-%m")}.log", "wb") do |csv|
|
9
|
-
csv << ["date", "bot_channel", "bot_channel_id", "dest_channel", "dest_channel_id", "type_message", "user_name", "user_id", "text", "command", "files", "time_zone"]
|
9
|
+
csv << ["date", "bot_channel", "bot_channel_id", "dest_channel", "dest_channel_id", "type_message", "user_name", "user_id", "text", "command", "files", "time_zone", "job_title"]
|
10
10
|
end
|
11
11
|
end
|
12
12
|
if data.empty?
|
@@ -37,12 +37,14 @@ class SlackSmartBot
|
|
37
37
|
user_info = @users.select { |u| u.id == user_id or (u.key?(:enterprise_user) and u.enterprise_user.id == user_id) }[-1]
|
38
38
|
if user_info.nil? or user_info.is_app_user or user_info.is_bot
|
39
39
|
time_zone = ''
|
40
|
+
job_title = ''
|
40
41
|
else
|
41
42
|
time_zone = user_info.tz_label
|
43
|
+
job_title = user_info.profile.title
|
42
44
|
end
|
43
45
|
|
44
46
|
CSV.open("#{config.stats_path}.#{Time.now.strftime("%Y-%m")}.log", "a+") do |csv|
|
45
|
-
csv << [Time.now, config.channel, @channel_id, @channels_name[data.dest], data.dest, data.typem, user_name, user_id, command_txt, method, data.files, time_zone]
|
47
|
+
csv << [Time.now, config.channel, @channel_id, @channels_name[data.dest], data.dest, data.typem, user_name, user_id, command_txt, method, data.files, time_zone, job_title]
|
46
48
|
end
|
47
49
|
rescue Exception => exception
|
48
50
|
@logger.fatal "There was a problem on the stats"
|
data/whats_new.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
*Version 1.12.
|
1
|
+
*Version 1.12.2* 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>).
|
@@ -13,6 +13,7 @@
|
|
13
13
|
*For Admin users*
|
14
14
|
- Bot Stats is now saving the time_zone of the user (<https://github.com/MarioRuiz/slack-smart-bot/issues/66|#66>)
|
15
15
|
- Announcements won't be published if no activity on channel. (<https://github.com/MarioRuiz/slack-smart-bot/issues/74|#74>)
|
16
|
+
- Bot Stats is now saving the job title of the user (<https://github.com/MarioRuiz/slack-smart-bot/issues/77|#77>)
|
16
17
|
------------------------------
|
17
18
|
|
18
19
|
*Previous*: <https://github.com/MarioRuiz/slack-smart-bot/blob/b1a368c3342094e886f53d96dc4d12ecd81ab04b/whats_new.txt|1.11.0>
|
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
|
+
version: 1.12.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slack-ruby-client
|