Class: Grade
- Inherits:
-
Object
- Object
- Grade
- Defined in:
- lib/magister/types/grade.rb
Overview
This class is used to represent a grade and all metadata of it.
Instance Method Summary collapse
-
#addedOn ⇒ String
When the grade was entered.
-
#counts ⇒ Boolean
If the grade actually counts.
-
#description ⇒ String
The description of the grade.
-
#earnedOn ⇒ Boolean?
If the current user is exempt from the subhect.
-
#exempt ⇒ Boolean
If the current user is exempt from the subject.
-
#grade ⇒ Float
Get the actual grade/value.
-
#id ⇒ Integer
The id of the grade.
-
#initialize(rawParsed) ⇒ Grade
constructor
Returns a new instance of Grade.
-
#isExempt ⇒ Boolean
If the current user is exempt from the subject.
-
#isInsufficient ⇒ Boolean
If the grade is considered insufficient.
-
#isSufficient ⇒ Boolean
If the grade is considered sufficient.
-
#subject ⇒ Subject
The subject the grade belongs to.
-
#toBeCaughtUp ⇒ Boolean
If the test/thing that caused the grade needs to be caught up on.
-
#value ⇒ Float
Get the actual grade/value.
-
#weight ⇒ Integer
Get the wight of the grade.
Constructor Details
#initialize(rawParsed) ⇒ Grade
Returns a new instance of Grade.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/magister/types/grade.rb', line 11 def initialize(rawParsed) @id = rawParsed["kolomId"] @description = rawParsed["omschrijving"] # This is an attrocity and shouldnt exist. yet here it is. @subject = Subject.new(JSON.parse("{\"Id\": \"#{rawParsed["vak"]["code"]}\", \"Naam\": \"#{rawParsed["vak"]["omschrijving"]}\"}")) @grade = rawParsed["waarde"].gsub(",", ".").to_f @weight = rawParsed["weegfactor"] @isSufficient = rawParsed["isVoldoende"] @counts = rawParsed["teltMee"] @toBeCaughtUp = rawParsed["moetInhalen"] @isExempt = rawParsed["heeftVrijstelling"] # addedOn is when the teacher added it to magister # earnedOn is when the test was done, most teachers dont put this in @addedOn = rawParsed["ingevoerdOp"] @earnedOn = rawParsed["behaaldOp"] end |
Instance Method Details
#addedOn ⇒ String
This is when the teacher added the grade to magisters
When the grade was entered
113 114 115 |
# File 'lib/magister/types/grade.rb', line 113 def addedOn @addedOn end |
#counts ⇒ Boolean
If the grade actually counts
86 87 88 |
# File 'lib/magister/types/grade.rb', line 86 def counts @counts end |
#description ⇒ String
The description of the grade
41 42 43 |
# File 'lib/magister/types/grade.rb', line 41 def description @description end |
#earnedOn ⇒ Boolean?
This is when the actual test occurred
If the current user is exempt from the subhect
121 122 123 |
# File 'lib/magister/types/grade.rb', line 121 def earnedOn @earnedOn end |
#exempt ⇒ Boolean
If the current user is exempt from the subject
105 106 107 |
# File 'lib/magister/types/grade.rb', line 105 def exempt @isExempt end |
#grade ⇒ Float
Get the actual grade/value
67 68 69 |
# File 'lib/magister/types/grade.rb', line 67 def grade @grade end |
#id ⇒ Integer
The id of the grade
35 36 37 |
# File 'lib/magister/types/grade.rb', line 35 def id @id end |
#isExempt ⇒ Boolean
If the current user is exempt from the subject
98 99 100 |
# File 'lib/magister/types/grade.rb', line 98 def isExempt @isExempt end |
#isInsufficient ⇒ Boolean
This is simply the inverse of isSufficient
If the grade is considered insufficient
61 62 63 |
# File 'lib/magister/types/grade.rb', line 61 def isInsufficient !@isSufficient end |
#isSufficient ⇒ Boolean
If the grade is considered sufficient
53 54 55 |
# File 'lib/magister/types/grade.rb', line 53 def isSufficient @isSufficient end |
#subject ⇒ Subject
The subject the grade belongs to
47 48 49 |
# File 'lib/magister/types/grade.rb', line 47 def subject @subject end |
#toBeCaughtUp ⇒ Boolean
If the test/thing that caused the grade needs to be caught up on
92 93 94 |
# File 'lib/magister/types/grade.rb', line 92 def toBeCaughtUp @toBeCaughtUp end |
#value ⇒ Float
Get the actual grade/value
74 75 76 |
# File 'lib/magister/types/grade.rb', line 74 def value @grade end |
#weight ⇒ Integer
Get the wight of the grade
80 81 82 |
# File 'lib/magister/types/grade.rb', line 80 def weight @weight end |