gpa 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e331d8bc054e18a4ac6e3d0a3b54593ceb6f8f6e
4
- data.tar.gz: 6b59845c7666cc06fc2b50d6cf0a72b6fe616108
3
+ metadata.gz: 6653a21e5b18b9b4c5e130c9d918852f5ccb3278
4
+ data.tar.gz: 9550f6daeafd69232d497632bbb6c43552587d80
5
5
  SHA512:
6
- metadata.gz: ebd1ef9d055e2f55cfd706f40b7dc0d5c1848418e267554faf5e4284c776a3b30fdd546a7dcb720e90ce61f9908b785a89cfe79c733d9acc677d50580dbdb7f0
7
- data.tar.gz: 1414f1b0b0a0949e9dabd0b424807cb2322961c64e455ce841b0aa525aad759da1f26b45031abf0b76a406c9bb1e32edbe6a22079d3fcd41480484cedc4344da
6
+ metadata.gz: 97ff09cdb950afa1bf9f6803289fd42cc9ea4662ddf8b1d7bc9ba5655259e95e68b87a89820030422508207facae0cd9f85d265e38f5e2e5d75def8dd6f37852
7
+ data.tar.gz: dc5ed77378c3e05d0f02c54204e3a4ce239ebe0a9572a580b61cf07e938bc23174a9d5b5cd12ae3ab03f2317a88d38ad38946811b7b5881eb755459c49c4cc43
@@ -8,8 +8,6 @@ Gem::Specification.new do |gem|
8
8
  gem.summary = %q{Academic course data manipulation and GPA calculation module}
9
9
  gem.homepage = "https://github.com/dmorrill10/GPA"
10
10
 
11
- gem.add_dependency 'dmorrill10-utils', '~> 2.0.0'
12
-
13
11
  gem.add_development_dependency 'simplecov', '~> 0.8.2'
14
12
  gem.add_development_dependency 'minitest', '~> 5.2.0'
15
13
 
data/lib/gpa.rb CHANGED
@@ -1,49 +1,59 @@
1
- require "gpa/version"
2
- require "gpa/course"
3
-
4
- require 'dmorrill10-utils/enumerable'
1
+ require_relative "gpa/version"
2
+ require_relative "gpa/course"
5
3
  require 'yaml'
6
- require 'dmorrill10-utils/yaml'
7
-
8
- class Array
9
- # @param [Integer] num_most_recent_units
10
- # @returns [Numeric] The GPA calculated with +num_most_recent_units+ most recent units completed.
11
- def gpa(num_most_recent_units=units_completed)
12
- courses = reject do |course|
13
- !course.respond_to?(:grade_points) || course.grade_points.nil?
14
- end.sort_courses_by_date_completed.inject([]) do |accum_array, course|
15
- accum_array << course
16
- break accum_array if accum_array.units_completed >= num_most_recent_units
17
- accum_array
4
+
5
+ module Gpa
6
+ class CourseArray < Array
7
+ def self.load_courses_from_file(yaml_file_path)
8
+ load_yaml_from_file(yaml_file_path).inject(new) do |new_instance, yaml_course|
9
+ new_instance << Course.from_hash(yaml_course)
10
+ end
18
11
  end
19
12
 
20
- courses.map { |course| course.grade_points }.sum / courses.units_completed.to_f
21
- end
13
+ # @param [Integer] num_most_recent_units
14
+ # @returns [Numeric] The GPA calculated with +num_most_recent_units+ most recent units completed.
15
+ def gpa(num_most_recent_units = units_completed)
16
+ courses = sort_courses_by_date_completed.inject(CourseArray.new) do |accum_array, course|
17
+ next accum_array unless course.grade_has_points?
18
+ accum_array << course
19
+ break accum_array if accum_array.units_completed >= num_most_recent_units
20
+ accum_array
21
+ end
22
22
 
23
- def units_completed
24
- completed_courses.map do |course|
25
- course.units
26
- end.sum
27
- end
23
+ courses.inject(0) do |sum, course|
24
+ sum += course.grade_points / courses.units_completed.to_f
25
+ end
26
+ end
28
27
 
29
- def sort_courses_by_date_completed
30
- completed_courses.sort do |c1, c2|
31
- c2.date_completed <=> c1.date_completed
28
+ def units_completed
29
+ completed_courses.inject(0) do |sum, course|
30
+ sum += course.units
31
+ end
32
32
  end
33
- end
34
33
 
35
- def completed_courses
36
- current_date = DateTime.now
37
- select do |course|
38
- course.respond_to?(:date_completed) &&
39
- course.date_completed < current_date &&
40
- !course.grade.nil?
34
+ def sort_courses_by_date_completed
35
+ self.class().new(
36
+ completed_courses.sort do |c1, c2|
37
+ c2.date_completed <=> c1.date_completed
38
+ end
39
+ )
41
40
  end
42
- end
43
- end
44
41
 
45
- module Gpa
46
- def self.load_courses_from_file(yaml_file_path)
47
- YAML.load_stream_from_file(yaml_file_path)
42
+ def completed_courses
43
+ current_date = DateTime.now
44
+ select do |course|
45
+ course.respond_to?(:date_completed) &&
46
+ course.date_completed < current_date &&
47
+ !course.grade.nil?
48
+ end
49
+ end
50
+
51
+ private
52
+
53
+ # Load the document contained in +filename+. Returns the yaml contained in
54
+ # +filename+ as a ruby object
55
+ def self.load_yaml_from_file(filename)
56
+ File.open(filename, 'r:bom|utf-8') { |f| YAML.load_stream f, filename }
57
+ end
48
58
  end
