Fix: Console outputs suppressed when not in debug mode to fix server errors caused by unnecessary outputs.

This commit is contained in:
2024-10-29 09:38:43 +00:00
parent 8621027567
commit 0d2479d82e
103 changed files with 527 additions and 498 deletions

View File

@@ -21,6 +21,7 @@ from business_objects.store.product_category import Product_Category_Container
from datastores.datastore_store_product import DataStore_Store_Product
from forms.access_level import Filters_Access_Level
from forms.store.product import Filters_Product
from helpers.helper_app import Helper_App
from models.model_view_store import Model_View_Store
# from routes import bp_home
import lib.argument_validation as av
@@ -40,9 +41,9 @@ class Model_View_Store_Product(Model_View_Store):
def __init__(self, id_permutation, id_currency, id_region_delivery, is_included_VAT, hash_page_current=Model_View_Store.HASH_PAGE_STORE_PRODUCTS):
# Constructor
_m = 'Model_View_Store_Product.__init__'
print(f'{_m}\nstarting...')
Helper_App.console_log(f'{_m}\nstarting...')
super().__init__(hash_page_current=hash_page_current, id_currency=id_currency, id_region_delivery=id_region_delivery, is_included_VAT=is_included_VAT)
print('supered')
Helper_App.console_log('supered')
category_list = DataStore_Store_Base().get_many_product(Parameters_Product(
self.info_user['sub'],
@@ -54,7 +55,7 @@ class Model_View_Store_Product(Model_View_Store):
False, str(id_currency), False,
True, '', False
)) # product_ids=str(id_product), permutation_ids=str(id_permutation))
print('connection to db successful')
Helper_App.console_log('connection to db successful')
# self.categories = categories
# self.category_index = category_index
""
@@ -62,7 +63,7 @@ class Model_View_Store_Product(Model_View_Store):
self.product = category_list.get_permutation_first()
else:
self.product = None
print('selected permutation selected')
Helper_App.console_log('selected permutation selected')
""
"""
@@ -88,7 +89,7 @@ class Model_View_Store_Product(Model_View_Store):
def __init__(self, form_filters, hash_page_current=Model_View_Store.HASH_PAGE_STORE_PRODUCTS):
_m = 'Model_View_Store_Product.__init__'
print(f'{_m}\nstarting...')
Helper_App.console_log(f'{_m}\nstarting...')
super().__init__(hash_page_current=hash_page_current, form_filters=form_filters)
self.access_levels = self.get_many_access_level(Filters_Access_Level())
parameters_product = Parameters_Product.from_form_filters_product(self.form_filters)
@@ -97,7 +98,7 @@ class Model_View_Store_Product(Model_View_Store):
countProducts = 0
for category in self.category_list.categories:
countProducts += len(category.products)
print(f'category count: {len(self.category_list.categories)}\nproduct count: {countProducts}')
Helper_App.console_log(f'category count: {len(self.category_list.categories)}\nproduct count: {countProducts}')
self.category_list_filters, errors_filters = datastore_store.get_many_product(
Parameters_Product(
get_all_product_category = True,
@@ -115,16 +116,16 @@ class Model_View_Store_Product(Model_View_Store):
get_products_quantity_stock_below_min = parameters_product.get_products_quantity_stock_below_min
)
)
print(f'category filters: {self.category_list_filters.categories}')
Helper_App.console_log(f'category filters: {self.category_list_filters.categories}')
self.form_filters.id_category.choices += [(str(category.id_category), category.name) for category in self.category_list_filters.categories]
print(f'category options: {self.form_filters.id_category.choices}')
Helper_App.console_log(f'category options: {self.form_filters.id_category.choices}')
self.variation_types, self.variations, errors = self.get_many_product_variation()
self.units_measurement = self.get_many_unit_measurement()
self.units_measurement_time = [unit_measurement for unit_measurement in self.units_measurement if unit_measurement.is_unit_of_time]
self.currencies = self.get_many_currency()
self.currency_options = [currency.to_json_option() for currency in self.currencies]
print(f'category count: {len(self.category_list.categories)}\nproduct count: {countProducts}')
Helper_App.console_log(f'category count: {len(self.category_list.categories)}\nproduct count: {countProducts}')
@staticmethod
def save_products(comment, list_products):
_m = 'Model_View_Store_Product.save_products'