gthc 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gthc/olson.rb +10 -0
- data/lib/gthc/olson/person.rb +17 -0
- data/lib/gthc/olson/slot.rb +44 -0
- data/lib/gthc/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70381a1386ec4f12793185fdb92de92e4a4c8bceea8d96a7ead6e0a6efbc9e9e
|
4
|
+
data.tar.gz: 9e986223088c9a60e48f93601f37d3c46fcfc2e7caeb86a8123398493c3bfea3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c4a5f33d44ec652b3452bfdf663d804823816674c9ad0e82871318580a9b6439875216f76e3967b41200bb557abe128322328be62be25da903d8aeeff4f0f31
|
7
|
+
data.tar.gz: 9242356aedeb3a73fb220d6d34dfca1bc3dca2797b4c384a128d8b6693045ce97dd6e8a620c5b45d97edf37aaf827edd69c2f58832251122c297d0554e552e93
|
data/lib/gthc/olson.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
require "gthc/olson/algorithm"
|
2
|
+
require "gthc/olson/person"
|
3
|
+
require "gthc/olson/slot"
|
2
4
|
|
3
5
|
module GTHC
|
4
6
|
module Olson
|
@@ -8,5 +10,13 @@ module GTHC
|
|
8
10
|
# Algorithm
|
9
11
|
schedule(peopleList, scheduleGrid)
|
10
12
|
end
|
13
|
+
|
14
|
+
def self.Person
|
15
|
+
Person
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.Slot
|
19
|
+
Slot
|
20
|
+
end
|
11
21
|
end
|
12
22
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Person
|
2
|
+
attr_accessor :id,
|
3
|
+
:name,
|
4
|
+
:dayFree, :nightFree,
|
5
|
+
:dayScheduled, :nightScheduled
|
6
|
+
|
7
|
+
def initialize(id, name, dayFree, nightFree, dayScheduled, nightScheduled)
|
8
|
+
@id = id
|
9
|
+
@name = name
|
10
|
+
@dayFree = dayFree
|
11
|
+
@dayScheduled = dayScheduled
|
12
|
+
@nightFree = nightFree
|
13
|
+
@nightScheduled = nightScheduled
|
14
|
+
# @maxDayHours = maxDayHours
|
15
|
+
# @idealDayHours = idealDayHours
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Slots objects make up the ScheduleGrid input.
|
2
|
+
|
3
|
+
class Slot
|
4
|
+
attr_accessor :personID, :ids,
|
5
|
+
:startDate, :endDate,
|
6
|
+
:phase,
|
7
|
+
:isNight,
|
8
|
+
:status,
|
9
|
+
:row, :col,
|
10
|
+
:weight
|
11
|
+
|
12
|
+
def initialize(personID, startDate, endDate, phase, isNight, status, row, col, weight=1)
|
13
|
+
@personID = personID
|
14
|
+
@startDate = startDate
|
15
|
+
@endDate = endDate
|
16
|
+
@phase = phase
|
17
|
+
@isNight = isNight
|
18
|
+
@status = status
|
19
|
+
@row = row
|
20
|
+
@col = col
|
21
|
+
@weight = 1
|
22
|
+
@ids = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_hash
|
26
|
+
hash = {}
|
27
|
+
instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
|
28
|
+
hash
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.attr_accessor(*vars)
|
32
|
+
@attributes ||= []
|
33
|
+
@attributes.concat vars
|
34
|
+
super(*vars)
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.attributes
|
38
|
+
@attributes
|
39
|
+
end
|
40
|
+
|
41
|
+
def attributes
|
42
|
+
self.class.attributes
|
43
|
+
end
|
44
|
+
end
|
data/lib/gthc/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gthc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aman Ibrahim
|
@@ -77,6 +77,8 @@ files:
|
|
77
77
|
- lib/gthc/olson.rb
|
78
78
|
- lib/gthc/olson/algorithm.rb
|
79
79
|
- lib/gthc/olson/helpers.rb
|
80
|
+
- lib/gthc/olson/person.rb
|
81
|
+
- lib/gthc/olson/slot.rb
|
80
82
|
- lib/gthc/olson/weight.rb
|
81
83
|
- lib/gthc/version.rb
|
82
84
|
homepage: https://www.gthc.io/
|