gpa 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +31 -0
- data/Rakefile +12 -0
- data/gpa.gemspec +23 -0
- data/lib/gpa.rb +56 -0
- data/lib/gpa/course.rb +216 -0
- data/lib/gpa/version.rb +3 -0
- data/spec/course_spec.rb +58 -0
- data/spec/gpa_spec.rb +23 -0
- data/spec/support/courses.yml +200 -0
- data/spec/support/spec_helper.rb +234 -0
- metadata +126 -0
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Dustin Morrill
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Gpa
|
2
|
+
|
3
|
+
Academic course data manipulation and GPA calculation module.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'gpa'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install gpa
|
18
|
+
|
19
|
+
## Contributing
|
20
|
+
|
21
|
+
1. Fork it
|
22
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
23
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
24
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
25
|
+
5. Create new Pull Request
|
26
|
+
|
27
|
+
## Versioning
|
28
|
+
The version number will change according to the following scheme:
|
29
|
+
- The major number will be incremented on non-backwards compatible updates.
|
30
|
+
- The minor number will be incremented on backwards compatible strict API extensions.
|
31
|
+
- The patch number will be incremented on backwards compatible changes that do not effect the API.
|
data/Rakefile
ADDED
data/gpa.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/gpa/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Dustin Morrill"]
|
6
|
+
gem.email = ["dmorrill10@gmail.com"]
|
7
|
+
gem.description = %q{Academic course data manipulation and GPA calculation module}
|
8
|
+
gem.summary = %q{Academic course data manipulation and GPA calculation module}
|
9
|
+
gem.homepage = "https://github.com/dmorrill10/GPA"
|
10
|
+
|
11
|
+
gem.add_dependency 'dmorrill10-utils'
|
12
|
+
|
13
|
+
gem.add_development_dependency 'simplecov'
|
14
|
+
gem.add_development_dependency 'turn'
|
15
|
+
gem.add_development_dependency 'minitest'
|
16
|
+
|
17
|
+
gem.files = `git ls-files`.split($\)
|
18
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
19
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
20
|
+
gem.name = "gpa"
|
21
|
+
gem.require_paths = ["lib"]
|
22
|
+
gem.version = Gpa::VERSION
|
23
|
+
end
|
data/lib/gpa.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require "gpa/version"
|
2
|
+
require "gpa/course"
|
3
|
+
|
4
|
+
require 'dmorrill10-utils/enumerable'
|
5
|
+
require 'yaml'
|
6
|
+
|
7
|
+
module YAML
|
8
|
+
# Load the document contained in +filename+. Returns the yaml contained in
|
9
|
+
# +filename+ as a ruby object
|
10
|
+
def self.load_stream_from_file filename
|
11
|
+
File.open(filename, 'r:bom|utf-8') { |f| self.load_stream f, filename }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Array
|
16
|
+
# @param [Integer] num_most_recent_units
|
17
|
+
# @returns [Numeric] The GPA calculated with +num_most_recent_units+ most recent units completed.
|
18
|
+
def gpa(num_most_recent_units=units_completed)
|
19
|
+
courses = reject do |course|
|
20
|
+
!course.respond_to?(:grade_points) || course.grade_points.nil?
|
21
|
+
end.sort_courses_by_date_completed.inject([]) do |accum_array, course|
|
22
|
+
accum_array << course
|
23
|
+
break accum_array if accum_array.units_completed >= num_most_recent_units
|
24
|
+
accum_array
|
25
|
+
end
|
26
|
+
|
27
|
+
courses.map { |course| course.grade_points }.sum / courses.units_completed.to_f
|
28
|
+
end
|
29
|
+
|
30
|
+
def units_completed
|
31
|
+
completed_courses.map do |course|
|
32
|
+
course.units
|
33
|
+
end.sum
|
34
|
+
end
|
35
|
+
|
36
|
+
def sort_courses_by_date_completed
|
37
|
+
completed_courses.sort do |c1, c2|
|
38
|
+
c2.date_completed <=> c1.date_completed
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
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
|
+
end
|
51
|
+
|
52
|
+
module Gpa
|
53
|
+
def self.load_courses_from_file(yaml_file_path)
|
54
|
+
YAML.load_stream_from_file(yaml_file_path)
|
55
|
+
end
|
56
|
+
end
|
data/lib/gpa/course.rb
ADDED
@@ -0,0 +1,216 @@
|
|
1
|
+
# @todo Move to utils
|
2
|
+
class Object
|
3
|
+
def to_h
|
4
|
+
Hash[instance_variables.map do |var|
|
5
|
+
[var[1..-1].to_sym, instance_variable_get(var)]
|
6
|
+
end]
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class String
|
11
|
+
# @returns [Numeric] Number of grade points for this grade
|
12
|
+
def points
|
13
|
+
Course::UNIVERSITY_OF_ALBERTA_GRADE_TO_POINTS[self]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class Course
|
18
|
+
# @return [Hash<String, Numeric>] University of Alberta grade to grade points hash.
|
19
|
+
UNIVERSITY_OF_ALBERTA_GRADE_TO_POINTS = {
|
20
|
+
'A+' => 4.0,
|
21
|
+
'A' => 4.0,
|
22
|
+
'A-' => 3.7,
|
23
|
+
'B+' => 3.3,
|
24
|
+
'B' => 3.0,
|
25
|
+
'B-' => 2.7,
|
26
|
+
'C+' => 2.3,
|
27
|
+
'C' => 2.0,
|
28
|
+
'C-' => 1.7,
|
29
|
+
'D+' => 1.3,
|
30
|
+
'D' => 1.0,
|
31
|
+
'F' => 0.0
|
32
|
+
}
|
33
|
+
|
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
|
+
]
|
170
|
+
|
171
|
+
}
|
172
|
+
attr_reader(
|
173
|
+
# @returns [String]
|
174
|
+
:subject,
|
175
|
+
# @returns [Integer]
|
176
|
+
:number,
|
177
|
+
# @returns [String]
|
178
|
+
:name,
|
179
|
+
# @returns [String]
|
180
|
+
:grade,
|
181
|
+
# @returns [Integer]
|
182
|
+
:units,
|
183
|
+
# @returns [Date]
|
184
|
+
:date_completed,
|
185
|
+
# @returns [String]
|
186
|
+
:faculty
|
187
|
+
)
|
188
|
+
# @todo thing-to-do
|
189
|
+
def initialize(
|
190
|
+
subject,
|
191
|
+
number,
|
192
|
+
name,
|
193
|
+
grade,
|
194
|
+
units,
|
195
|
+
date_completed,
|
196
|
+
faculty=nil
|
197
|
+
)
|
198
|
+
@subject = subject
|
199
|
+
@number = number
|
200
|
+
@name = name
|
201
|
+
@grade = grade
|
202
|
+
@units = units
|
203
|
+
@date_completed = date_completed
|
204
|
+
@faculty = if faculty.nil?
|
205
|
+
UNIVERSITY_OF_ALBERTA_SUBJECT_HIERARCHY[@subject]
|
206
|
+
else
|
207
|
+
faculty
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
def grade_points
|
212
|
+
return nil if @grade.nil?
|
213
|
+
|
214
|
+
@units * @grade.points
|
215
|
+
end
|
216
|
+
end
|
data/lib/gpa/version.rb
ADDED
data/spec/course_spec.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# Spec helper (must include first to track code coverage with SimpleCov)
|
2
|
+
require_relative 'support/spec_helper'
|
3
|
+
|
4
|
+
require_relative '../lib/gpa/course'
|
5
|
+
|
6
|
+
ExpectedCourse = Struct.new(
|
7
|
+
:subject,
|
8
|
+
# @returns [Integer]
|
9
|
+
:number,
|
10
|
+
# @returns [String]
|
11
|
+
:name,
|
12
|
+
# @returns [String]
|
13
|
+
:grade,
|
14
|
+
# @returns [Integer]
|
15
|
+
:units,
|
16
|
+
# @returns [Date]
|
17
|
+
:date_completed,
|
18
|
+
# @returns [String]
|
19
|
+
:faculty,
|
20
|
+
# @returns [Numeric]
|
21
|
+
:grade_points
|
22
|
+
)
|
23
|
+
|
24
|
+
describe Course do
|
25
|
+
it "should initialize properly" do
|
26
|
+
@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
|
35
|
+
)
|
36
|
+
@patient = Course.new(
|
37
|
+
@expected_course.subject,
|
38
|
+
@expected_course.number,
|
39
|
+
@expected_course.name,
|
40
|
+
@expected_course.grade,
|
41
|
+
@expected_course.units,
|
42
|
+
@expected_course.date_completed
|
43
|
+
)
|
44
|
+
|
45
|
+
check_patient
|
46
|
+
end
|
47
|
+
|
48
|
+
def check_patient
|
49
|
+
@patient.subject.must_equal @expected_course.subject
|
50
|
+
@patient.number.must_equal @expected_course.number
|
51
|
+
@patient.name.must_equal @expected_course.name
|
52
|
+
@patient.grade.must_equal @expected_course.grade
|
53
|
+
@patient.units.must_equal @expected_course.units
|
54
|
+
@patient.date_completed.must_equal @expected_course.date_completed
|
55
|
+
@patient.faculty.must_equal @expected_course.faculty
|
56
|
+
@patient.grade_points.must_equal @expected_course.grade_points
|
57
|
+
end
|
58
|
+
end
|
data/spec/gpa_spec.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Spec helper (must include first to track code coverage with SimpleCov)
|
2
|
+
require_relative 'support/spec_helper'
|
3
|
+
|
4
|
+
require_relative '../lib/gpa'
|
5
|
+
|
6
|
+
describe Gpa do
|
7
|
+
it "should load courses from a YAML file properly" do
|
8
|
+
Gpa.load_courses_from_file(TEST_COURSES_FILE).map do |course|
|
9
|
+
course.to_h
|
10
|
+
end.must_equal EXPECTED_COURSES_IN_HASH_FORM_FROM_COURSES_FILE
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe Array do
|
15
|
+
describe 'should calculate the gpa of all courses inside itself' do
|
16
|
+
it "for all courses" do
|
17
|
+
Gpa.load_courses_from_file(TEST_COURSES_FILE).gpa.must_equal 362/99.to_r
|
18
|
+
end
|
19
|
+
it "for a specified number of most recent courses" do
|
20
|
+
Gpa.load_courses_from_file(TEST_COURSES_FILE).gpa(60).must_equal 3.95
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,200 @@
|
|
1
|
+
# First year
|
2
|
+
## Fall
|
3
|
+
--- !ruby/object:Course
|
4
|
+
subject: WRS
|
5
|
+
number: 101
|
6
|
+
name: Exploring Writing
|
7
|
+
grade: B
|
8
|
+
units: 27
|
9
|
+
date_completed: 2008-12-1
|
10
|
+
## Winter
|
11
|
+
--- !ruby/object:Course
|
12
|
+
subject: SCI
|
13
|
+
number: 100
|
14
|
+
name: Integrated Science
|
15
|
+
grade: A-
|
16
|
+
units: 3
|
17
|
+
date_completed: 2009-4-1
|
18
|
+
# Second year
|
19
|
+
## Fall
|
20
|
+
--- !ruby/object:Course
|
21
|
+
subject: CMPUT
|
22
|
+
number: 175
|
23
|
+
name: Intro to Foundations of Computing II
|
24
|
+
grade: A+
|
25
|
+
units: 3
|
26
|
+
date_completed: 2009-12-1
|
27
|
+
--- !ruby/object:Course
|
28
|
+
subject: CMPUT
|
29
|
+
number: 272
|
30
|
+
name: Formal Systems and Logic
|
31
|
+
grade: A+
|
32
|
+
units: 3
|
33
|
+
date_completed: 2009-12-1
|
34
|
+
--- !ruby/object:Course
|
35
|
+
subject: DRAMA
|
36
|
+
number: 247
|
37
|
+
name: Intro to Oral Communication
|
38
|
+
grade: B+
|
39
|
+
units: 3
|
40
|
+
date_completed: 2009-12-1
|
41
|
+
--- !ruby/object:Course
|
42
|
+
subject: MATH
|
43
|
+
number: 120
|
44
|
+
name: Basic Linear Algebra I
|
45
|
+
grade: A
|
46
|
+
units: 3
|
47
|
+
date_completed: 2009-12-1
|
48
|
+
## Winter
|
49
|
+
--- !ruby/object:Course
|
50
|
+
subject: CMPUT
|
51
|
+
number: 201
|
52
|
+
name: Practical Programming Methodology
|
53
|
+
grade: A+
|
54
|
+
units: 3
|
55
|
+
date_completed: 2010-4-1
|
56
|
+
--- !ruby/object:Course
|
57
|
+
subject: CMPUT
|
58
|
+
number: 204
|
59
|
+
name: Algorithms I
|
60
|
+
grade: A+
|
61
|
+
units: 3
|
62
|
+
date_completed: 2010-4-1
|
63
|
+
--- !ruby/object:Course
|
64
|
+
subject: CMPUT
|
65
|
+
number: 229
|
66
|
+
name: Computer Organization and Architecture I
|
67
|
+
grade: A+
|
68
|
+
units: 3
|
69
|
+
date_completed: 2010-4-1
|
70
|
+
--- !ruby/object:Course
|
71
|
+
subject: ENGL
|
72
|
+
number: 125
|
73
|
+
name: Aboriginal Writing
|
74
|
+
grade: A
|
75
|
+
units: 3
|
76
|
+
date_completed: 2010-4-1
|
77
|
+
--- !ruby/object:Course
|
78
|
+
subject: PHIL
|
79
|
+
number: 215
|
80
|
+
name: Epistemology
|
81
|
+
grade: A
|
82
|
+
units: 3
|
83
|
+
date_completed: 2010-4-1
|
84
|
+
## Summer
|
85
|
+
--- !ruby/object:Course
|
86
|
+
subject: PHIL
|
87
|
+
number: 265
|
88
|
+
name: Philosophy of Science
|
89
|
+
grade: A
|
90
|
+
units: 3
|
91
|
+
date_completed: 2010-8-1
|
92
|
+
# Third year
|
93
|
+
## Fall
|
94
|
+
--- !ruby/object:Course
|
95
|
+
subject: CMPUT
|
96
|
+
number: 325
|
97
|
+
name: Non-procedural Programming Languages
|
98
|
+
grade: A+
|
99
|
+
units: 3
|
100
|
+
date_completed: 2010-12-1
|
101
|
+
--- !ruby/object:Course
|
102
|
+
subject: CMPUT
|
103
|
+
number: 366
|
104
|
+
name: Intelligent Systems
|
105
|
+
grade: A+
|
106
|
+
units: 3
|
107
|
+
date_completed: 2010-12-1
|
108
|
+
--- !ruby/object:Course
|
109
|
+
subject: MATH
|
110
|
+
number: 214
|
111
|
+
name: Intermediate Calculus I
|
112
|
+
grade: A-
|
113
|
+
units: 3
|
114
|
+
date_completed: 2010-12-1
|
115
|
+
--- !ruby/object:Course
|
116
|
+
subject: MATH
|
117
|
+
number: 225
|
118
|
+
name: Linear Algebra II
|
119
|
+
grade: A-
|
120
|
+
units: 3
|
121
|
+
date_completed: 2010-12-1
|
122
|
+
--- !ruby/object:Course
|
123
|
+
subject: STAT
|
124
|
+
number: 265
|
125
|
+
name: Statistics I
|
126
|
+
grade: A
|
127
|
+
units: 3
|
128
|
+
date_completed: 2010-12-1
|
129
|
+
## Winter
|
130
|
+
--- !ruby/object:Course
|
131
|
+
subject: CMPUT
|
132
|
+
number: 379
|
133
|
+
name: Operating System Concepts
|
134
|
+
grade: A-
|
135
|
+
units: 3
|
136
|
+
date_completed: 2011-4-1
|
137
|
+
--- !ruby/object:Course
|
138
|
+
subject: CMPUT
|
139
|
+
number: 396
|
140
|
+
name: 'Topics in Computing Science: Design and Development of Mobile Search and Navigation Application'
|
141
|
+
grade: A
|
142
|
+
units: 3
|
143
|
+
date_completed: 2011-4-1
|
144
|
+
--- !ruby/object:Course
|
145
|
+
subject: CMPUT
|
146
|
+
number: 412
|
147
|
+
name: Experimental mobile robotics
|
148
|
+
grade: A+
|
149
|
+
units: 3
|
150
|
+
date_completed: 2011-4-1
|
151
|
+
--- !ruby/object:Course
|
152
|
+
subject: STAT
|
153
|
+
number: 266
|
154
|
+
name: Statistics II
|
155
|
+
grade: A+
|
156
|
+
units: 3
|
157
|
+
date_completed: 2011-4-1
|
158
|
+
## Summer
|
159
|
+
--- !ruby/object:Course
|
160
|
+
subject: CMPUT
|
161
|
+
number: 399
|
162
|
+
name: 'Topics in Computing Science: Object-Oriented Programming for Web Applications'
|
163
|
+
grade: A+
|
164
|
+
units: 3
|
165
|
+
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
|
172
|
+
grade: ~
|
173
|
+
units: 3
|
174
|
+
date_completed: 2012-12-1
|
175
|
+
--- !ruby/object:Course
|
176
|
+
subject: CMPUT
|
177
|
+
number: 418
|
178
|
+
name: Numerical Methods I
|
179
|
+
grade: A
|
180
|
+
units: 3
|
181
|
+
date_completed: 2012-12-1
|
182
|
+
--- !ruby/object:Course
|
183
|
+
subject: CMPUT
|
184
|
+
number: 466
|
185
|
+
name: Machine Learning
|
186
|
+
grade: A+
|
187
|
+
units: 3
|
188
|
+
date_completed: 2012-12-1
|
189
|
+
--- !ruby/object:Course
|
190
|
+
subject: STAT
|
191
|
+
number: 371
|
192
|
+
name: Probability and Stochastic Processes
|
193
|
+
grade: A
|
194
|
+
units: 3
|
195
|
+
date_completed: 2012-12-1
|
196
|
+
|
197
|
+
## Winter
|
198
|
+
|
199
|
+
# Fifth year
|
200
|
+
## Fall
|
@@ -0,0 +1,234 @@
|
|
1
|
+
|
2
|
+
require 'simplecov'
|
3
|
+
SimpleCov.start
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'turn/autorun'
|
7
|
+
|
8
|
+
Turn.config do |c|
|
9
|
+
# use one of output formats:
|
10
|
+
# :outline - turn's original case/test outline mode [default]
|
11
|
+
# :progress - indicates progress with progress bar
|
12
|
+
# :dotted - test/unit's traditional dot-progress mode
|
13
|
+
# :pretty - new pretty reporter
|
14
|
+
# :marshal - dump output as YAML (normal run mode only)
|
15
|
+
# :cue - interactive testing
|
16
|
+
# c.format = :pretty
|
17
|
+
c.format = :dotted
|
18
|
+
# use humanized test names (works only with :outline format)
|
19
|
+
c.natural = true
|
20
|
+
end
|
21
|
+
rescue LoadError
|
22
|
+
end
|
23
|
+
|
24
|
+
TEST_COURSES_FILE = File.expand_path('../courses.yml', __FILE__)
|
25
|
+
EXPECTED_COURSES_IN_HASH_FORM_FROM_COURSES_FILE = [
|
26
|
+
{
|
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
|
+
},
|
34
|
+
{
|
35
|
+
:subject => "SCI",
|
36
|
+
:number => 100,
|
37
|
+
:name => "Integrated Science",
|
38
|
+
:grade => "A-",
|
39
|
+
:units => 3,
|
40
|
+
:date_completed => Date.parse('2009-04-01')
|
41
|
+
},
|
42
|
+
{
|
43
|
+
:subject => "CMPUT",
|
44
|
+
:number => 175,
|
45
|
+
:name => "Intro to Foundations of Computing II",
|
46
|
+
:grade => "A+",
|
47
|
+
:units => 3,
|
48
|
+
:date_completed => Date.parse('2009-12-01')
|
49
|
+
},
|
50
|
+
{
|
51
|
+
:subject => "CMPUT",
|
52
|
+
:number => 272,
|
53
|
+
:name => "Formal Systems and Logic",
|
54
|
+
:grade => "A+",
|
55
|
+
:units => 3,
|
56
|
+
:date_completed => Date.parse('2009-12-01')
|
57
|
+
},
|
58
|
+
{
|
59
|
+
:subject => "DRAMA",
|
60
|
+
:number => 247,
|
61
|
+
:name => "Intro to Oral Communication",
|
62
|
+
:grade => "B+",
|
63
|
+
:units => 3,
|
64
|
+
:date_completed => Date.parse('2009-12-01')
|
65
|
+
},
|
66
|
+
{
|
67
|
+
:subject => "MATH",
|
68
|
+
:number => 120,
|
69
|
+
:name => "Basic Linear Algebra I",
|
70
|
+
:grade => "A",
|
71
|
+
:units => 3,
|
72
|
+
:date_completed => Date.parse('2009-12-01')
|
73
|
+
},
|
74
|
+
{
|
75
|
+
:subject => "CMPUT",
|
76
|
+
:number => 201,
|
77
|
+
:name => "Practical Programming Methodology",
|
78
|
+
:grade => "A+",
|
79
|
+
:units => 3,
|
80
|
+
:date_completed => Date.parse('2010-04-01')
|
81
|
+
},
|
82
|
+
{
|
83
|
+
:subject => "CMPUT",
|
84
|
+
:number => 204,
|
85
|
+
:name => "Algorithms I",
|
86
|
+
:grade => "A+",
|
87
|
+
:units => 3,
|
88
|
+
:date_completed => Date.parse('2010-04-01')
|
89
|
+
},
|
90
|
+
{
|
91
|
+
:subject => "CMPUT",
|
92
|
+
:number => 229,
|
93
|
+
:name => "Computer Organization and Architecture I",
|
94
|
+
:grade => "A+",
|
95
|
+
:units => 3,
|
96
|
+
:date_completed => Date.parse('2010-04-01')
|
97
|
+
},
|
98
|
+
{
|
99
|
+
:subject => "ENGL",
|
100
|
+
:number => 125,
|
101
|
+
:name => "Aboriginal Writing",
|
102
|
+
:grade => "A",
|
103
|
+
:units => 3,
|
104
|
+
:date_completed => Date.parse('2010-04-01')
|
105
|
+
},
|
106
|
+
{
|
107
|
+
:subject => "PHIL",
|
108
|
+
:number => 215,
|
109
|
+
:name => "Epistemology",
|
110
|
+
:grade => "A",
|
111
|
+
:units => 3,
|
112
|
+
:date_completed => Date.parse('2010-04-01')
|
113
|
+
},
|
114
|
+
{
|
115
|
+
:subject => "PHIL",
|
116
|
+
:number => 265,
|
117
|
+
:name => "Philosophy of Science",
|
118
|
+
:grade => "A",
|
119
|
+
:units => 3,
|
120
|
+
:date_completed => Date.parse('2010-08-01')
|
121
|
+
},
|
122
|
+
{
|
123
|
+
:subject => "CMPUT",
|
124
|
+
:number => 325,
|
125
|
+
:name => "Non-procedural Programming Languages",
|
126
|
+
:grade => "A+",
|
127
|
+
:units => 3,
|
128
|
+
:date_completed => Date.parse('2010-12-01')
|
129
|
+
},
|
130
|
+
{
|
131
|
+
:subject => "CMPUT",
|
132
|
+
:number => 366,
|
133
|
+
:name => "Intelligent Systems",
|
134
|
+
:grade => "A+",
|
135
|
+
:units => 3,
|
136
|
+
:date_completed => Date.parse('2010-12-01')
|
137
|
+
},
|
138
|
+
{
|
139
|
+
:subject => "MATH",
|
140
|
+
:number => 214,
|
141
|
+
:name => "Intermediate Calculus I",
|
142
|
+
:grade => "A-",
|
143
|
+
:units => 3,
|
144
|
+
:date_completed => Date.parse('2010-12-01')
|
145
|
+
},
|
146
|
+
{
|
147
|
+
:subject => "MATH",
|
148
|
+
:number => 225,
|
149
|
+
:name => "Linear Algebra II",
|
150
|
+
:grade => "A-",
|
151
|
+
:units => 3,
|
152
|
+
:date_completed => Date.parse('2010-12-01')
|
153
|
+
},
|
154
|
+
{
|
155
|
+
:subject => "STAT",
|
156
|
+
:number => 265,
|
157
|
+
:name => "Statistics I",
|
158
|
+
:grade => "A",
|
159
|
+
:units => 3,
|
160
|
+
:date_completed => Date.parse('2010-12-01')
|
161
|
+
},
|
162
|
+
{
|
163
|
+
:subject => "CMPUT",
|
164
|
+
:number => 379,
|
165
|
+
:name => "Operating System Concepts",
|
166
|
+
:grade => "A-",
|
167
|
+
:units => 3,
|
168
|
+
:date_completed => Date.parse('2011-04-01')
|
169
|
+
},
|
170
|
+
{
|
171
|
+
:subject => "CMPUT",
|
172
|
+
:number => 396,
|
173
|
+
:name => "Topics in Computing Science: Design and Development of Mobile Search and Navigation Application",
|
174
|
+
:grade => "A",
|
175
|
+
:units => 3,
|
176
|
+
:date_completed => Date.parse('2011-04-01')
|
177
|
+
},
|
178
|
+
{
|
179
|
+
:subject => "CMPUT",
|
180
|
+
:number => 412,
|
181
|
+
:name => "Experimental mobile robotics",
|
182
|
+
:grade => "A+",
|
183
|
+
:units => 3,
|
184
|
+
:date_completed => Date.parse('2011-04-01')
|
185
|
+
},
|
186
|
+
{
|
187
|
+
:subject => "STAT",
|
188
|
+
:number => 266,
|
189
|
+
:name => "Statistics II",
|
190
|
+
:grade => "A+",
|
191
|
+
:units => 3,
|
192
|
+
:date_completed => Date.parse('2011-04-01')
|
193
|
+
},
|
194
|
+
{
|
195
|
+
:subject => "CMPUT",
|
196
|
+
:number => 399,
|
197
|
+
:name => "Topics in Computing Science: Object-Oriented Programming for Web Applications",
|
198
|
+
:grade => "A+",
|
199
|
+
:units => 3,
|
200
|
+
:date_completed => Date.parse('2011-08-01')
|
201
|
+
},
|
202
|
+
{
|
203
|
+
:subject => "CMPUT",
|
204
|
+
:number => 400,
|
205
|
+
:name => "Industrial Internship Practicum",
|
206
|
+
:grade => nil,
|
207
|
+
:units => 3,
|
208
|
+
:date_completed => Date.parse('2012-12-01')
|
209
|
+
},
|
210
|
+
{
|
211
|
+
:subject => "CMPUT",
|
212
|
+
:number => 418,
|
213
|
+
:name => "Numerical Methods I",
|
214
|
+
:grade => "A",
|
215
|
+
:units => 3,
|
216
|
+
:date_completed => Date.parse('2012-12-01')
|
217
|
+
},
|
218
|
+
{
|
219
|
+
:subject => "CMPUT",
|
220
|
+
:number => 466,
|
221
|
+
:name => "Machine Learning",
|
222
|
+
:grade => "A+",
|
223
|
+
:units => 3,
|
224
|
+
:date_completed => Date.parse('2012-12-01')
|
225
|
+
},
|
226
|
+
{
|
227
|
+
:subject => "STAT",
|
228
|
+
:number => 371,
|
229
|
+
:name => "Probability and Stochastic Processes",
|
230
|
+
:grade => "A",
|
231
|
+
:units => 3,
|
232
|
+
:date_completed => Date.parse('2012-12-01')
|
233
|
+
}
|
234
|
+
]
|
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gpa
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Dustin Morrill
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: dmorrill10-utils
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: simplecov
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: turn
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: minitest
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
description: Academic course data manipulation and GPA calculation module
|
79
|
+
email:
|
80
|
+
- dmorrill10@gmail.com
|
81
|
+
executables: []
|
82
|
+
extensions: []
|
83
|
+
extra_rdoc_files: []
|
84
|
+
files:
|
85
|
+
- Gemfile
|
86
|
+
- LICENSE
|
87
|
+
- README.md
|
88
|
+
- Rakefile
|
89
|
+
- gpa.gemspec
|
90
|
+
- lib/gpa.rb
|
91
|
+
- lib/gpa/course.rb
|
92
|
+
- lib/gpa/version.rb
|
93
|
+
- spec/course_spec.rb
|
94
|
+
- spec/gpa_spec.rb
|
95
|
+
- spec/support/courses.yml
|
96
|
+
- spec/support/spec_helper.rb
|
97
|
+
homepage: https://github.com/dmorrill10/GPA
|
98
|
+
licenses: []
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
105
|
+
requirements:
|
106
|
+
- - ! '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ! '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
requirements: []
|
116
|
+
rubyforge_project:
|
117
|
+
rubygems_version: 1.8.24
|
118
|
+
signing_key:
|
119
|
+
specification_version: 3
|
120
|
+
summary: Academic course data manipulation and GPA calculation module
|
121
|
+
test_files:
|
122
|
+
- spec/course_spec.rb
|
123
|
+
- spec/gpa_spec.rb
|
124
|
+
- spec/support/courses.yml
|
125
|
+
- spec/support/spec_helper.rb
|
126
|
+
has_rdoc:
|