49
59
  end
@@ -1,209 +1,243 @@
1
- class String
2
- # @returns [Numeric] Number of grade points for this grade
3
- def points
4
- Course::UNIVERSITY_OF_ALBERTA_GRADE_TO_POINTS[self]
1
+ module Gpa
2
+ class Grade < String
3
+ # @return [Hash<String, Numeric>] University of Alberta grade to grade points hash.
4
+ UNIVERSITY_OF_ALBERTA_GRADE_TO_POINTS = {
5
+ 'A+' => 4.0,
6
+ 'A' => 4.0,
7
+ 'A-' => 3.7,
8
+ 'B+' => 3.3,
9
+ 'B' => 3.0,
10
+ 'B-' => 2.7,
11
+ 'C+' => 2.3,
12
+ 'C' => 2.0,
13
+ 'C-' => 1.7,
14
+ 'D+' => 1.3,
15
+ 'D' => 1.0,
16
+ 'F' => 0.0
17
+ }
18
+
19
+ # @returns [Numeric] Number of grade points for this grade
20
+ def points
21
+ points_ = UNIVERSITY_OF_ALBERTA_GRADE_TO_POINTS[self]
22
+ unless points_
23
+ raise StandarError.new("Grade of \"#{self}\" has no point value!")
24
+ end
25
+ points_
26
+ end
27
+
28
+ def has_points?
29
+ !UNIVERSITY_OF_ALBERTA_GRADE_TO_POINTS[self].nil?
30
+ end
5
31
  end
6
- end
7
32
 
