in Python/ConnectDialer.py [0:0]
def queryDDB(table, index, minInterval, maxAttempts, successInterval):
table = dynamodb.Table(table)
lastSuccessThreshold = Decimal((datetime.now() - timedelta(minutes=successInterval)).timestamp())
print(lastSuccessThreshold)
lastAttemptThreshold = Decimal((datetime.now() - timedelta(minutes=minInterval)).timestamp())
print(lastAttemptThreshold)
response = table.query(
IndexName='Enabled-lastSuccess-index',
KeyConditionExpression=Key('Enabled').eq('1') & Key('lastSuccess').lt(lastSuccessThreshold),
FilterExpression=Attr('lastAttempt').lt(lastAttemptThreshold) & Attr('contactAttempts').lt(str(maxAttempts))
)
#response = table.query(
# IndexName=index,
# KeyConditionExpression=Key('SuccessfulConnection').eq('0'),
# FilterExpression=Attr('lastAttempt').lt(lastAttemptDate)&Attr('contactAttempts').lt(str(maxAttempts))
#)
print('Query Results: ' + str(response['Count']))
return response