DoSomething/ds-mdata-responder — pull request #128 by tongxiang (2014-08-26 22:40:19+00:00)
Title: add new endgame universal group message logic (SMS-60)

#### What's this PR do?
This PR adds new end game logic to the responder. Now, if the JSON config file has the proper keys in the 'END-GAME' object, the responder can calculate the number of levels successfully passed by the group (in other words, the impact path selected) and send the entire group a message dependent on the number of levels collectively passed.

#### Where should the reviewer start?
Start reviewing at the SGCompetitiveStoryController.js, and then check out the 'END-GAME' object in the test-endgame-message.json file.

#### How should this be manually tested?
This should be tested with Postman. First, comment out `this.gameConfig = app.get('competitive-stories');` on line 23, and comment in line 25: `this.gameConfig = app.get('test-endgame-message')`.

*Test-endgame-message* is a test JSON file. It's the config file for bully text, with new keys and objects created in the 'END-LEVEL' object to allow for testing of the group end-game message system. In the **group-success-failure-oips** object, you'll see that each of the object's keys corresponds to the numbers of levels passed by the group; the values are the opt-in paths which correspond to that number of levels. So for instance, if the group passes 5 or 6 levels, we enroll the entire group in the '99' opt-in path.

With postman, you can create a game with any number of players. The sequence which hits every success choice:

*B*AA*B*A**A

(The * represents a wildcard, can be either A or B.)

With postman, if you then POST the sequence of "BBAABBAABBBB" for each player (the first two levels are passed with the success condition; the last four levels are not passed), the group will collectively pass two out of six levels. You should be able to confirm within MongoDB that the players have all been enrolled in the "50" opt-in path.

#### What are the relevant tickets?
Jira SMS-60

#### Questions:
Is there any modularization of functions that can be done?