Module: Jekyll::DegreePlans

Defined in:
jekyll/_plugins/degree-plans.rb

Instance Method Summary collapse

Instance Method Details

#arrayOfCompletedPlans(student) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'jekyll/_plugins/degree-plans.rb', line 50

def arrayOfCompletedPlans(student)
   # return the plans from which the student has graduated
   plan_array = Array.new
   student['academic_plans'].each do |plan_code,plan|
   
       # Jekyll.logger.warn "arrayOfCompletedPlans key: #{plan_code}"

       if (plan['outcome'] == 'graduated')
           plan_array.push(plan_code)
       end
   end
   return plan_array
end

#arrayOfCurrentPlans(student) ⇒ Object




29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'jekyll/_plugins/degree-plans.rb', line 29

def arrayOfCurrentPlans(student)
     # return the current plans of the student as an array
     # may be a single element array if only 1 plan

     #if (student['last_term'] != nil)
     #      return []
     #end
     if (student['academic_plan_code'].is_a?(Array))
           return student['academic_plan_code']
     end
     
     plan_array = Array(student['academic_plan_code'])
     
     # sort array by degree (PhD = 0, MS = 1)?
     # sort by most recent to oldest degree?
 
     return plan_array
 

end

#currentPlan(student) ⇒ Object



93
94
95
96
97
98
99
100
101
102
# File 'jekyll/_plugins/degree-plans.rb', line 93

def currentPlan(student)
    
    # return the default plan for a student 
    # (the  plan which will be listed on the students degree page)
    # this could be the earliest plan, or the plan with highest degree,
    # or plan with lowest degree
    
     return defaultPlan(student)

end

#currentPlansContain(student, plan_code) ⇒ Object



104
105
106
107
108
109
# File 'jekyll/_plugins/degree-plans.rb', line 104

def currentPlansContain(student,plan_code)
    if (student['academic_plan_code'].is_a?(Array))
        return student['academic_plan_code'].include?(plan_code)
    end
    return (student['academic_plan_code'] == plan_code)
end

#defaultPlan(student) ⇒ Object




66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'jekyll/_plugins/degree-plans.rb', line 66

def defaultPlan(student)
    
    # return the default plan for a student 
    # (the  plan which will be listed on the students degree page)
    # this could be the earliest plan, or the plan with highest degree,
    # or plan with lowest degree
    # Jekyll.logger.warn "defaultPlan: academic plan code #{"%s" % [student['academic_plan_code']]}"
    
    if (student == nil)
       return nil
    end
    if (student['academic_plan_code'] == nil)
       #        Jekyll.logger.warn "defaultPlan: No academic plan code #{"%s" % [student['fsuid']]}"
       return nil
    end
    
     if (student['academic_plan_code'].is_a?(Array))
            return student['academic_plan_code'][0]
     end
     
     return student['academic_plan_code']

end

#multiplePlans(student) ⇒ Object




16
17
18
19
20
21
22
23
24
25
# File 'jekyll/_plugins/degree-plans.rb', line 16

def multiplePlans(student)
  # student can have multiple plans,or one single plan

  if (student['academic_plan_code'].is_a?(Array))
        return true
  end
  
  return false
  
end