cat and allow closed matters on show holds

This commit is contained in:
Jay Lee
2022-12-17 22:56:12 +00:00
parent fb33d8186e
commit 87808902e6

View File

@@ -337,9 +337,9 @@ def print_count():
_validate_query(query, query_discovery) _validate_query(query, query_discovery)
body['query'] = query body['query'] = query
operation = gapi.call(v.matters(), 'count', matterId=matterId, body=body) operation = gapi.call(v.matters(), 'count', matterId=matterId, body=body)
print(f'Watching operation {operation["name"]}...') sys.stderr.write(f'Watching operation {operation["name"]}...\n')
while not operation.get('done'): while not operation.get('done'):
print(f' operation {operation["name"]} is not done yet. Checking again in {operation_wait} seconds') sys.stderr.write(f' operation {operation["name"]} is not done yet. Checking again in {operation_wait} seconds\n')
sleep(operation_wait) sleep(operation_wait)
operation = gapi.call(v.operations(), 'get', name=operation['name']) operation = gapi.call(v.operations(), 'get', name=operation['name'])
response = operation.get('response', {}) response = operation.get('response', {})
@@ -684,11 +684,16 @@ def showHoldsForUsers(users):
matterIds = _getAllMatterIds(v) matterIds = _getAllMatterIds(v)
matterHolds = {} matterHolds = {}
for matterId in matterIds: for matterId in matterIds:
try:
fields = 'holds(holdId,name,accounts(accountId,email),orgUnit),nextPageToken'
matterHolds[matterId] = gapi.get_all_pages(v.matters().holds(), matterHolds[matterId] = gapi.get_all_pages(v.matters().holds(),
'list', 'list',
'holds', 'holds',
fields='holds(holdId,name,accounts(accountId,email),orgUnit),nextPageToken', fields=fields,
throw_reasons=[gapi_errors.ErrorReason.FOUR_O_O],
matterId=matterId) matterId=matterId)
except googleapiclient.errors.HttpError:
continue
totalHolds = 0 totalHolds = 0
for user in users: for user in users:
user = user.lower() user = user.lower()