Wunderbyte-GmbH / moodle-local_shopping_cart

Other
4 stars 6 forks source link

DB issue after upfate - lack of unique column #63

Closed semteacher closed 8 months ago

semteacher commented 8 months ago

After upfate to the version 2024031401 (and at least 1 previous), the followitn debug message appears in control pane OR on the "checkout" page:

Did you remember to make the first column something unique in your call to get_records? Duplicate value '0' found in column '?column?'.
line 1066 of /lib/dml/pgsql_native_moodle_database.php: call to debugging()
line 1512 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database->get_records_sql()
line 1463 of /lib/dml/moodle_database.php: call to moodle_database->get_records_select()
line 1645 of /local/shopping_cart/classes/shopping_cart.php: call to moodle_database->get_records()
line 52 of /local/shopping_cart/classes/shopping_cart_credits.php: call to local_shopping_cart\shopping_cart::get_latest_currency_from_history()
line 662 of /local/shopping_cart/classes/shopping_cart.php: call to local_shopping_cart\shopping_cart_credits::get_balance()
line 99 of /local/shopping_cart/lib.php: call to local_shopping_cart\shopping_cart::local_shopping_cart_get_cache_data()
line 3484 of /lib/outputrenderers.php: call to local_shopping_cart_render_navbar_output()
line 219 of /lib/mustache/src/Mustache/Context.php: call to core_renderer->navbar_plugin_output()
line 138 of /lib/mustache/src/Mustache/Context.php: call to Mustache_Context->findVariableInStack()
line 76 of /var/www/moodledata/localcache/mustache/1710601112/boost/__Mustache_7e497844d08f8ed646b3b8c20272bd34.php: call to Mustache_Context->findDot()
line 37 of /var/www/moodledata/localcache/mustache/1710601112/boost/__Mustache_4aa1b29b14b62e9eb02cc88038b79589.php: call to __Mustache_7e497844d08f8ed646b3b8c20272bd34->renderInternal()
line 66 of /lib/mustache/src/Mustache/Template.php: call to __Mustache_4aa1b29b14b62e9eb02cc88038b79589->renderInternal()
line 208 of /lib/outputrenderers.php: call to Mustache_Template->render()
line 107 of /theme/boost/layout/drawers.php: call to renderer_base->render_from_template()
line 1486 of /lib/outputrenderers.php: call to include()
line 1412 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
line 547 of /lib/outputrenderers.php: call to core_renderer->header()
line 296 of /admin/renderer.php: call to plugin_renderer_base->__call()
line 945 of /admin/index.php: call to core_admin_renderer->admin_notifications_page()

Additionally, on the "checkout" page the following debug message appears

Did you remember to make the first column something unique in your call to get_records? Duplicate value '0' found in column '?column?'. line 1066 of /lib/dml/pgsql_native_moodle_database.php: call to debugging() line 1512 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database->get_records_sql() line 1463 of /lib/dml/moodle_database.php: call to moodle_database->get_records_select() line 1645 of /local/shopping_cart/classes/shopping_cart.php: call to moodle_database->get_records() line 52 of /local/shopping_cart/classes/shopping_cart_credits.php: call to local_shopping_cart\shopping_cart::get_latest_currency_from_history() line 110 of /local/shopping_cart/classes/shopping_cart_credits.php: call to local_shopping_cart\shopping_cart_credits::get_balance() line 702 of /local/shopping_cart/classes/shopping_cart.php: call to local_shopping_cart\shopping_cart_credits::prepare_checkout() line 71 of /local/shopping_cart/checkout.php: call to local_shopping_cart\shopping_cart::local_shopping_cart_get_cache_data()

Amount of debug messages are equal to the amount of items in the shopping cart history.

georgmaisser commented 8 months ago

Obviously, this should not occur, but we believe it's linked to faulty entries in DB which should not be created anymore.

Best way seems to reinstall shopping cart. you could also truncate your payment table.

semteacher commented 8 months ago

@georgmaisser Issue was in the list of parameters for get_records() method

bernhard-wunderbyte commented 8 months ago

Fixed by @semteacher