Incentive Problem
-
Whenever a participants finishes a lesson/skill an engagment (i.e., their last engagement for that module) is marked as complete: https://github.com/NU-CBITS/think_feel_do_engine/blob/master/app/controllers/think_feel_do_engine/navigator_controller.rb#L129
-
With this update, an engagement
after_update
: https://github.com/NU-CBITS/marigold/blob/057d4ed492dda491e9b9f56c5ee36ccfea967974/app/models/engagement.rb#L31-L36 -
This calls
complete_behavior
: https://github.com/NU-CBITS/marigold/blob/057d4ed492dda491e9b9f56c5ee36ccfea967974/app/models/marigold/behavior.rb#L46 -
Which creates a
ParticipantBehavior
viaself.incentive_completion
: https://github.com/NU-CBITS/marigold/blob/057d4ed492dda491e9b9f56c5ee36ccfea967974/app/models/marigold/behavior.rb#L62-L75 -
Which calls after creating: https://github.com/NU-CBITS/marigold/blob/057d4ed492dda491e9b9f56c5ee36ccfea967974/app/models/marigold/participant_behavior.rb#L24
-
Which calls an
after_update
:
- https://github.com/NU-CBITS/marigold/blob/057d4ed492dda491e9b9f56c5ee36ccfea967974/app/models/marigold/participant_incentive.rb#L18;
- https://github.com/NU-CBITS/marigold/blob/057d4ed492dda491e9b9f56c5ee36ccfea967974/app/models/marigold/participant_incentive.rb#L50;
-
And ultimately runs: https://github.com/NU-CBITS/marigold/blob/057d4ed492dda491e9b9f56c5ee36ccfea967974/app/models/marigold/participant_incentive.rb#L54
-
This creates a new
ParticipantIncentive
EVERYTIME b/c a repeatable incentive is never compelete: https://github.com/NU-CBITS/marigold/blob/057d4ed492dda491e9b9f56c5ee36ccfea967974/app/models/marigold/participant_incentive.rb#L67