def user_activity(user_id): user = vault.get_user_from_runtime_storage(user_id) if not user: flask.abort(404) user = helpers.extend_user(user) memory_storage_inst = vault.get_memory_storage() result = _get_activity_summary( memory_storage_inst.get_record_ids_by_user_ids([user_id])) result['user'] = user return result
def user_activity(user_id): user = vault.get_user_from_runtime_storage(user_id) if not user: flask.abort(404) user = helpers.extend_user(user) memory_storage_inst = vault.get_memory_storage() records = memory_storage_inst.get_records( memory_storage_inst.get_record_ids_by_user_ids([user_id])) records = sorted(records, key=operator.itemgetter('date'), reverse=True) return { 'user': user, 'total_records': len(records), 'contribution': helpers.get_contribution_summary(records), 'punch_card_data': _get_punch_card_data(records), }
def get_user(user_id): user = vault.get_user_from_runtime_storage(user_id) if not user: flask.abort(404) user = helpers.extend_user(user) return user