8
- class Course
9
- # @return [Hash<String, Numeric>] University of Alberta grade to grade points hash.
10
- UNIVERSITY_OF_ALBERTA_GRADE_TO_POINTS = {
11
- 'A+' => 4.0,
12
- 'A' => 4.0,
13
- 'A-' => 3.7,
14
- 'B+' => 3.3,
15
- 'B' => 3.0,
16
- 'B-' => 2.7,
17
- 'C+' => 2.3,
18
- 'C' => 2.0,
19
- 'C-' => 1.7,
20
- 'D+' => 1.3,
21
- 'D' => 1.0,
22
- 'F' => 0.0
23
- }
33
+ class Course
34
+ # @todo Incomplete list of subjects. Not a big deal though because faculty can be specified on a per course basis.
35
+ # @return [Hash<String, Array<String>>] University of Alberta subject hierarchy.
36
+ UNIVERSITY_OF_ALBERTA_SUBJECT_HIERARCHY = {
37
+ 'ALES' => [
38
+ # Agricultural and Resource Economics
39
+ 'AREC',
40
+ # Agricultural, Food and Nutritional Science
41
+ 'AFNS',
42
+ # Agricultural, Life and Environmental Sciences
43
+ 'ALES',
44
+ # Animal Science
45
+ 'AN SC',
46
+ # Environmental and Conservation Sciences
47
+ 'ENCS',
48
+ # Forest Economics
49
+ 'FOREC',
50
+ # Forest Engineering
51
+ 'FOREN',
52
+ # Forest Science
53
+ 'FOR',
54
+ # Human Ecology
55
+ 'HECOL',
56
+ # Interdisciplinary Courses
57
+ 'INT D',
58
+ # Nutrition
59
+ 'NUTR',
60
+ # Nutrition and Food Sciences
61
+ 'NU FS',
62
+ # Plant Science
63
+ 'PL SC',
64
+ # Renewable Resources
65
+ 'REN R',
66
+ # Rural Sociology
67
+ 'R SOC',
68
+ # Soil Science
69
+ 'SOILS',
70
+ # University
71
+ 'UNIV',
72
+ # Work Experience
73
+ 'WKEXP'
74
+ ],
75
+ 'Arts' => [
76
+ 'ANTHR',
77
+ 'ART H',
78
+ 'ART',
79
+ 'DES',
80
+ 'DRAMA',
81
+ 'ECON',
82
+ 'ENGL',
83
+ 'FS',
84
+ 'HIST',
85
+ 'POL S',
86
+ 'RELIG',
87
+ 'WRITE',
88
+ 'WRS',
89
+ 'LING',
90
+ 'CLASS',
91
+ 'GREEK',
92
+ 'LATIN',
93
+ 'MUSIC',
94
+ 'PHIL',
95
+ # 'PSYCO', Must be specified per course since could be art or science
96
+ 'SOC',
97
+ 'CSL',
98
+ 'C LIT',
99
+ 'INT D',
100
+ 'W ST'
101
+ ],
102
+ 'Science' => [
103
+ # Astronomy
104
+ 'ASTRO',
105
+ # Biochemistry (taught by the Faculty of Medicine and Dentistry)
106
+ 'BIOCH',
107
+ # Biochimie (Faculté Saint-Jean)
108
+ 'BIOCM',
109
+ # Biological Science - Biology
110
+ 'BIOL',
111
+ # Biological Science - Botany
112
+ 'BOT',
113
+ # Biological Science - Entomology
114
+ 'ENT',
115
+ # Biological Science - Genetics
116
+ 'GENET',
117
+ # Biological Science - Microbiology
118
+ 'MICRB',
119
+ # Biological Science - Zoology
120
+ 'ZOOL',
121
+ # Biologie (Faculté Saint-Jean)
122
+ 'BIOLE',
123
+ # Cell Biology (taught by the Faculty of Medicine and Dentistry)
124
+ 'CELL',
125
+ # Chemistry
126
+ 'CHEM',
127
+ # Chimie (Faculté Saint-Jean)
128
+ 'CHIM',
129
+ # Computing Science
130
+ 'CMPUT',
131
+ # Earth and Atmospheric Sciences [formerly Geography and Geology
132
+ 'EAS',
133
+ # Environmental Physical Sciences
134
+ 'ENVPS',
135
+ # Geophysics
136
+ 'GEOPH',
137
+ # Immunology and Infection
138
+ 'IMIN',
139
+ # Laboratory Animal Management
140
+ 'LB AN',
141
+ # Marine Science
142
+ 'MA SC',
143
+ # Mathematical Physics
144
+ 'MA PH',
145
+ # Mathematics
146
+ 'MATH',
147
+ # Mathématiques (Faculté Saint-Jean)
148
+ 'MATHQ',
149
+ # Neuroscience (taught by the Faculty of Medicine and Dentistry)
150
+ 'NEURO',
151
+ # Paleontology
152
+ 'PALEO',
153
+ # Pharmacology (taught by the Faculty of Medicine and Dentistry)
154
+ 'PMCOL',
155
+ # Physiology (taught by the Faculty of Medicine and Dentistry)
156
+ 'PHYSL',
157
+ # Physics
158
+ 'PHYS',
159
+ # Physique (Faculté Saint-Jean)
160
+ 'PHYSQ',
161
+ # Psychology
162
+ # 'PSYCO', Must be specified per course since could be art or science
163
+ # Sciences de la Terre et de l'atmosphére (Faculté Saint-Jean)
164
+ 'SCTA',
165
+ # Statistics
166
+ 'STAT',
167
+ # Statistique (Faculté Saint-Jean)
168
+ 'STATQ'
169
+ ]
24
170
 
25
- # @todo Incomplete list of subjects. Not a big deal though because faculty can be specified on a per course basis.
26
- # @return [Hash<String, Array<String>>] University of Alberta subject hierarchy.
27
- UNIVERSITY_OF_ALBERTA_SUBJECT_HIERARCHY = {
28
- 'ALES' => [
29
- # Agricultural and Resource Economics
30
- 'AREC',
31
- # Agricultural, Food and Nutritional Science
32
- 'AFNS',
33
- # Agricultural, Life and Environmental Sciences
34
- 'ALES',
35
- # Animal Science
36
- 'AN SC',
37
- # Environmental and Conservation Sciences
38
- 'ENCS',
39
- # Forest Economics
40
- 'FOREC',
41
- # Forest Engineering
42
- 'FOREN',
43
- # Forest Science
44
- 'FOR',
45
- # Human Ecology
46
- 'HECOL',
47
- # Interdisciplinary Courses
48
- 'INT D',
49
- # Nutrition
50
- 'NUTR',
51
- # Nutrition and Food Sciences
52
- 'NU FS',
53
- # Plant Science
54
- 'PL SC',
55
- # Renewable Resources
56
- 'REN R',
57
- # Rural Sociology
58
- 'R SOC',
59
- # Soil Science
60
- 'SOILS',
61
- # University
62
- 'UNIV',
63
- # Work Experience
64
- 'WKEXP'
65
- ],
66
- 'Arts' => [
67
- 'ANTHR',
68
- 'ART H',
69
- 'ART',
70
- 'DES',
71
- 'DRAMA',
72
- 'ECON',
73
- 'ENGL',
74
- 'FS',
75
- 'HIST',
76
- 'POL S',
77
- 'RELIG',
78
- 'WRITE',
79
- 'WRS',
80
- 'LING',
81
- 'CLASS',
82
- 'GREEK',
83
- 'LATIN',
84
- 'MUSIC',
85
- 'PHIL',
86
- # 'PSYCO', Must be specified per course since could be art or science
87
- 'SOC',
88
- 'CSL',
89
- 'C LIT',
90
- 'INT D',
91
- 'W ST'
92
- ],
93
- 'Science' => [
94
- # Astronomy
95
- 'ASTRO',
96
- # Biochemistry (taught by the Faculty of Medicine and Dentistry)
97
- 'BIOCH',
98
- # Biochimie (Faculté Saint-Jean)
99
- 'BIOCM',
100
- # Biological Science - Biology
101
- 'BIOL',
102
- # Biological Science - Botany
103
- 'BOT',
104
- # Biological Science - Entomology
105
- 'ENT',
106
- # Biological Science - Genetics
107
- 'GENET',
108
- # Biological Science - Microbiology
109
- 'MICRB',
110
- # Biological Science - Zoology
111
- 'ZOOL',
112
- # Biologie (Faculté Saint-Jean)
113
- 'BIOLE',
114
- # Cell Biology (taught by the Faculty of Medicine and Dentistry)
115
- 'CELL',
116
- # Chemistry
117
- 'CHEM',
118
- # Chimie (Faculté Saint-Jean)
119
- 'CHIM',
120
- # Computing Science
121
- 'CMPUT',
122
- # Earth and Atmospheric Sciences [formerly Geography and Geology
123
- 'EAS',
124
- # Environmental Physical Sciences
125
- 'ENVPS',
126
- # Geophysics
127
- 'GEOPH',
128
- # Immunology and Infection
129
- 'IMIN',
130
- # Laboratory Animal Management
131
- 'LB AN',
132
- # Marine Science
133
- 'MA SC',
134
- # Mathematical Physics
135
- 'MA PH',
136
- # Mathematics
137
- 'MATH',
138
- # Mathématiques (Faculté Saint-Jean)
139
- 'MATHQ',
140
- # Neuroscience (taught by the Faculty of Medicine and Dentistry)
141
- 'NEURO',
142
- # Paleontology
143
- 'PALEO',
144
- # Pharmacology (taught by the Faculty of Medicine and Dentistry)
145
- 'PMCOL',
146
- # Physiology (taught by the Faculty of Medicine and Dentistry)
147
- 'PHYSL',
148
- # Physics
149
- 'PHYS',
150
- # Physique (Faculté Saint-Jean)
151
- 'PHYSQ',
152
- # Psychology
153
- # 'PSYCO', Must be specified per course since could be art or science
154
- # Sciences de la Terre et de l'atmosphére (Faculté Saint-Jean)
155
- 'SCTA',
156
- # Statistics
157
- 'STAT',
158
- # Statistique (Faculté Saint-Jean)
159
- 'STATQ'
160
- ]
171
+ }
172
+ attr_reader(
173
+ # @returns [String]
174
+ :subject,
175
+ # @returns [Integer]
176
+ :number,
177
+ # @returns [String]
178
+ :name,
179
+ # @returns [Grade]
180
+ :grade,
181
+ # @returns [Integer]
182
+ :units,
183
+ # @returns [Date]
184
+ :date_completed,
185
+ # @returns [String]
186
+ :faculty
187
+ )
161
188
 
162
- }
163
- attr_reader(
164
- # @returns [String]
165
- :subject,
166
- # @returns [Integer]
167
- :number,
168
- # @returns [String]
169
- :name,
170
- # @returns [String]
171
- :grade,
172
- # @returns [Integer]
173
- :units,
174
- # @returns [Date]
175
- :date_completed,
176
- # @returns [String]
177
- :faculty
178
- )
189
+ def self.from_hash(hash)
190
+ begin
191
+ new(
192
+ hash['subject'],
193
+ hash['number'],
194
+ hash['name'],
195
+ hash['grade'],
196
+ hash['units'],
197
+ hash['date_completed'],
198
+ hash['faculty']
199
+ )
200
+ rescue
201
+ new(
202
+ hash[:subject],
203
+ hash[:number],
204
+ hash[:name],
205
+ hash[:grade],
206
+ hash[:units],
207
+ hash[:date_completed],
208
+ hash[:faculty]
209
+ )
210
+ end
211
+ end
179
212
 
