simple_slack 0.3.1 → 0.3.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
  SHA1:
3
- metadata.gz: bbccec30429bbfd5960695216b8adc42a7806b50
4
- data.tar.gz: f0d5aeb35f7475438a2a7655f1c6559a0e127941
3
+ metadata.gz: 8e06637e6ea103d483301b1933724dd6ae3987bb
4
+ data.tar.gz: a0d3bbd05f6562d9e019eade99084d9f84e14447
5
5
  SHA512:
6
- metadata.gz: 5138a5189c29da34e5e1459301c1956fdfe68c5295544841fc136fba97ae03856cb2c58d839867113fb6599d3b3ebf0ce0e6c2609e5879090b8e3dda96b3c37c
7
- data.tar.gz: f9e7a03b114bd39e48367fc5c2d7c2cd745eddf655b4fe0cb07b5684109e06183d9a6f9dd210fd04b03b6292d509fb44e9880e77d5f028b0a03951197b580676
6
+ metadata.gz: e673cb4c3a13d89c8a0f26433661d8e6ee10c7c71df8b44bde30b717de9e7ac03a8ac5c4a4e867e7e94dd602a7300a201e2466011fa3cbf71877d15a208e2b0c
7
+ data.tar.gz: 2ef154134887ec1e23b559dd36812fd124bfb114b9bb5822bb0141b9d605f8b05f760ae2d9e782328f70072554063ebd0229bc3b17e91752065470069d561c39
@@ -4,11 +4,21 @@ module TogglDailyreport
4
4
  end
5
5
 
6
6
  def today_entry_reports
7
- reports = []
7
+ _reports = []
8
8
  day_entries.each do |entry|
9
- reports << entry_info(entry)
9
+ _reports << entry_info_hash(entry)
10
10
  end
11
11
 
12
+ report_group =
13
+ _reports.group_by do |report|
14
+ report.keys.first
15
+ end
16
+
17
+ reports =
18
+ report_group.map do |discription, entrys|
19
+ sum_time = entrys.inject(0){|sum, entry| sum + entry.values.first }
20
+ "#{discription} \(#{(sum_time/60).round(1)}.h\)"
21
+ end
12
22
  reports.join("\n")
13
23
  end
14
24
 
@@ -42,4 +42,20 @@ module TogglEntriesParameter
42
42
  "#{tag} #{description} \(#{work_time}\)"
43
43
  end
44
44
 
45
+ def entry_info_hash(entry = latest_entry)
46
+ # 現在作業中(終了時間がない)であれば現在日時を終了時間として取得
47
+ stop_time_org = entry["stop"].nil? ? Time.now : Time.parse(entry["stop"])
48
+
49
+ start_time = Time.parse(entry["start"]).getlocal("+09:00")
50
+ stop_time = stop_time_org.getlocal("+09:00")
51
+ diff_time = (stop_time - start_time)/60
52
+
53
+ work_time = diff_time.round(2)
54
+
55
+ tag = entry["tags"].join(" ") unless entry["tags"].nil?
56
+ description = entry["description"]
57
+
58
+ { "#{tag} #{description}" => work_time }
59
+ end
60
+
45
61
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleSlack
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_slack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - toririn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-18 00:00:00.000000000 Z
11
+ date: 2016-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler