Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add server side support for storing the "consent" rw document #336

Merged
merged 4 commits into from
Jul 27, 2016

Commits on Jul 25, 2016

  1. Add support for the new consent config class

    Similar to 526f5d6,
    - add a new wrapper class
    - add a mapping in the entry object
    - add a mapping to the correct timeseries db
    
    Since this is a RW document, we also need to add input and output formatters
    for it. But I will do that in a subsequent checkin.
    shankari committed Jul 25, 2016
    Configuration menu
    Copy the full SHA
    e837866 View commit details
    Browse the repository at this point in the history
  2. Add input and output formatters for the consent config class

    Follow on to e837866 by adding input and
    output formatters
    shankari committed Jul 25, 2016
    Configuration menu
    Copy the full SHA
    828d248 View commit details
    Browse the repository at this point in the history
  3. Fix metadata formatting workarounds on the server

    As described in e-mission/cordova-usercache#17, it
    looks like we never actually passed in a timezone from the client, which means
    that the code to check for timezone validity was never tested.
    
    And of course, that which is not tested is broken. Fix the check by adding
    appropriate imports and module names.
    
    With this change, we now store the incoming config
    
    ```
    2016-07-25 15:28:17,503:DEBUG:module_name = emission.net.usercache.formatters.ios.consent
    2016-07-25 15:28:17,555:DEBUG:write_ts = 1469477974
    2016-07-25 15:28:17,556:DEBUG:insert called
    2016-07-25 15:28:17,556:DEBUG:entry was fine, no need to fix it
    2016-07-25 15:28:17,557:DEBUG:Inserting entry AttrDict({u'user_id': UUID('0763de67-f61e-3f5d-90e7-518e69793954'), u'_id': ObjectId('57969202115514afcd79338b'), u'data': AttrDict({u'category': u'emSensorDataCollectionProtocol', u'approval_date': u'2016-07-14', u'protocol_id': u'2014-04-6267'}), u'metadata': AttrDict({u'platform': u'ios', 'write_local_dt': LocalDate({'hour': 13, 'month': 7, 'second': 34, 'weekday': 0, 'year': 2016, 'timezone': u'America/Los_Angeles', 'day': 25, 'minute': 19}), u'read_ts': 0, u'key': u'config/consent', u'plugin': u'none', u'write_ts': 1469477974, u'type': u'rw-document', u'time_zone': u'America/Los_Angeles', 'write_fmt_time': '2016-07-25T13:19:34-07:00'})}) into timeseries
    ```
    
    and return it as a document.
    
    ```
    2016-07-25 15:28:45,014:DEBUG:finished querying values for ['config/consent']
    2016-07-25 15:28:45,014:DEBUG:finished querying values for []
    2016-07-25 15:28:45,015:DEBUG:Found 2 user overrides for user 0763de67-f61e-3f5d-90e7-518e69793954
    2016-07-25 15:28:45,015:DEBUG:last entry is Entry({u'user_id': UUID('0763de67-f61e-3f5d-90e7-518e69793954'), u'_id': ObjectId('57969202115514afcd79338b'), u'data': {u'category': u'emSensorDataCollectionProtocol', u'approval_date': u'2016-07-14', u'protocol_id': u'2014-04-6267'}, u'metadata': {u'write_fmt_time': u'2016-07-25T13:19:34-07:00', u'write_ts': 1469477974, u'plugin': u'none', u'time_zone': u'America/Los_Angeles', u'platform': u'ios', u'write_local_dt': {u'hour': 13, u'month': 7, u'second': 34, u'weekday': 0, u'year': 2016, u'timezone': u'America/Los_Angeles', u'day': 25, u'minute': 19}, u'key': u'config/consent', u'read_ts': 0, u'type': u'rw-document'}})
    2016-07-25 15:28:45,015:DEBUG:for 0763de67-f61e-3f5d-90e7-518e69793954, config is Consentconfig({u'category': u'emSensorDataCollectionProtocol', u'approval_date': u'2016-07-14', u'protocol_id': u'2014-04-6267'})
    2016-07-25 15:28:45,016:DEBUG:Result = {'updatedExisting': False, u'nModified': 0, u'ok': 1, u'upserted': ObjectId('5796929d115514afcd793398'), u'n': 1} after updating document config/consent
    ```
    shankari committed Jul 25, 2016
    Configuration menu
    Copy the full SHA
    a31ba77 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    43ca63f View commit details
    Browse the repository at this point in the history