180
- def initialize(
181
- subject,
182
- number,
183
- name,
184
- grade,
185
- units,
186
- date_completed,
187
- faculty=nil
188
- )
189
- @subject = subject
190
- @number = number
191
- @name = name
192
- @grade = grade
193
- @units = units
194
- @date_completed = date_completed
213
+ def initialize(
214
+ subject_,
215
+ number_,
216
+ name_,
217
+ grade_,
218
+ units_,
219
+ date_completed_,
220
+ faculty_=nil
221
+ )
222
+ @subject = subject_
223
+ @number = number_
224
+ @name = name_
225
+ @grade = Grade.new(grade_ || "N/A")
226
+ @units = units_
227
+ @date_completed = date_completed_
195
228
 
196
- # @todo This is totally wrong, but I'm not using this right now so I'm not in a rush to fix it.
197
- @faculty = if faculty.nil?
198
- UNIVERSITY_OF_ALBERTA_SUBJECT_HIERARCHY[@subject]
199
- else
200
- faculty
229
+ # @todo This is totally wrong, but I'm not using this right now so I'm not in a rush to fix it.
230
+ @faculty = if faculty_.nil?
231
+ UNIVERSITY_OF_ALBERTA_SUBJECT_HIERARCHY[@subject]
232
+ else
233
+ faculty_
234
+ end
201
235
  end
202
- end
203
236
 
204
- def grade_points
205
- return nil if @grade.nil?
206
-
207
- @units * @grade.points
237
+ def grade_has_points?() @grade.has_points? end
238
+
239
+ def grade_points
240
+ @units * @grade.points
241
+ end
208
242
  end
209
- end
243
+ end
@@ -1,3 +1,3 @@
1
1
  module Gpa
2
- VERSION = "0.1.1"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -18,30 +18,30 @@ ExpectedCourse = Struct.new(
18
18
  # @returns [String]
19
19
  :faculty,
20
20
  # @returns [Numeric]
21
- :grade_points
21
+ :grade_points
22
22
  )
23
- # TODO
24
- describe Course do
23
+ describe Gpa::Course do
25
24
  it "should initialize properly" do
26
25
  @expected_course = ExpectedCourse.new(
27
- :subject => "WRS",
28
- :number => 101,
29
- :name => "Exploring Writing",
30
- :grade => "B",
31
- :units => 27,
32
- :date_completed => Date.parse('2008-12-01'),
33
- :faculty => 'Arts',
34
- :grade_points => 9.0
26
+ "WRS",
27
+ 123,
28
+ "C4 Name",
29
+ "B",
30
+ 2,
31
+ Date.parse('2008-12-01'),
32
+ 'Arts',
33
+ 6.0
35
34
  )
