Initial changes to support the new gamification UI

The changes include:
    - having the carbon footprint include numbers with and without air
    - adding a new method of percentage of confirmed trips
    - adding a test case for the new metric

While testing this functionality, I found some issues with the user
confirmation of air trips. Checking this in temporarily while I switch to a
different branch to resolve those.
Merge branch 'master' of https://github.com/shankari/e-mission-server into gamification

Pulling in the changes to fix the handling of the air mode
Comment out some debug statements around returning the ground truth

We have now run this once on production, and we know that it works
Merge branch 'master' of https://github.com/shankari/e-mission-server into gamification

Pull changes required to push to production from the master
Final changes for the improved carbon query

- Changed the summary calculation to reduce the number of DB queries required,
  at least in the summary case
- Added a new test case for the summary case
Added a couple of other targeted tests for new functions added as part of this change

They are tested by other tests in here, but it's our goal to aim for 100% test coverage :)
Added a new gamified client that will eventually display an emotion inducing image

Currently, it computes the components of the score that will be translated to
the image.

Also added a test case for the individual summary, and fixed a bug found by the
test case.

Removed some extraneous logging from common
Handle some edge cases more gracefully

- If the user is not yet registered (should never happen in practice, but may
  happen in testing), then return that he/she is not part of any study
- Switch the list of client specific mode queries to a python file instead of a json file because:
    - It makes it easier to have custom queries
    - It makes it work even when the client code is outside the CFC_WebApp directory
Deleted the json list of queries, since we encode this in python now
Check in a unit test case for computing the gamified components

The reason that the test case is in the tests.client_tests module and not the
tests.clients module is that if it is in the tests.clients module, then when
running tests alone, the tests directory is the first entry in the pythonpath,
and so attempts to load the non-test clients.common fail.

Other fixes:
- Changed getScore to getScoreComponents to make the score calculation easier to test
- Moved a couple of imports out of the functions to be consistent with PEP
- Changed the delLongMotorizedModes to delete "air" (no suffix as well),
    and renamed the delModeNameWithPrefix to be accurate (we are providing a suffix, not a prefix)
- Fixed the case where totalCount == 0
Add swap files to the gitignore list
Couple of small fixes to test cases

- Added a test case for the totalSections = 0 case
- Remove unnecessary comment in testCarbon
Added support to return a user specific carbon footprint for a specified range

This is currently needed because the score for gamification is going to be
based on a lot more time than one week. It will also help with the range based
visualization that Shanthi is planning for the data side.

Also changed the gamification code to have the score components based on the
past year.
Bunch of plumbing to hook up the new functions to the REST API

In particular, we have the following:
- generalize the code to return study specific results from 'carshare' to any study
    - if the study has a result screen, return it, otherwise return the
      existing data specific screen
- add a getResult() method to the plugin interface to accomodate the generalization
- change carshare to implement the new plugin interface
- change gamified to implement the new plugin interface
- create a result template for gamified and populate it with the components
- implememented a utility function for it in userclient

In addition, there are a couple of small bugfixes:
- go back to returning a projection for the mode distance instead of getting the entire section
- refactor userclient a bit (NOTE: NEED UNIT TESTS FOR THIS)
- changed the update_client utility script to take the option to create a new
  key or not from the commmand line, which avoids editing the default
Three small fixes to get the unit tests to pass

- mainly moving the bottle import into the display function. This is not at the
  top level, as recommended by PEP because then we would need to add the bottle
  code to the pythonpath
- a small refactoring in the user code to call an existing function
Merge branch 'master' of https://github.com/shankari/e-mission-server into gamification

To ensure that we can avoid conflicts
Merge pull request #13 from shankari/gamification

Add in support for the gamified UI