rwthmoodle / moodle-mod_cardbox

The Card Box activity can help your students memorize vocabulary, technical terms, formulas and definitions.
2 stars 2 forks source link

Bug: duplicate value in column cardposition #49

Closed koenr closed 1 day ago

koenr commented 12 months ago

On page moodle/mod/cardbox/view.php I get warnings in developer mode: Did you remember to make the first column something unique in your call to get_records? Duplicate value '1' found in column 'cardposition'.

line 1384 of /lib/dml/mysqli_native_moodle_database.php: call to debugging()
line 1679 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
line 1752 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
line 1733 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
line 1712 of /lib/dml/moodle_database.php: call to moodle_database->get_field_select()
line 419 of /mod/cardbox/locallib.php: call to moodle_database->get_field()
line 61 of /mod/cardbox/classes/output/card.php: call to cardbox_get_status()
line 69 of /mod/cardbox/classes/output/overview.php: call to cardbox_card->__construct()
line 988 of /mod/cardbox/controller.php: call to cardbox_overview->__construct()
line 61 of /mod/cardbox/view.php: call to require_once()

Did you remember to make the first column something unique in your call to get_records? Duplicate value '0' found in column 'cardposition'.

line 1384 of /lib/dml/mysqli_native_moodle_database.php: call to debugging()
line 1679 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
line 1752 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
line 1733 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
line 1712 of /lib/dml/moodle_database.php: call to moodle_database->get_field_select()
line 419 of /mod/cardbox/locallib.php: call to moodle_database->get_field()
line 61 of /mod/cardbox/classes/output/card.php: call to cardbox_get_status()
line 69 of /mod/cardbox/classes/output/overview.php: call to cardbox_card->__construct()
line 988 of /mod/cardbox/controller.php: call to cardbox_overview->__construct()
line 61 of /mod/cardbox/view.php: call to require_once

I think it's about the cardbox_progress table. I don't see where this error is coming from. Of course there's more then one card in position 0 and 1

Amrita1991 commented 3 months ago

thank you for reporting this. We have taken the issue in our Backlog and will try to resolve it soon

Amrita1991 commented 2 days ago

We are using DB->get_field() function here and we have cardposition as the field to return. We are sending the card's and the user's id as parameter. One user cannot have 2 cardposition values for a card so it is unique. I am not able to replicate the situation and neither getting warnings. It will be very helpful if you could provide details of the scenario in your instance.

koenr commented 1 day ago

I close this as can't reproduce. I can't reproduce it anymore either. May be something was wrong with one specific cardbox - I can(t remember and I can't find any notes about it anymore. Sorry for this. I'll reopen if I com across it again with more info.