def set_confirmed(call_id, confirmed): call = calls_collection.find_one({'_id': ObjectId(call_id)}) if confirmed: # add call to the callers calls list caller_accounts_collection.update_one( {'_id': ObjectId(call['caller_id'])}, {'$push': { 'calls': ObjectId(call_id) }}) calls_collection.update_one({'_id': ObjectId(call_id)}, {'$set': { 'confirmed': True }}) else: calls_collection.delete_one({'_id': ObjectId(call_id)})
def fulfill_call(call_id, helper_id): # call_id and agent_id are assumed to be valid current_timestamp = timing.get_current_time() # Change call formatting.status call_update = { 'status': 'fulfilled', 'timestamp_fulfilled': current_timestamp } calls_collection.update_one({'_id': ObjectId(call_id)}, {'$set': call_update}) new_behavior_log = { 'helper_id': ObjectId(helper_id), 'call_id': ObjectId(call_id), 'timestamp': current_timestamp, 'action': 'fulfilled', } helper_behavior_collection.insert_one(new_behavior_log)
def comment_call(call_id, comment): calls_collection.update_one({'_id': ObjectId(call_id)}, {'$set': { 'comment': comment }})
UpdateOne({"_id": ObjectId(call_id)}, call_update_dict_1), UpdateOne({"_id": ObjectId(call_id)}, call_update_dict_2) ] calls_collection.bulk_write(operations) enqueue.enqueue(call_id) new_behavior_log = { 'helper_id': ObjectId(helper_id), 'call_id': ObjectId(call_id), 'timestamp': timing.get_current_time(), 'action': 'rejected', } helper_behavior_collection.insert_one(new_behavior_log) def comment_call(call_id, comment): calls_collection.update_one({'_id': ObjectId(call_id)}, {'$set': { 'comment': comment }}) if __name__ == '__main__': call_id = '5e81e00cc40e18001ea76912' calls_collection.update_one({'_id': ObjectId(call_id)}, {'$set': { 'feedback_granted': True }}) print(calls_collection.find_one({'_id': ObjectId(call_id)}))
def set_feeback(call_id, feedback_granted): calls_collection.update_one( {'_id': ObjectId(call_id)}, {'$set': { 'feedback_granted': feedback_granted }})