36
- @patient = Course.new(
37
- @expected_course.subject,
35
+ @patient = Gpa::Course.new(
36
+ @expected_course.subject,
38
37
  @expected_course.number,
39
38
  @expected_course.name,
40
39
  @expected_course.grade,
41
40
  @expected_course.units,
42
- @expected_course.date_completed
41
+ @expected_course.date_completed,
42
+ @expected_course.faculty
43
43
  )
44
-
44
+
45
45
  check_patient
46
46
  end
47
47
 
@@ -3,23 +3,26 @@ require_relative 'support/spec_helper'
3
3
 
4
4
  require_relative '../lib/gpa'
5
5
 
6
- require 'dmorrill10-utils/object'
7
-
8
- describe Gpa do
6
+ describe Gpa::CourseArray do
9
7
  it "should load courses from a YAML file properly" do
10
- Gpa.load_courses_from_file(TEST_COURSES_FILE).map do |course|
11
- course.to_h
12
- end.must_equal EXPECTED_COURSES_IN_HASH_FORM_FROM_COURSES_FILE
8
+ Gpa::CourseArray.load_courses_from_file(TEST_COURSES_FILE).each_with_index do |course, i|
9
+ {
10
+ subject: course.subject,
11
+ number: course.number,
12
+ name: course.name,
13
+ grade: course.grade,
14
+ units: course.units,
15
+ date_completed: course.date_completed
16
+ }.must_equal EXPECTED_COURSES_IN_HASH_FORM_FROM_COURSES_FILE[i]
17
+ end
13
18
  end
14
- end
15
19
 
16
- describe Array do
17
20
  describe 'should calculate the gpa of all courses inside itself' do
18
21
  it "for all courses" do
19
- Gpa.load_courses_from_file(TEST_COURSES_FILE).gpa.must_equal 362/99.to_r
22
+ Gpa::CourseArray.load_courses_from_file(TEST_COURSES_FILE).gpa.must_equal 3.669696969696969
20
23
  end
21
24
  it "for a specified number of most recent courses" do
22
- Gpa.load_courses_from_file(TEST_COURSES_FILE).gpa(60).must_equal 3.95
25
+ Gpa::CourseArray.load_courses_from_file(TEST_COURSES_FILE).gpa(60).must_equal 3.9550000000000014
23
26
  end
24
27
  end
25
28
  end
@@ -1,200 +1,184 @@
1
- # First year
2
- ## Fall
3
- --- !ruby/object:Course
4
- subject: WRS
5
- number: 101
6
- name: Exploring Writing
1
+ ---
2
+ subject: BIOL
3
+ number: 659
4
+ name: BIOL Course name
7
5
  grade: B
8
6
  units: 27
9
7
  date_completed: 2008-12-1
10
- ## Winter
11
- --- !ruby/object:Course
12
- subject: SCI
13
- number: 100
14
- name: Integrated Science
8
+ ---
9
+ subject: PHYS
10
+ number: 222
11
+ name: Course name
15
12
  grade: A-
16
13
  units: 3
17
- date_completed: 2009-4-1
18
- # Second year
19
- ## Fall
20
- --- !ruby/object:Course
21
- subject: CMPUT
14
+ date_completed: 2009-9-1
15
+ ---
16
+ subject: ECON
22
17
  number: 175
23
- name: Intro to Foundations of Computing II
18
+ name: Course name
24
19
  grade: A+
25
20
  units: 3
26
21
  date_completed: 2009-12-1
27
- --- !ruby/object:Course
28
- subject: CMPUT
22
+ ---
23
+ subject: ECON
29
24
  number: 272
30
- name: Formal Systems and Logic
25
+ name: Course name
31
26
  grade: A+
32
27
  units: 3
33
28
  date_completed: 2009-12-1
34
- --- !ruby/object:Course
29
+ ---
35
30
  subject: DRAMA
36
- number: 247
37
- name: Intro to Oral Communication
31
+ number: 297
32
+ name: Course name
38
33
  grade: B+
39
34
  units: 3
40
35
  date_completed: 2009-12-1
41
- --- !ruby/object:Course
36
+ ---
42
37
  subject: MATH
43
38
  number: 120
44
- name: Basic Linear Algebra I
39
+ name: Course name
45
40
  grade: A
46
41
  units: 3
47
42
  date_completed: 2009-12-1
48
- ## Winter
49
- --- !ruby/object:Course
50
- subject: CMPUT
43
+ ---
44
+ subject: ECON
51
45
  number: 201
52
- name: Practical Programming Methodology
46
+ name: Course name
53
47
  grade: A+
54
48
  units: 3
55
- date_completed: 2010-4-1
56
- --- !ruby/object:Course
57
- subject: CMPUT
58
- number: 204
59
- name: Algorithms I
49
+ date_completed: 2010-9-1
50
+ ---
51
+ subject: ECON
52
+ number: 209
53
+ name: Course name
60
54
  grade: A+
61
55
  units: 3
62
- date_completed: 2010-4-1
63
- --- !ruby/object:Course
64
- subject: CMPUT
56
+ date_completed: 2010-9-1
57
+ ---
58
+ subject: ECON
65
59
  number: 229
66
- name: Computer Organization and Architecture I
60
+ name: Course name
67
61
  grade: A+
68
62
  units: 3
69
- date_completed: 2010-4-1
70
- --- !ruby/object:Course
63
+ date_completed: 2010-9-1
64
+ ---
71
65
  subject: ENGL
72
66
  number: 125
73
- name: Aboriginal Writing
67
+ name: Course name
74
68
  grade: A
75
69
  units: 3
76
- date_completed: 2010-4-1
77
- --- !ruby/object:Course
70
+ date_completed: 2010-9-1
71
+ ---
78
72
  subject: PHIL
79
73
  number: 215
80
- name: Epistemology
74
+ name: Course name
81
75
  grade: A
82
76
  units: 3
83
- date_completed: 2010-4-1
84
- ## Summer
85
- --- !ruby/object:Course
77
+ date_completed: 2010-9-1
78
+ ---
86
79
  subject: PHIL
87
80
  number: 265
88
- name: Philosophy of Science
81
+ name: Course name
89
82
  grade: A
90
83
  units: 3
91
84
  date_completed: 2010-8-1
92
- # Third year
93
- ## Fall
94
- --- !ruby/object:Course
95
- subject: CMPUT
85
+ ---
86
+ subject: ECON
96
87
  number: 325
97
- name: Non-procedural Programming Languages
88
+ name: Course name
98
89
  grade: A+
99
90
  units: 3
100
91
  date_completed: 2010-12-1
101
- --- !ruby/object:Course
102
- subject: CMPUT
92
+ ---
93
+ subject: ECON
103
94
  number: 366
104
- name: Intelligent Systems
95
+ name: Course name
105
96
  grade: A+
106
97
  units: 3
107
98
  date_completed: 2010-12-1
108
- --- !ruby/object:Course
99
+ ---
109
100
  subject: MATH
110
- number: 214
111
- name: Intermediate Calculus I
101
+ number: 219
102
+ name: Course name
112
103
  grade: A-
113
104
  units: 3
114
105
  date_completed: 2010-12-1
115
- --- !ruby/object:Course
106
+ ---
116
107
  subject: MATH
117
108
  number: 225
118
- name: Linear Algebra II
109
+ name: Course name
119
110
  grade: A-
120
111
  units: 3
121
112
  date_completed: 2010-12-1
122
- --- !ruby/object:Course
113
+ ---
123
114
  subject: STAT
124
115
  number: 265
125
- name: Statistics I
116
+ name: Course name
126
117
  grade: A
127
118
  units: 3
128
119
  date_completed: 2010-12-1
129
- ## Winter
130
- --- !ruby/object:Course
131
- subject: CMPUT
120
+ ---
121
+ subject: ECON
132
122
  number: 379
133
- name: Operating System Concepts
123
+ name: Course name
134
124
  grade: A-
135
125
  units: 3
136
- date_completed: 2011-4-1
137
- --- !ruby/object:Course
138
- subject: CMPUT
126
+ date_completed: 2011-9-1
127
+ ---
128
+ subject: ECON
139
129
  number: 396
140
- name: 'Topics in Computing Science: Design and Development of Mobile Search and Navigation Application'
130
+ name: Course name
141
131
  grade: A
142
132
  units: 3
143
- date_completed: 2011-4-1
144
- --- !ruby/object:Course
145
- subject: CMPUT
146
- number: 412
147
- name: Experimental mobile robotics
133
+ date_completed: 2011-9-1
134
+ ---
135
+ subject: ECON
136
+ number: 912
137
+ name: Course name
148
138
  grade: A+
149
139
  units: 3
150
- date_completed: 2011-4-1
151
- --- !ruby/object:Course
140
+ date_completed: 2011-9-1
141
+ ---
152
142
  subject: STAT
153
143
  number: 266
154
- name: Statistics II
144
+ name: Course name
155
145
  grade: A+
156
146
  units: 3
157
- date_completed: 2011-4-1
158
- ## Summer
159
- --- !ruby/object:Course
160
- subject: CMPUT
147
+ date_completed: 2011-9-1
148
+ ---
149
+ subject: ECON
161
150
  number: 399
162
- name: 'Topics in Computing Science: Object-Oriented Programming for Web Applications'
151
+ name: Course name
163
152
  grade: A+
164
153
  units: 3
165
154
  date_completed: 2011-8-1
166
- # Fourth year
167
- ## Fall
168
- --- !ruby/object:Course
169
- subject: CMPUT
170
- number: 400
171
- name: Industrial Internship Practicum
155
+ ---
156
+ subject: ECON
157
+ number: 900
158
+ name: Course name
172
159
  grade: ~
173
160
  units: 3
174
161
  date_completed: 2012-12-1
175
- --- !ruby/object:Course
176
- subject: CMPUT
177
- number: 418
178
- name: Numerical Methods I
162
+ ---
163
+ subject: ECON
164
+ number: 918
165
+ name: Course name
179
166
  grade: A
180
167
  units: 3
181
168
  date_completed: 2012-12-1
182
- --- !ruby/object:Course
183
- subject: CMPUT
184
- number: 466
185
- name: Machine Learning
169
+ ---
170
+ subject: ECON
171
+ number: 695
172
+ name: Course name
186
173
  grade: A+
187
174
  units: 3
188
175
  date_completed: 2012-12-1
189
- --- !ruby/object:Course
176
+ ---
190
177
  subject: STAT
191
- number: 371
192
- name: Probability and Stochastic Processes
178
+ number: 699
179
+ name: Course name
193
180
  grade: A
194
181
  units: 3
195
182
  date_completed: 2012-12-1
196
183
 
197
- ## Winter
198
184
 
199
- # Fifth year
200
- ## Fall
@@ -7,41 +7,41 @@ require 'minitest/autorun'
7
7
  TEST_COURSES_FILE = File.expand_path('../courses.yml', __FILE__)
8
8
  EXPECTED_COURSES_IN_HASH_FORM_FROM_COURSES_FILE = [
9
9
  {
10
- :subject => "WRS",
11
- :number => 101,
12
- :name => "Exploring Writing",
10
+ :subject => "BIOL",
11
+ :number => 659,
12
+ :name => "BIOL Course name",
13
13
  :grade => "B",
14
14
  :units => 27,
15
15
  :date_completed => Date.parse('2008-12-01')
16
16
  },
17
17
  {
18
- :subject => "SCI",
19
- :number => 100,
20
- :name => "Integrated Science",
18
+ :subject => "PHYS",
19
+ :number => 222,
20
+ :name => "Course name",
21
21
  :grade => "A-",
22
22
  :units => 3,
23
- :date_completed => Date.parse('2009-04-01')
23
+ :date_completed => Date.parse('2009-09-01')
24
24
  },
25
25
  {
26
- :subject => "CMPUT",
26
+ :subject => "ECON",
27
27
  :number => 175,
28
- :name => "Intro to Foundations of Computing II",
28
+ :name => "Course name",
29
29
  :grade => "A+",
30
30
  :units => 3,
31
31
  :date_completed => Date.parse('2009-12-01')
32
32
  },
33
33
  {
34
- :subject => "CMPUT",
34
+ :subject => "ECON",
35
35
  :number => 272,
36
- :name => "Formal Systems and Logic",
36
+ :name => "Course name",
37
37
  :grade => "A+",
38
38
  :units => 3,
39
39
  :date_completed => Date.parse('2009-12-01')
40
40
  },
41
41
  {
42
42
  :subject => "DRAMA",
43
- :number => 247,
44
- :name => "Intro to Oral Communication",
43
+ :number => 297,
44
+ :name => "Course name",
45
45
  :grade => "B+",
46
46
  :units => 3,
47
47
  :date_completed => Date.parse('2009-12-01')
@@ -49,79 +49,79 @@ EXPECTED_COURSES_IN_HASH_FORM_FROM_COURSES_FILE = [
49
49
  {
50
50
  :subject => "MATH",
51
51
  :number => 120,
52
- :name => "Basic Linear Algebra I",
52
+ :name => "Course name",
53
53
  :grade => "A",
54
54
  :units => 3,
55
55
  :date_completed => Date.parse('2009-12-01')
56
56
  },
57
57
  {
58
- :subject => "CMPUT",
58
+ :subject => "ECON",
59
59
  :number => 201,
60
- :name => "Practical Programming Methodology",
60
+ :name => "Course name",
61
61
  :grade => "A+",
62
62
  :units => 3,
63
- :date_completed => Date.parse('2010-04-01')
63
+ :date_completed => Date.parse('2010-09-01')
64
64
  },
65
65
  {
66
- :subject => "CMPUT",
67
- :number => 204,
68
- :name => "Algorithms I",
66
+ :subject => "ECON",
67
+ :number => 209,
68
+ :name => "Course name",
69
69
  :grade => "A+",
70
70
  :units => 3,
71
- :date_completed => Date.parse('2010-04-01')
71
+ :date_completed => Date.parse('2010-09-01')
72
72
  },
73
73
  {
74
- :subject => "CMPUT",
74
+ :subject => "ECON",
75
75
  :number => 229,
76
- :name => "Computer Organization and Architecture I",
76
+ :name => "Course name",
77
77
  :grade => "A+",
78
78
  :units => 3,
79
- :date_completed => Date.parse('2010-04-01')
79
+ :date_completed => Date.parse('2010-09-01')
80
80
  },
81
81
  {
82
82
  :subject => "ENGL",
83
83
  :number => 125,
84
- :name => "Aboriginal Writing",
84
+ :name => "Course name",
85
85
  :grade => "A",
86
86
  :units => 3,
87
- :date_completed => Date.parse('2010-04-01')
87
+ :date_completed => Date.parse('2010-09-01')
88
88
  },
89
89
  {
90
90
  :subject => "PHIL",
91
91
  :number => 215,
92
- :name => "Epistemology",
92
+ :name => "Course name",
93
93
  :grade => "A",
94
94
  :units => 3,
95
- :date_completed => Date.parse('2010-04-01')
95
+ :date_completed => Date.parse('2010-09-01')
96
96
  },
97
97
  {
98
98
  :subject => "PHIL",
99
99
  :number => 265,
100
- :name => "Philosophy of Science",
100
+ :name => "Course name",
101
101
  :grade => "A",
102
102
  :units => 3,
103
103
  :date_completed => Date.parse('2010-08-01')
104
104
  },
105
105
  {
106
- :subject => "CMPUT",
106
+ :subject => "ECON",
107
107
  :number => 325,
108
- :name => "Non-procedural Programming Languages",
108
+ :name => "Course name",
109
109
  :grade => "A+",
110
110
  :units => 3,
111
111
  :date_completed => Date.parse('2010-12-01')
112
112
  },
113
113
  {
114
- :subject => "CMPUT",
114
+ :subject => "ECON",
115
115
  :number => 366,
116
- :name => "Intelligent Systems",
116
+ :name => "Course name",
117
117
  :grade => "A+",
118
118
  :units => 3,
119
119
  :date_completed => Date.parse('2010-12-01')
120
120
  },
121
121
  {
122
122
  :subject => "MATH",
123
- :number => 214,
124
- :name => "Intermediate Calculus I",
123
+ :number => 219,
124
+ :name => "Course name",
125
125
  :grade => "A-",
126
126
  :units => 3,
127
127
  :date_completed => Date.parse('2010-12-01')
@@ -129,7 +129,7 @@ EXPECTED_COURSES_IN_HASH_FORM_FROM_COURSES_FILE = [
129
129
  {
130
130
  :subject => "MATH",
131
131
  :number => 225,
132
- :name => "Linear Algebra II",
132
+ :name => "Course name",
133
133
  :grade => "A-",
134
134
  :units => 3,
135
135
  :date_completed => Date.parse('2010-12-01')
@@ -137,79 +137,79 @@ EXPECTED_COURSES_IN_HASH_FORM_FROM_COURSES_FILE = [
137
137
  {
138
138
  :subject => "STAT",
139
139
  :number => 265,
140
- :name => "Statistics I",
140
+ :name => "Course name",
141
141
  :grade => "A",
142
142
  :units => 3,
143
143
  :date_completed => Date.parse('2010-12-01')
144
144
  },
145
145
  {
146
- :subject => "CMPUT",
146
+ :subject => "ECON",
147
147
  :number => 379,
148
- :name => "Operating System Concepts",
148
+ :name => "Course name",
149
149
  :grade => "A-",
150
150
  :units => 3,
151
- :date_completed => Date.parse('2011-04-01')
151
+ :date_completed => Date.parse('2011-09-01')
152
152
  },
153
153
  {
154
- :subject => "CMPUT",
154
+ :subject => "ECON",
155
155
  :number => 396,
156
- :name => "Topics in Computing Science: Design and Development of Mobile Search and Navigation Application",
156
+ :name => "Course name",
157
157
  :grade => "A",
158
158
  :units => 3,
159
- :date_completed => Date.parse('2011-04-01')
159
+ :date_completed => Date.parse('2011-09-01')
160
160
  },
161
161
  {
162
- :subject => "CMPUT",
163
- :number => 412,
164
- :name => "Experimental mobile robotics",
162
+ :subject => "ECON",
163
+ :number => 912,
164
+ :name => "Course name",
165
165
  :grade => "A+",
166
166
  :units => 3,
167
- :date_completed => Date.parse('2011-04-01')
167
+ :date_completed => Date.parse('2011-09-01')
168
168
  },
169
169
  {
170
170
  :subject => "STAT",
171
171
  :number => 266,
172
- :name => "Statistics II",
172
+ :name => "Course name",
173
173
  :grade => "A+",
174
174
  :units => 3,
175
- :date_completed => Date.parse('2011-04-01')
175
+ :date_completed => Date.parse('2011-09-01')
176
176
  },
177
177
  {
178
- :subject => "CMPUT",
178
+ :subject => "ECON",
179
179
  :number => 399,
180
- :name => "Topics in Computing Science: Object-Oriented Programming for Web Applications",
180
+ :name => "Course name",
181
181
  :grade => "A+",
182
182
  :units => 3,
183
183
  :date_completed => Date.parse('2011-08-01')
184
184
  },
185
185
  {
186
- :subject => "CMPUT",
187
- :number => 400,
188
- :name => "Industrial Internship Practicum",
189
- :grade => nil,
186
+ :subject => "ECON",
187
+ :number => 900,
188
+ :name => "Course name",
189
+ :grade => "N/A",
190
190
  :units => 3,
191
191
  :date_completed => Date.parse('2012-12-01')
192
192
  },
193
193
  {
194
- :subject => "CMPUT",
195
- :number => 418,
196
- :name => "Numerical Methods I",
194
+ :subject => "ECON",
195
+ :number => 918,
196
+ :name => "Course name",
197
197
  :grade => "A",
198
198
  :units => 3,
199
199
  :date_completed => Date.parse('2012-12-01')
200
200
  },
201
201
  {
202
- :subject => "CMPUT",
203
- :number => 466,
204
- :name => "Machine Learning",
202
+ :subject => "ECON",
203
+ :number => 695,
204
+ :name => "Course name",
205
205
  :grade => "A+",
206
206
  :units => 3,
207
207
  :date_completed => Date.parse('2012-12-01')
208
208
  },
209
209
  {
210
210
  :subject => "STAT",
211
- :number => 371,
212
- :name => "Probability and Stochastic Processes",
211
+ :number => 699,
212
+ :name => "Course name",
213
213
  :grade => "A",
214
214
  :units => 3,
215
215
  :date_completed => Date.parse('2012-12-01')
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gpa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Morrill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-28 00:00:00.000000000 Z
11
+ date: 2015-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: dmorrill10-utils
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ~>
18
- - !ruby/object:Gem::Version
19
- version: 2.0.0
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ~>
25
- - !ruby/object:Gem::Version
26
- version: 2.0.0
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: simplecov
29
15
  requirement: !ruby/object:Gem::Requirement