Class: Legion::Extensions::Agentic::Executive::FlexibilityTraining::Helpers::TrainingTask
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Executive::FlexibilityTraining::Helpers::TrainingTask
- Defined in:
- lib/legion/extensions/agentic/executive/flexibility_training/helpers/training_task.rb
Instance Attribute Summary collapse
-
#baseline_performance ⇒ Object
readonly
Returns the value of attribute baseline_performance.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#difficulty ⇒ Object
readonly
Returns the value of attribute difficulty.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#practice_count ⇒ Object
readonly
Returns the value of attribute practice_count.
Instance Method Summary collapse
- #difficulty_label ⇒ Object
-
#initialize(name:, domain:, difficulty:) ⇒ TrainingTask
constructor
A new instance of TrainingTask.
- #practice! ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(name:, domain:, difficulty:) ⇒ TrainingTask
Returns a new instance of TrainingTask.
14 15 16 17 18 19 20 21 22 |
# File 'lib/legion/extensions/agentic/executive/flexibility_training/helpers/training_task.rb', line 14 def initialize(name:, domain:, difficulty:) @id = SecureRandom.uuid @name = name @domain = domain @difficulty = difficulty.clamp(0.0, 1.0).round(10) @baseline_performance = (1.0 - (@difficulty * 0.4)).clamp(0.0, 1.0).round(10) @practice_count = 0 @created_at = Time.now.utc end |
Instance Attribute Details
#baseline_performance ⇒ Object (readonly)
Returns the value of attribute baseline_performance.
12 13 14 |
# File 'lib/legion/extensions/agentic/executive/flexibility_training/helpers/training_task.rb', line 12 def baseline_performance @baseline_performance end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
12 13 14 |
# File 'lib/legion/extensions/agentic/executive/flexibility_training/helpers/training_task.rb', line 12 def created_at @created_at end |
#difficulty ⇒ Object (readonly)
Returns the value of attribute difficulty.
12 13 14 |
# File 'lib/legion/extensions/agentic/executive/flexibility_training/helpers/training_task.rb', line 12 def difficulty @difficulty end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
12 13 14 |
# File 'lib/legion/extensions/agentic/executive/flexibility_training/helpers/training_task.rb', line 12 def domain @domain end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/legion/extensions/agentic/executive/flexibility_training/helpers/training_task.rb', line 12 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/legion/extensions/agentic/executive/flexibility_training/helpers/training_task.rb', line 12 def name @name end |
#practice_count ⇒ Object (readonly)
Returns the value of attribute practice_count.
12 13 14 |
# File 'lib/legion/extensions/agentic/executive/flexibility_training/helpers/training_task.rb', line 12 def practice_count @practice_count end |
Instance Method Details
#difficulty_label ⇒ Object
31 32 33 34 |
# File 'lib/legion/extensions/agentic/executive/flexibility_training/helpers/training_task.rb', line 31 def difficulty_label index = (@difficulty * (Constants::DIFFICULTY_LEVELS.size - 1)).round Constants::DIFFICULTY_LEVELS[index] end |
#practice! ⇒ Object
24 25 26 27 28 29 |
# File 'lib/legion/extensions/agentic/executive/flexibility_training/helpers/training_task.rb', line 24 def practice! @practice_count += 1 improvement = (Constants::IMPROVEMENT_RATE / (1.0 + (@practice_count * 0.1))).round(10) @baseline_performance = [(@baseline_performance + improvement), 1.0].min.round(10) self end |
#to_h ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/legion/extensions/agentic/executive/flexibility_training/helpers/training_task.rb', line 36 def to_h { id: @id, name: @name, domain: @domain, difficulty: @difficulty, baseline_performance: @baseline_performance, practice_count: @practice_count, difficulty_label: difficulty_label, created_at: @created_at } end |