Student automatic association still not working without gui. Please help! ("Association variable mismatch: clearing database")

Added by Alex Alex about 2 years ago

The automatic association (command "auto-multiple-choice association-auto") often does not work for me. I have already described my problem and provided a minimal project (with a bash script to grade and associate) which does not correctly do the association:
https://project.auto-multiple-choice.net/boards/2/topics/11923?r=11939#message-11939

This time, I cannot get past the error "Association variable mismatch: clearing database". I tried to read the source code, and saw that it's coming from the "check_keys" function in association.pm (source). This is called in AMC-association-auto.pl with the line "$assoc->check_keys($liste_key,$notes_id);" (source), which means that the assoc object (which encapsulates the association database association.sqlite) checks if the name it received for the student key from the command line argument --liste-key is indeed the same as the one in assoc->variable('key_in_list'). It then does the same for $code (which is --notes-id).

But what I cannot find in the source code is the moment where assoc->variable('key_in_list') is created. A search of the repo (link) does show a line to set it when there is an xml file: "$self->variable('key_in_list',$a->{'liste_key'});" (source), but none that I can see without an xml (which is my case since I'm using command line only and no gui).

Could it be that an xml file is actually mandatory even in command line, and I somehow got it to work only when I was still mixing gui and command line???


Replies (4)

RE: Student automatic association still not working without gui. Please help! ("Association variable mismatch: clearing database") - Added by Alexis Bienvenüe about 2 years ago

"Copie","A:num","Nom","Note","Q1","num.1","num.2" 
"1","","?","0","0","0","0" 
"2","","?","0","0","0","0" 
"3","","?","0","0","0","0" 
"","10","StudentA","ABS","","","" 
"","11","StudentB","ABS","","","" 
"","12","StudentC","ABS","","","" 

You can see here that the num digits are not poperly read into num.1 and num.2, preventing auto association.
It seems that you missed one step before grading with auto-multiple-choice note: extracting the scoring strategy with something like
auto-multiple-choice prepare --mode b --data ./data autoassoc.tex

RE: Student automatic association still not working without gui. Please help! ("Association variable mismatch: clearing database") - Added by Alex Alex about 2 years ago

Thank you very much for your answer! This solves my last problem in the other thread, which I have updated.

Could you please expand on the meaning of "num.1" and "num.2"? As you probably guessed, with "prepare --mode b", those two columns are replaced with a single "num" column.

I feel like this is getting very close to finally solving my recurrent problem! The test that I am currently grading has the same num.1 and num.2 (even though I was very sure that a step with "prepare --mode b" had been ran; but that could be where my bug is).

RE: Student automatic association still not working without gui. Please help! ("Association variable mismatch: clearing database") - Added by Alexis Bienvenüe about 2 years ago

\AMCcodeH{num}{2} builds two questions (one for each digit) with IDs num.1 and num.2, or num[1] and num[2] (depending on AMC version and codedigit option).
The association-auto step needs codes values, which are computed during the note step (codes are questions), which needs the prepare --mode b step that extract the scoring strategy.
Your test used the num.1 form somewhere, and was waiting for the num[1] form in the note step, so did not recognized the codes. I don't know why.

RE: Student automatic association still not working without gui. Please help! ("Association variable mismatch: clearing database") - Added by Alex Alex about 2 years ago

Ah, I get it now. Thank you so much for the time you spent on this, Alexis.

Using what you said, I looked at the script I used before the grading step. I was doing:

auto-multiple-choice prepare --mode s ...
auto-multiple-choice prepare --mode b ...
auto-multiple-choice meptex ...

I switched them around so that "prepare --mode b" is done AFTER the meptex command (which finds the position of the boxes and puts them in the layout database):

auto-multiple-choice prepare --mode s ...
auto-multiple-choice meptex ...
auto-multiple-choice prepare --mode b ...

And now it works every time! I'm guessing the "randomness" that I was experiencing came from cases where I ran my first script twice in row, resulting in "prepare --mode b" to be run after the meptex from the previous run, accidentally working.

I hope that this info can help other people having the same kind of problem. The man page of auto-multiple-choice-prepare, in the section for --mode b, might benefit from a line like

"This command needs to be run after "auto-multiple-choice meptex" has been run, see auto-multiple-choice-meptex".

In particular, even though "prepare --mode s" and "prepare --mode b" are part of the same "prepare" command, the correct order is not to group them together.

(1-4/4)