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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04b72178e370837df8a5f4730963cd6ffbfdc896
4
- data.tar.gz: abbd6d36fd9e6919a5c0d034de207daa4722c420
3
+ metadata.gz: a8fafc103ef13984f0ec1d6f81920171cfbbb951
4
+ data.tar.gz: 62a5d4d6007559218caa1608720bf1607493b774
5
5
  SHA512:
6
- metadata.gz: 0dcf79b20b08179af5ba9ec5f1383b3f6dfa157c896648f31ef0bc00629413b17aaa38a66b050eb7e7574ca454c4808fa4e5383f1a6e9cc057e61b1d12cd5a42
7
- data.tar.gz: 62074762d43bf028627280a6939782af8ea816c5ab7d47bd73581157d4728d2ddff80387b53bc8d07b879396898b09e7fe4b775dde2b9bf0b7b29a26c4795aec
6
+ metadata.gz: d92d213960bcbdf9442fe94d1a71ade98481128801304623579a427a4fe6182a1828f37a8e92cc0699ab8122a73df0f32528a54e1f98ac711ede58e54d4fe69b
7
+ data.tar.gz: effaf19c017eac9d5b89bc017f4f619546f9078a65c9f2187ba52daae103c906bbbbd63dca320b631fd7065f33f52712e53c69eec89250c4311b2b93b40342e7
@@ -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
@@ -1,3 +1,3 @@
1
1
  module ReadingAssignments
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -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)
@@ -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
- until !@chosen_students.include?(student)
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.3
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-12 00:00:00.000000000 Z
11
+ date: 2017-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler