calc_working_hours 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 513398a1273bd3112f1f9e2cd535e6d8576c1235
|
4
|
+
data.tar.gz: 9ebe87beb7d07e0398d82bd6cacfcb9857291081
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1aea94eb1024253b31419fa46e8b812908613efbba29c46df87d3789fbd489fbe95150346a5e3d92c0095e8c24ddc8e96f8f2d83af53eea2db57020cdcdfb9af
|
7
|
+
data.tar.gz: cce115e0e5609292517155b8033517b138ef9ed0570a294b3873aef857cfb83307f9781f9a0ae04bc2ef6c5bfb529e5a4d529cb934a195e89b283742bd3b6474
|
@@ -24,6 +24,14 @@ module CalcWorkingHours
|
|
24
24
|
return WorkingHours.new("0:00").add_array_time(array_of_working_hours).time_string
|
25
25
|
end
|
26
26
|
|
27
|
+
def total_over_time
|
28
|
+
array_of_over_time = []
|
29
|
+
@time_card_rows.each do |row|
|
30
|
+
array_of_over_time << row.over_time.time_string
|
31
|
+
end
|
32
|
+
return WorkingHours.new("0:00").add_array_time(array_of_over_time).time_string
|
33
|
+
end
|
34
|
+
|
27
35
|
def total_working_hours_in_range(start_range, end_range)
|
28
36
|
array_of_working_hours_in_range = []
|
29
37
|
if start_range == true && end_range == true
|
@@ -5,7 +5,7 @@ require "date"
|
|
5
5
|
module CalcWorkingHours
|
6
6
|
|
7
7
|
class TimeCardRow
|
8
|
-
attr_reader :starting_time, :ending_time, :break_time, :working_hours, :date_string, :time_point, :working_hours_in_range, :
|
8
|
+
attr_reader :starting_time, :ending_time, :break_time, :working_hours, :date_string, :time_point, :working_hours_in_range, :over_time, :id
|
9
9
|
def initialize(date_string, starting_time, ending_time, *break_time)
|
10
10
|
unless date_string.class == String
|
11
11
|
raise "failure set_date (date should string class)! TimeCardRow class"
|
@@ -56,9 +56,9 @@ module CalcWorkingHours
|
|
56
56
|
time = WorkingHours.new(time)
|
57
57
|
working_hours = WorkingHours.new(@working_hours.time_string)
|
58
58
|
if working_hours.minute < time.minute
|
59
|
-
@
|
59
|
+
@over_time = working_hours.minus_time(working_hours.time_string)
|
60
60
|
else
|
61
|
-
@
|
61
|
+
@over_time = working_hours.minus_time(time.time_string)
|
62
62
|
end
|
63
63
|
self
|
64
64
|
end
|
@@ -38,11 +38,11 @@ describe TimeCardRow do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it "所定労働時間を7:20とすると、残業時間は0:40となる" do
|
41
|
-
@time_card_row.set_fixed_working_hours("7:20").
|
41
|
+
@time_card_row.set_fixed_working_hours("7:20").over_time.time_string.should == "0:40"
|
42
42
|
end
|
43
43
|
|
44
44
|
it "所定労働時間を8:20とすると、残業時間は0:00となる" do
|
45
|
-
@time_card_row.set_fixed_working_hours("8:20").
|
45
|
+
@time_card_row.set_fixed_working_hours("8:20").over_time.time_string.should == "0:00"
|
46
46
|
end
|
47
47
|
|
48
48
|
end
|
@@ -53,7 +53,7 @@ describe TimeCardRow do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
it "所定労働時間を8:00とすると、残業時間は2:28となる" do
|
56
|
-
@time_card_row.set_fixed_working_hours("8:00").
|
56
|
+
@time_card_row.set_fixed_working_hours("8:00").over_time.time_string.should == "2:28"
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -4,10 +4,15 @@ require 'spec_helper'
|
|
4
4
|
include CalcWorkingHours
|
5
5
|
|
6
6
|
describe TimeCard do
|
7
|
-
context "
|
7
|
+
context "始業9:00、終業19:00、休憩11:00〜12:00、15:00〜16:00が2日間のとき" do
|
8
8
|
before do
|
9
|
-
@time_card = TimeCard.new
|
10
|
-
|
9
|
+
@time_card = TimeCard.new(1,1)
|
10
|
+
@time_card.add_row(TimeCardRow.new("2013/5/12", "9:00", "19:00", ["11:00", "12:00"], ["15:00", "16:00"]).set_fixed_working_hours("7:00"))
|
11
|
+
@time_card.add_row(TimeCardRow.new("2013/5/13", "9:00", "19:00", ["11:00", "12:00"], ["15:00", "16:00"]).set_fixed_working_hours("7:00"))
|
12
|
+
end
|
13
|
+
|
14
|
+
it "残業時間のトータルは2:00となる" do
|
15
|
+
@time_card.total_over_time.should == "2:00"
|
11
16
|
end
|
12
17
|
|
13
18
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calc_working_hours
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi_U
|
@@ -14,54 +14,54 @@ dependencies:
|
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description:
|
55
|
+
description: 例えば、173:08のような表記の時間を計算するライブラリです
|
56
56
|
email:
|
57
57
|
- ''
|
58
58
|
executables: []
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
62
|
+
- .gitignore
|
63
|
+
- .rspec
|
64
|
+
- .travis.yml
|
65
65
|
- Gemfile
|
66
66
|
- LICENSE.txt
|
67
67
|
- README.md
|
@@ -92,20 +92,20 @@ require_paths:
|
|
92
92
|
- lib
|
93
93
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - '>='
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- -
|
100
|
+
- - '>='
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
103
|
requirements: []
|
104
104
|
rubyforge_project:
|
105
|
-
rubygems_version: 2.
|
105
|
+
rubygems_version: 2.0.3
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
|
-
summary:
|
108
|
+
summary: 時間計算
|
109
109
|
test_files:
|
110
110
|
- spec/calc_working_hours/data_sample.csv
|
111
111
|
- spec/calc_working_hours/invalid_data_sample.csv
|