Skip to content

Commit

Permalink
Merge 35157a4 into 0538bad
Browse files Browse the repository at this point in the history
  • Loading branch information
snopoke committed Jul 7, 2021
2 parents 0538bad + 35157a4 commit 36d6bc6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions commcare_export/commcare_minilinq.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ def __call__(self, since, until):
DATE_PARAMS = {
'indexed_on': SimpleSinceParams('indexed_on_start', 'indexed_on_end'),
'server_date_modified': SimpleSinceParams('server_date_modified_start', 'server_date_modified_end'),
'date': SimpleSinceParams('date.gte', 'date.lt'), # used by messaging-events
# used by messaging-events
'date_last_activity': SimpleSinceParams('date_last_activity.gte', 'date_last_activity.lt'),
}


Expand All @@ -96,12 +97,12 @@ def get_paginator(resource, page_size=1000, pagination_mode=PaginationMode.date_
PaginationMode.date_indexed: {
'form': DatePaginator('indexed_on', page_size),
'case': DatePaginator('indexed_on', page_size),
'messaging-event': DatePaginator('date', page_size),
'messaging-event': DatePaginator('date_last_activity', page_size),
},
PaginationMode.date_modified: {
'form': DatePaginator(['server_modified_on', 'received_on'], page_size, params=FormFilterSinceParams()),
'case': DatePaginator('server_date_modified', page_size),
'messaging-event': DatePaginator('date', page_size),
'messaging-event': DatePaginator('date_last_activity', page_size),
}
}[pagination_mode].get(resource, SimplePaginator(page_size))

Expand Down
8 changes: 4 additions & 4 deletions tests/test_commcare_hq_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ def _get_results(self, params):

class FakeMessageLogSession(FakeSession):
def _get_results(self, params):
obj_1 = {'id': 1, 'foo': 1, 'date': '2017-01-01T15:36:22Z'}
obj_2 = {'id': 2, 'foo': 2, 'date': '2017-01-01T15:37:22Z'}
obj_3 = {'id': 3, 'foo': 3, 'date': '2017-01-01T15:38:22Z'}
obj_1 = {'id': 1, 'foo': 1, 'date_last_activity': '2017-01-01T15:36:22Z'}
obj_2 = {'id': 2, 'foo': 2, 'date_last_activity': '2017-01-01T15:37:22Z'}
obj_3 = {'id': 3, 'foo': 3, 'date_last_activity': '2017-01-01T15:38:22Z'}
if not params:
return {
'meta': {'next': '?cursor=xyz', 'limit': 2},
'objects': [obj_1, obj_2]
}
else:
since_query_param = DATE_PARAMS['date'].start_param
since_query_param = DATE_PARAMS['date_last_activity'].start_param
since = params[since_query_param]
if since == '2017-01-01T15:37:22':
return {
Expand Down

0 comments on commit 36d6bc6

Please sign in to comment.