calc_working_hours 0.2.0 → 0.2.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea21e50f8b5b8af5843d898a5019f54bd5e4c4d0
|
4
|
+
data.tar.gz: 5eb6efc9ff0decf4ca6348c62007ddad425d82cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16e476bd0df661b86ecf69877ca07adbf3e12ef4f14cee526d120247f3dff77b30a0e771542b8d596211333378d06a204f4543a652fd787933ecc546fdf099a6
|
7
|
+
data.tar.gz: 2c9b9ca198e8b52abffe72ce7718ddc022163947fe30cd43ce912926a47058c41954459c1a9a78b45bc37f2d7ff917fb349675fde7bdade764f6b3da1e309a07
|
@@ -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, :
|
8
|
+
attr_reader :starting_time, :ending_time, :break_time, :working_hours, :date_string, :time_point, :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"
|
@@ -84,7 +84,12 @@ module CalcWorkingHours
|
|
84
84
|
array_of_working_hours << WorkingHours.new(ending_time).minus_time(starting_time).time_string
|
85
85
|
end
|
86
86
|
end
|
87
|
-
return
|
87
|
+
return WorkingHours.new("0:00").add_array_time(array_of_working_hours).time_string
|
88
88
|
end
|
89
|
+
|
90
|
+
def between_10pm_and_5am
|
91
|
+
self.working_hours_in_range("22:00", "29:00")
|
92
|
+
end
|
93
|
+
|
89
94
|
end
|
90
95
|
end
|
@@ -44,7 +44,6 @@ describe TimeCardRow do
|
|
44
44
|
it "所定労働時間を8:20とすると、残業時間は0:00となる" do
|
45
45
|
@time_card_row.set_fixed_working_hours("8:20").over_time.time_string.should == "0:00"
|
46
46
|
end
|
47
|
-
|
48
47
|
end
|
49
48
|
|
50
49
|
context "始業11:30、終業23:34、休憩15:38〜17:14のとき" do
|
@@ -103,7 +102,18 @@ describe TimeCardRow do
|
|
103
102
|
it "始業8:00、終業19:00、休憩7:00〜11:00は時系列が誤っているので、エラーが発生すること" do
|
104
103
|
proc { TimeCardRow.new("2013/5/12", "8:00", "19:00", ["7:00", "10:00"]) }.should raise_error
|
105
104
|
end
|
105
|
+
end
|
106
|
+
|
107
|
+
context "始業20:00、終業25:00のとき" do
|
108
|
+
it "深夜勤務時間は3:00となる" do
|
109
|
+
TimeCardRow.new("2013/5/12", "20:00", "25:00").between_10pm_and_5am.should == "3:00"
|
110
|
+
end
|
111
|
+
end
|
106
112
|
|
113
|
+
context "始業20:00、終業25:00、休憩23:00〜24:00のとき" do
|
114
|
+
it "深夜勤務時間は4:00となる" do
|
115
|
+
TimeCardRow.new("2013/5/12", "20:00", "25:00", ["23:00", "24:00"]).between_10pm_and_5am.should == "2:00"
|
116
|
+
end
|
107
117
|
end
|
108
118
|
|
109
119
|
end
|
@@ -14,6 +14,18 @@ describe TimeCard do
|
|
14
14
|
it "残業時間のトータルは2:00となる" do
|
15
15
|
@time_card.total_over_time.should == "2:00"
|
16
16
|
end
|
17
|
+
end
|
17
18
|
|
19
|
+
context "始業24:00、終業30:00、休憩25:00〜26:00が2日間のとき" do
|
20
|
+
before do
|
21
|
+
@time_card = TimeCard.new(1,1)
|
22
|
+
@time_card.add_row(TimeCardRow.new("2013/5/12", "24:00", "30:00",["25:00", "26:00"]).set_fixed_working_hours("7:00"))
|
23
|
+
@time_card.add_row(TimeCardRow.new("2013/5/13", "24:00", "30:00",["25:00", "26:00"]).set_fixed_working_hours("7:00"))
|
24
|
+
end
|
25
|
+
|
26
|
+
it "深夜時間のトータルは8:00となる" do
|
27
|
+
@time_card.total_night_time.should == "8:00"
|
28
|
+
end
|
18
29
|
end
|
30
|
+
|
19
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calc_working_hours
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi_U
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|