arbeitszeitkonto 0.5.0 → 0.5.1
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 +4 -4
- data/README.md +2 -0
- data/arbeitszeitkonto.gemspec +1 -1
- data/lib/arbeitszeitkonto.rb +6 -4
- data/lib/arbeitszeitkonto/feiertag_zeitkonto_calculator.rb +3 -1
- data/lib/arbeitszeitkonto/taeglich_zeitkonto_calculator.rb +29 -27
- data/lib/arbeitszeitkonto/version.rb +4 -2
- data/lib/arbeitszeitkonto/woechentlich_zeitkonto_calculator.rb +3 -1
- data/lib/arbeitszeitkonto/zeitkonto_calculator.rb +3 -1
- data/lib/arbeitszeitkonto/zeitspanne.rb +3 -1
- data/sandbox/time_manipulation.rb +8 -6
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f6425691fd8e0be9593c714dbe38bf1d92376292
|
|
4
|
+
data.tar.gz: c763585e354f589312bc797f68eaf593c0b55419
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0b1a911f03c6ffe8bcaae03e7d49a55c05212d9450a87399d341f5c5a9de30422ac154e34b5925bc1f97d036f6d3b0279c3bd2955704055cf30752a5eaf38551
|
|
7
|
+
data.tar.gz: a532b4d2a031131a26e228975f7a840be13199af18a944d4e2737c7fab7c6242c0b7e0cb6dbba95e640dd34e469e1b90fc113a467a5eeeafcf584289a14f4b30
|
data/README.md
CHANGED
|
@@ -5,6 +5,8 @@ Berechnet die Zetien einer Zeitspanne für die einzelnen Zeitkonti.
|
|
|
5
5
|
## Versionen
|
|
6
6
|
### 0.5.0 27. August 2015
|
|
7
7
|
* Initialversion, für die Bedürfnisse von ATG erstellt
|
|
8
|
+
### 0.5.1 11. September 2015
|
|
9
|
+
* Initialversion, Namespace 'Planik'
|
|
8
10
|
|
|
9
11
|
|
|
10
12
|
## gem erstellen und auf rubygems raufladen
|
data/arbeitszeitkonto.gemspec
CHANGED
|
@@ -5,7 +5,7 @@ require 'arbeitszeitkonto/version'
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "arbeitszeitkonto"
|
|
8
|
-
spec.version = Arbeitszeitkonto::VERSION
|
|
8
|
+
spec.version = Planik::Arbeitszeitkonto::VERSION
|
|
9
9
|
spec.authors = ["Christian Mühlethaler"]
|
|
10
10
|
spec.email = ["christian.muehlethaler@optor.ch"]
|
|
11
11
|
|
data/lib/arbeitszeitkonto.rb
CHANGED
|
@@ -6,8 +6,10 @@ require "arbeitszeitkonto/zeitkonto_calculator"
|
|
|
6
6
|
require "arbeitszeitkonto/taeglich_zeitkonto_calculator"
|
|
7
7
|
require "arbeitszeitkonto/woechentlich_zeitkonto_calculator"
|
|
8
8
|
require "arbeitszeitkonto/feiertag_zeitkonto_calculator"
|
|
9
|
-
|
|
10
|
-
module Arbeitszeitkonto
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
module Planik
|
|
10
|
+
module Arbeitszeitkonto
|
|
11
|
+
class ArbeitszeitkontoError < StandardError;
|
|
12
|
+
end
|
|
13
|
+
# Your code goes here...
|
|
14
|
+
end
|
|
13
15
|
end
|
|
@@ -1,35 +1,37 @@
|
|
|
1
|
-
module
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
# Ein Zeitkonto im Rhythmus :täglich
|
|
5
|
-
##
|
|
6
|
-
class TaeglichZeitkontoCalculator < ZeitkontoCalculator
|
|
1
|
+
module Planik
|
|
2
|
+
module Arbeitszeitkonto
|
|
7
3
|
|
|
8
4
|
##
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@zeit_von = zeit_von
|
|
13
|
-
@zeit_bis = zeit_bis
|
|
14
|
-
end
|
|
5
|
+
# Ein Zeitkonto im Rhythmus :täglich
|
|
6
|
+
##
|
|
7
|
+
class TaeglichZeitkontoCalculator < ZeitkontoCalculator
|
|
15
8
|
|
|
9
|
+
##
|
|
10
|
+
#
|
|
11
|
+
#
|
|
12
|
+
def initialize zeit_von, zeit_bis
|
|
13
|
+
@zeit_von = zeit_von
|
|
14
|
+
@zeit_bis = zeit_bis
|
|
15
|
+
end
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
|
|
18
|
+
##
|
|
19
|
+
# Liefert
|
|
20
|
+
# * Anzahl Sekunden, welche die gegebene :zeitspanne mit dem Zeitkonto überlappt
|
|
21
|
+
# * Die Reste (Zeitspanne[n])
|
|
22
|
+
##
|
|
23
|
+
def calculate zeitspannen
|
|
24
|
+
reste = []
|
|
25
|
+
seconds = 0
|
|
26
|
+
Array(zeitspannen).each do |zeitspanne|
|
|
27
|
+
zeitspanne_1 = Zeitspanne.relative(zeitspanne.datum - 1, @zeit_von, @zeit_bis)
|
|
28
|
+
zeitspanne_2 = Zeitspanne.relative(zeitspanne.datum, @zeit_von, @zeit_bis)
|
|
29
|
+
sec, r = calc(Array(zeitspanne), [zeitspanne_1, zeitspanne_2])
|
|
30
|
+
seconds+=sec
|
|
31
|
+
reste.push(*r)
|
|
32
|
+
end
|
|
33
|
+
[seconds, reste]
|
|
31
34
|
end
|
|
32
|
-
[seconds, reste]
|
|
33
35
|
end
|
|
34
36
|
end
|
|
35
37
|
end
|
|
@@ -20,16 +20,18 @@ require 'arbeitszeitkonto'
|
|
|
20
20
|
# bis = Time.new(2014, 8, 27, 06, 0, 0) #Montag 6:00 Uhr
|
|
21
21
|
# puts((bis.to_date - von.to_date).to_i)
|
|
22
22
|
|
|
23
|
+
module Planik
|
|
23
24
|
|
|
24
|
-
def calculate_tage_zurueck(wday_calculator, wday_kandidat)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
end
|
|
25
|
+
def calculate_tage_zurueck(wday_calculator, wday_kandidat)
|
|
26
|
+
#anzahl_tage_zurueck = wday_kandidat >= wday_calculator ? wday_kandidat - wday_calculator : (wday_kandidat + 6) - wday_calculator
|
|
27
|
+
anzahl_tage_zurueck = (wday_kandidat - wday_calculator) % 7
|
|
28
|
+
#puts "WoechentlichZeitKontoCalculator#calculate: Zeitspanne: wday Kandidat = #{wday_kandidat}, wday Calculator: #{wday_calculator}, anzahl_tage_zurueck: #{anzahl_tage_zurueck}"
|
|
29
|
+
end
|
|
29
30
|
|
|
30
31
|
# calculate_tage_zurueck(0, 1)
|
|
31
32
|
# calculate_tage_zurueck(2, 3)
|
|
32
33
|
# calculate_tage_zurueck(0, 6)
|
|
33
34
|
|
|
34
35
|
|
|
35
|
-
calculate_tage_zurueck(3, 2)
|
|
36
|
+
calculate_tage_zurueck(3, 2)
|
|
37
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: arbeitszeitkonto
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Christian Mühlethaler
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-09-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|