def beton_change_type(user_id: int, beton_type: str): if user_id in beton_parameters: beton_parameters[user_id]['beton_type'] = beton_type else: beton_size = users_data_base.find({'_id': user_id})[0]['beton_size'] beton_metric = users_data_base.find({'_id': user_id})[0]['beton_metric'] beton_w = users_data_base.find({'_id': user_id})[0]['beton_w'] beton_parameters.update({user_id: {'beton_size': beton_size, 'beton_metric': beton_metric, 'beton_type': beton_type, 'beton_w': beton_w}}) users_data_base.update_one({'_id': user_id}, {'$set': {'beton_type': beton_type}})
def beton_change_w(user_id: int, number): if user_id in beton_parameters: beton_parameters[user_id]['beton_w'] = int(number) else: beton_size = users_data_base.find({'_id': user_id})[0]['beton_size'] beton_metric = users_data_base.find({'_id': user_id})[0]['beton_metric'] beton_type = users_data_base.find({'_id': user_id})[0]['beton_type'] beton_parameters.update({user_id: {'beton_size': beton_size, 'beton_metric': beton_metric, 'beton_type': beton_type, 'beton_w': int(number)}}) users_data_base.update_one({'_id': user_id}, {'$set': {'beton_w': int(number)}})
def beton_parameters_check(user_id): if user_id in beton_parameters: beton_size = beton_parameters[user_id]['beton_size'] beton_metric = beton_parameters[user_id]['beton_metric'] beton_type = beton_parameters[user_id]['beton_type'] beton_w = beton_parameters[user_id]['beton_w'] else: beton_size = users_data_base.find({'_id': user_id})[0]['beton_size'] beton_metric = users_data_base.find({'_id': user_id})[0]['beton_metric'] beton_type = users_data_base.find({'_id': user_id})[0]['beton_type'] beton_w = users_data_base.find({'_id': user_id})[0]['beton_w'] beton_parameters.update({user_id: {'beton_size': beton_size, 'beton_metric': beton_metric, 'beton_type': beton_type, 'beton_w': beton_w}}) return beton_size, beton_metric, beton_type, beton_w