reading_assignments 0.1.3 → 0.1.4
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/lib/input_validator.rb +10 -1
- data/lib/mentor_group.rb +15 -1
- data/lib/reading_assignments/version.rb +1 -1
- data/lib/reading_assignments.rb +2 -1
- data/lib/student_randomizer.rb +4 -1
- 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: a8fafc103ef13984f0ec1d6f81920171cfbbb951
|
4
|
+
data.tar.gz: 62a5d4d6007559218caa1608720bf1607493b774
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d92d213960bcbdf9442fe94d1a71ade98481128801304623579a427a4fe6182a1828f37a8e92cc0699ab8122a73df0f32528a54e1f98ac711ede58e54d4fe69b
|
7
|
+
data.tar.gz: effaf19c017eac9d5b89bc017f4f619546f9078a65c9f2187ba52daae103c906bbbbd63dca320b631fd7065f33f52712e53c69eec89250c4311b2b93b40342e7
|
data/lib/input_validator.rb
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
class InputValidator
|
2
|
-
|
2
|
+
|
3
|
+
def self.reset_mentees_input
|
4
|
+
input = gets.chomp
|
5
|
+
while !['y', 'n'].include?(input)
|
6
|
+
puts 'Please try again, that was not valid'
|
7
|
+
input = gets.chomp
|
8
|
+
end
|
9
|
+
return input
|
10
|
+
end
|
11
|
+
|
3
12
|
def self.get_type_input
|
4
13
|
input = gets.chomp
|
5
14
|
while !['number', 'string', 'random'].include?(input)
|
data/lib/mentor_group.rb
CHANGED
@@ -12,7 +12,7 @@ class MentorGroup
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.create_persisted_mentees(store)
|
15
|
-
puts 'What are the names of the people in your group (please separate by comma)?'
|
15
|
+
puts 'What are the names of the people in your group (please separate by a comma followed by a space)?'
|
16
16
|
name_string = gets.chomp
|
17
17
|
new_mentees = name_string.split(', ')
|
18
18
|
|
@@ -23,4 +23,18 @@ class MentorGroup
|
|
23
23
|
end
|
24
24
|
return mentees
|
25
25
|
end
|
26
|
+
|
27
|
+
def self.reset_mentees_option(store)
|
28
|
+
puts 'Would you like to reset your group and input their names again?'
|
29
|
+
reset_choice = InputValidator.reset_mentees_input
|
30
|
+
if reset_choice == 'y'
|
31
|
+
mentees = self.create_persisted_mentees(store)
|
32
|
+
return mentees
|
33
|
+
else
|
34
|
+
store.transaction do
|
35
|
+
mentees = store["mentees"]
|
36
|
+
return mentees
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
26
40
|
end
|
data/lib/reading_assignments.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require "reading_assignments/version"
|
2
2
|
require 'pry'
|
3
|
-
require 'csv'
|
4
3
|
require 'yaml/store'
|
5
4
|
require_relative 'mentor_group'
|
6
5
|
require_relative 'student'
|
@@ -14,6 +13,8 @@ module ReadingAssignments
|
|
14
13
|
|
15
14
|
if !mentees
|
16
15
|
mentees = MentorGroup.create_persisted_mentees(store)
|
16
|
+
else
|
17
|
+
mentees = MentorGroup.reset_mentees_option(store)
|
17
18
|
end
|
18
19
|
|
19
20
|
mentor_group = MentorGroup.new(mentees)
|
data/lib/student_randomizer.rb
CHANGED
@@ -26,7 +26,10 @@ class StudentRandomizer
|
|
26
26
|
articles.times do
|
27
27
|
random_index = random_generator.rand(0...@group_size)
|
28
28
|
student = chosen_student(random_index)
|
29
|
-
|
29
|
+
while @chosen_students.include?(student)
|
30
|
+
if @chosen_students.length == articles
|
31
|
+
@chosen_students = []
|
32
|
+
end
|
30
33
|
random_index = random_generator.rand(0...@group_size)
|
31
34
|
student = chosen_student(random_index)
|
32
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reading_assignments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Thomson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|