Class: Grade

Inherits:
Object
  • Object
show all
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

Constructor Details

#initialize(rawParsed) ⇒ Grade

Returns a new instance of Grade.

Parameters:

  • rawParsed (Hash)

    The raw data, yet it has already been parsed (like with JSON.parse)

Since:

  • 1.1.0



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

#addedOnString

Note:

This is when the teacher added the grade to magisters

When the grade was entered

Returns:

  • (String)

    Date

See Also:

Since:

  • 1.1.0



113
114
115
# File 'lib/magister/types/grade.rb', line 113

def addedOn
    @addedOn
end

#countsBoolean

If the grade actually counts

Returns:

  • (Boolean)

    counts

Since:

  • 1.1.0



86
87
88
# File 'lib/magister/types/grade.rb', line 86

def counts
    @counts
end

#descriptionString

The description of the grade

Returns:

  • (String)

    description

Since:

  • 1.1.0



41
42
43
# File 'lib/magister/types/grade.rb', line 41

def description
    @description
end

#earnedOnBoolean?

Note:

This is when the actual test occurred

If the current user is exempt from the subhect

Returns:

  • (Boolean, nil)

    exempt

See Also:

Since:

  • 1.1.0



121
122
123
# File 'lib/magister/types/grade.rb', line 121

def earnedOn
    @earnedOn
end

#exemptBoolean

If the current user is exempt from the subject

Returns:

  • (Boolean)

    exempt

See Also:

Since:

  • 1.1.0



105
106
107
# File 'lib/magister/types/grade.rb', line 105

def exempt
    @isExempt
end

#gradeFloat

Get the actual grade/value

Returns:

  • (Float)

    grade

Since:

  • 1.1.0



67
68
69
# File 'lib/magister/types/grade.rb', line 67

def grade
    @grade
end

#idInteger

The id of the grade

Returns:

  • (Integer)

    id

Since:

  • 1.1.0



35
36
37
# File 'lib/magister/types/grade.rb', line 35

def id
    @id
end

#isExemptBoolean

If the current user is exempt from the subject

Returns:

  • (Boolean)

    exempt

Since:

  • 1.1.0



98
99
100
# File 'lib/magister/types/grade.rb', line 98

def isExempt
    @isExempt
end

#isInsufficientBoolean

Note:

This is simply the inverse of isSufficient

If the grade is considered insufficient

Returns:

  • (Boolean)

    insufficient

See Also:

Since:

  • 1.1.0



61
62
63
# File 'lib/magister/types/grade.rb', line 61

def isInsufficient
    !@isSufficient
end

#isSufficientBoolean

If the grade is considered sufficient

Returns:

  • (Boolean)

    sufficient

Since:

  • 1.1.0



53
54
55
# File 'lib/magister/types/grade.rb', line 53

def isSufficient
    @isSufficient
end

#subjectSubject

The subject the grade belongs to

Returns:

Since:

  • 1.1.0



47
48
49
# File 'lib/magister/types/grade.rb', line 47

def subject
    @subject
end

#toBeCaughtUpBoolean

If the test/thing that caused the grade needs to be caught up on

Returns:

  • (Boolean)

    needs to be caught up

Since:

  • 1.1.0



92
93
94
# File 'lib/magister/types/grade.rb', line 92

def toBeCaughtUp
    @toBeCaughtUp
end

#valueFloat

Get the actual grade/value

Returns:

  • (Float)

    grade

See Also:

Since:

  • 1.1.0



74
75
76
# File 'lib/magister/types/grade.rb', line 74

def value
    @grade
end

#weightInteger

Get the wight of the grade

Returns:

  • (Integer)

    weight

Since:

  • 1.1.0



80
81
82
# File 'lib/magister/types/grade.rb', line 80

def weight
    @weight
end