Class: TrustLevel3Requirements::PenaltyCounts
- Inherits:
-
Object
- Object
- TrustLevel3Requirements::PenaltyCounts
- Defined in:
- app/models/trust_level3_requirements.rb
Instance Attribute Summary collapse
-
#silenced ⇒ Object
readonly
Returns the value of attribute silenced.
-
#suspended ⇒ Object
readonly
Returns the value of attribute suspended.
Instance Method Summary collapse
-
#initialize(user, row) ⇒ PenaltyCounts
constructor
A new instance of PenaltyCounts.
- #total ⇒ Object
Constructor Details
#initialize(user, row) ⇒ PenaltyCounts
Returns a new instance of PenaltyCounts.
9 10 11 12 13 14 15 16 17 |
# File 'app/models/trust_level3_requirements.rb', line 9 def initialize(user, row) @silenced = row["silence_count"] || 0 @suspended = row["suspend_count"] || 0 # If penalty started more than 6 months ago and still continues, it will # not be selected by the query from 'penalty_counts'. @silenced += 1 if @silenced == 0 && user.silenced? @suspended += 1 if @suspended == 0 && user.suspended? end |
Instance Attribute Details
#silenced ⇒ Object (readonly)
Returns the value of attribute silenced.
7 8 9 |
# File 'app/models/trust_level3_requirements.rb', line 7 def silenced @silenced end |
#suspended ⇒ Object (readonly)
Returns the value of attribute suspended.
7 8 9 |
# File 'app/models/trust_level3_requirements.rb', line 7 def suspended @suspended end |
Instance Method Details
#total ⇒ Object
19 20 21 |
# File 'app/models/trust_level3_requirements.rb', line 19 def total @silenced + @suspended end |