Created
March 29, 2016 16:51
-
-
Save mindplace/5ea54b21728f1eaf49b5c91204f330e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Student < LocalCohort | |
attr_reader :student_name, :email, :history, :local_cohort | |
def initialize(student_name, email, local_cohort) | |
@student_name, @email, @local_cohort = student_name, email, local_cohort | |
@history = [] | |
end | |
def grade | |
events = history.select{|event| event[1].is_a?(Fixnum)} | |
return "No grades yet" if events.empty? | |
events.map{|set| set[1]}.inject(:+) / events.length | |
end | |
def add_history(event) | |
@history << event | |
end | |
def local_cohort_name | |
local_cohort.city | |
end | |
def global_cohort_name | |
local_cohort.global_cohort_name | |
end | |
def currently_in_phase | |
local_cohort.global_cohort.currently_in_phase | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment