Skip to content

Instantly share code, notes, and snippets.

@michaelwehrley
Last active June 23, 2016 21:17
Show Gist options
  • Save michaelwehrley/4bfab4b232efd8994f92f8fcf331eec1 to your computer and use it in GitHub Desktop.
Save michaelwehrley/4bfab4b232efd8994f92f8fcf331eec1 to your computer and use it in GitHub Desktop.

Incentive Problem

  1. 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

  2. With this update, an engagement after_update: https://github.com/NU-CBITS/marigold/blob/057d4ed492dda491e9b9f56c5ee36ccfea967974/app/models/engagement.rb#L31-L36

  3. This calls complete_behavior: https://github.com/NU-CBITS/marigold/blob/057d4ed492dda491e9b9f56c5ee36ccfea967974/app/models/marigold/behavior.rb#L46

  4. Which creates a ParticipantBehavior via self.incentive_completion: https://github.com/NU-CBITS/marigold/blob/057d4ed492dda491e9b9f56c5ee36ccfea967974/app/models/marigold/behavior.rb#L62-L75

  5. Which calls after creating: https://github.com/NU-CBITS/marigold/blob/057d4ed492dda491e9b9f56c5ee36ccfea967974/app/models/marigold/participant_behavior.rb#L24

  6. Which calls an after_update:

  1. And ultimately runs: https://github.com/NU-CBITS/marigold/blob/057d4ed492dda491e9b9f56c5ee36ccfea967974/app/models/marigold/participant_incentive.rb#L54

  2. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment