12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/ruboty/handlers/lokalise.rb', line 12
def translation_stats(message)
project_name = message[:project_name]
language_iso_list = message[:language_iso_list].split(",")
project = project_find_by_name(name: project_name)
statistics = project.statistics
language_text =
statistics["languages"].map do |language|
iso = language["language_iso"]
unless language_iso_list.include?(iso)
next
end
words_to_do_count = language['words_to_do']
emoji_symbol = issue_status_emoji_symbol(issue_count: words_to_do_count)
"#{iso} untranslated: #{words_to_do_count} #{emoji_symbol}"
end.compact.join("\n")
qa_issues_count = statistics['qa_issues_total']
reply_messages = [
"#{project_name} translation stats",
"qa_issues: #{qa_issues_count} #{issue_status_emoji_symbol(issue_count: qa_issues_count)}",
language_text,
]
message.reply(reply_messages.join("\n"))
end
|