DoSomething/ds-mdata-responder — pull request #344 by tongxiang (2014-11-26 21:24:59+00:00)
Title: 1) add `logicUserAction.js`, `logicBetaJoin.js`, and `logicAlphaStart.js`, 2) Refactor logicUserAction.js

#### What's this PR do?
It'll become more obvious when PR #340 is pulled into dev, but this PR pulls out logic from `SGCompetitiveStoryController`'s userAction(), betaJoin(), and alphaStart() functions. They each individually had their own interior function, called when the user game was found. These new files are simply the extracted interior functions.

Secondly, this PR also refactors some of the logic within `logicUserAction.js`. This was difficult, because there are many variables passed throughout the function--`level`, `gameDoc`--which would be messy to pass into modularized functions, and then passed out again. Perhaps this is a strong indication that further refactoring is needed in this file.

#### Where should the reviewer start?
First check out how the three new modules were called within the main controller, then check out `logicUserAction.js`, where most of the modularization occurred.

#### How should this be manually tested?
`npm test`! Also played through games with Postman.

#### What are the relevant tickets?
Closes #322, begins to close #321, #320