work_together 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/work_together/client.yml +3 -0
- data/lib/work_together/version.rb +1 -1
- data/lib/work_together.rb +36 -12
- 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: 4395d6f7fd17e9876bdfe98481a9bbecc7d2f323
|
4
|
+
data.tar.gz: 5dd2911a1f6aa3dea4ea2bac5950ae67f6d53043
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 941027bf9b07dd5c4d0a53d44b55159691d1e2b8cce6abb2f4ed91f2c5a47fa52235724a6f2d0767d030e1ff67a8b2d2149eaf2b8705b716b8dfd5bb3636f33d
|
7
|
+
data.tar.gz: 9154b8d6d39d82a4050f2627152f1fd5b50412e4b68cb021aa915904b820e9756a6a92d52cec9234473ce805bba703826afa8dc95a6432108d64b11354b5212f
|
data/lib/work_together.rb
CHANGED
@@ -11,7 +11,7 @@ module WorkTogether
|
|
11
11
|
|
12
12
|
attr_accessor :batch_id, :client, :pair_maker, :keys
|
13
13
|
|
14
|
-
def initialize(batch_id)
|
14
|
+
def initialize(batch_id=nil)
|
15
15
|
@batch_id = batch_id
|
16
16
|
@pair_maker = PairMaker.new
|
17
17
|
end
|
@@ -28,6 +28,11 @@ module WorkTogether
|
|
28
28
|
Student.generate_from_data(student_data)
|
29
29
|
end
|
30
30
|
|
31
|
+
def make_batch_data
|
32
|
+
configure_client
|
33
|
+
get_and_parse_csv
|
34
|
+
end
|
35
|
+
|
31
36
|
def make_groups(options, quiet)
|
32
37
|
flag = options[1][2..-1]
|
33
38
|
if options.include?("pairs")
|
@@ -39,21 +44,11 @@ module WorkTogether
|
|
39
44
|
else
|
40
45
|
puts "Please enter a valid command. Type work-together --help for more."
|
41
46
|
end
|
42
|
-
|
47
|
+
Group.display_groups if !quiet && Group.all.length > 0
|
43
48
|
end
|
44
49
|
|
45
50
|
private
|
46
51
|
|
47
|
-
def display_tables
|
48
|
-
Table.all.each_with_index do |table, i|
|
49
|
-
puts "Group #{i + 1}:".colorize(:blue)
|
50
|
-
table.students.each do |student|
|
51
|
-
puts student.name.colorize(:light_blue)
|
52
|
-
end
|
53
|
-
puts "-------------------".colorize(:blue)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
52
|
def help
|
58
53
|
puts "Available commands:"
|
59
54
|
puts "work-together pairs --random batch-number generate pairs randomly"
|
@@ -94,6 +89,23 @@ module WorkTogether
|
|
94
89
|
end
|
95
90
|
end
|
96
91
|
|
92
|
+
class Group
|
93
|
+
|
94
|
+
def self.all
|
95
|
+
Table.all
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.display_groups
|
99
|
+
Table.all.each_with_index do |table, i|
|
100
|
+
puts "Group #{i + 1}:".colorize(:blue)
|
101
|
+
table.students.each do |student|
|
102
|
+
puts student.name.colorize(:light_blue)
|
103
|
+
end
|
104
|
+
puts "-------------------".colorize(:blue)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
97
109
|
class Student
|
98
110
|
@@all = []
|
99
111
|
|
@@ -107,6 +119,12 @@ module WorkTogether
|
|
107
119
|
@@all
|
108
120
|
end
|
109
121
|
|
122
|
+
def self.build_attributes(headers)
|
123
|
+
headers.each do |header|
|
124
|
+
attr_accessor header.to_sym
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
110
128
|
def name
|
111
129
|
"#{first_name} #{last_name}"
|
112
130
|
end
|
@@ -115,7 +133,13 @@ module WorkTogether
|
|
115
133
|
self.completion
|
116
134
|
end
|
117
135
|
|
136
|
+
def self.attributes_from_data(data)
|
137
|
+
attributes = data.first.to_hash.keys
|
138
|
+
self.build_attributes(attributes)
|
139
|
+
end
|
140
|
+
|
118
141
|
def self.generate_from_data(data)
|
142
|
+
attributes_from_data(data)
|
119
143
|
data.each do |student_hash|
|
120
144
|
student_hash.delete_if {|attribute, value| !Student.instance_methods.include?(attribute.to_sym)}
|
121
145
|
self.new.tap do |student|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: work_together
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sophie DeBenedetto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|