Errore in risultato test per categorie (scelta random delle domande)

Funzionalità di frontend per utenti e amministratori dei corsi: navigazione generale, materiali didattici, test, registro valutazioni, ecc.
User avatar
kingbluz
FormaLms User
Posts: 216
Joined: Sat Dec 08, 2012 5:08 pm
Version: forma.lms 2.0
Location: Milano, Italy

Re: Errore in risultato test per categorie (scelta random delle domande)

Post by kingbluz »

Piccolo aggiornamento: il fix non c'è, ma il problema rimane.

Ricapitolando, al momento non è possibile utilizzare il risultato per categorie quando:
- si pescano i quiz in maniera casuale da diverse categorie
- quando si impone di pescare un numero quiz inferiore rispetto al totale dequiz diponibili per ciascuna categoria

La tabella finale mostra comunque il numero totale dei quiz appartenenti alla categoria invece del totale di quelli pescati.

Questo accade sia quando i quiz sono importati sia quando sono inseriti manualmente, sulla 1.4.2 e sulla 1.4.3

Per caso è in programma un fix in tempi brevi?

Maurizio
User avatar
alberto
FormaLms Guru
Posts: 1135
Joined: Fri Mar 02, 2012 9:18 am
Contact:

Re: Errore in risultato test per categorie (scelta random delle domande)

Post by alberto »

Ciao Maurizio, mi spiace ma al momento le risorse sono tutte impegnatissime su altri punti della piattaforma (interfaccia, plugins, compatibilità, consolidamento generale,...) non credo che riusciremo a breve a mettere le mani anche sui test, o almeno non solo con il lavoro di investimento volontario e gratuito che stanno già facendo i partner.
Se invece riesci a trovare un po' di budget contattaci in privato, i numeri li hai tutti ;)
barlasd
Newbie
Posts: 10
Joined: Wed Jan 24, 2018 8:53 am

Re: Errore in risultato test per categorie (scelta random delle domande)

Post by barlasd »

Ho fixato l'errore nel codice aggiungendo un workaround che recupera il totale corretto in base al numero di domande scelto per singola categoria.

Per apportare il fix bisogna modificare il file do.test.php presente nel percorso:

appLms/modules/test

cancellare il codice dalla riga 1126 alla 1145 e sostituire la parte rimossa con la seguente.

Code: Select all

$array_question_number = array();
		list($random_question) = sql_fetch_row(sql_query("SELECT order_info FROM ".$GLOBALS['prefix_lms']."_test WHERE idTest='".$id_test."'"));
		$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
		$json_random = $json->decode($random_question);
		if (is_array($json_random)) {
			foreach ($json_random as $value) {
				$array_question_number[] = $value['selected'];
			}
		}
		
		if(sql_num_rows($re_category)) {
			
			$GLOBALS['page']->add('<br />'
				.'<table summary="'.$lang->def('_TEST_CATEGORY_SCORE').'" class="category_score">'
				.'<caption>'.$lang->def('_TEST_CATEGORY_SCORE').'</caption>'
				.'<thead>'
					.'<tr>'
						.'<th>'.$lang->def('_TEST_QUEST_CATEGORY').'</th>'
						.'<th class="number">'.$lang->def('_TEST_QUEST_NUMBER').'</th'
						.'<th class="number">'.$lang->def('_TEST_TOTAL_SCORE').'</th>'
					.'</tr>'
				.'</thead>'
				.'<tbody>', 'content');
			$i=0;	
			while(list($id_cat, $name_cat, $quest_number) = sql_fetch_row($re_category)) {
				$GLOBALS['page']->add('<tr><td>'.$name_cat.'</td>'
					.'<td class="number">'.$array_question_number[$i].'</td>'
					.'<td class="number">'.( isset($point_do_cat[$id_cat]) ? $point_do_cat[$id_cat] : 0 ).'</td></tr>'
				, 'content');
				$i++;
			}
enjoy ;)
User avatar
alberto
FormaLms Guru
Posts: 1135
Joined: Fri Mar 02, 2012 9:18 am
Contact:

Re: Errore in risultato test per categorie (scelta random delle domande)

Post by alberto »

Grazie barlasd, segnalo il tuo fix agli sviluppatori così lo verificano e se tutto ok lo integriamo nella prossima release

a presto!
User avatar
alberto
FormaLms Guru
Posts: 1135
Joined: Fri Mar 02, 2012 9:18 am
Contact:

Re: Errore in risultato test per categorie (scelta random delle domande)

Post by alberto »

Abbiamo integrato il fix, sarà incluso nella prossima release, grazie a tutti
User avatar
kingbluz
FormaLms User
Posts: 216
Joined: Sat Dec 08, 2012 5:08 pm
Version: forma.lms 2.0
Location: Milano, Italy

Re: Errore in risultato test per categorie (scelta random delle domande)

Post by kingbluz »

grazie barlasd!!!

Mi hai risolto un po' di problemi ;)

Aggiungo solo che nel codice che hai postato (ma era già così nel codice originale) manca la chiusura di un tag <th> che causa un fastidioso disallineamento/sovrapposizione delle intestazioni della tabella dei risultati.

Il codice con questa piccola correzione è il seguente:

Code: Select all

$array_question_number = array();
      list($random_question) = sql_fetch_row(sql_query("SELECT order_info FROM ".$GLOBALS['prefix_lms']."_test WHERE idTest='".$id_test."'"));
      $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
      $json_random = $json->decode($random_question);
      if (is_array($json_random)) {
         foreach ($json_random as $value) {
            $array_question_number[] = $value['selected'];
         }
      }
      
      if(sql_num_rows($re_category)) {
         
         $GLOBALS['page']->add('<br />'
            .'<table summary="'.$lang->def('_TEST_CATEGORY_SCORE').'" class="category_score">'
            .'<caption>'.$lang->def('_TEST_CATEGORY_SCORE').'</caption>'
            .'<thead>'
               .'<tr>'
                  .'<th>'.$lang->def('_TEST_QUEST_CATEGORY').'</th>'
                  .'<th class="number">'.$lang->def('_TEST_QUEST_NUMBER').'</th>'
                  .'<th class="number">'.$lang->def('_TEST_TOTAL_SCORE').'</th>'
               .'</tr>'
            .'</thead>'
            .'<tbody>', 'content');
         $i=0;   
         while(list($id_cat, $name_cat, $quest_number) = sql_fetch_row($re_category)) {
            $GLOBALS['page']->add('<tr><td>'.$name_cat.'</td>'
               .'<td class="number">'.$array_question_number[$i].'</td>'
               .'<td class="number">'.( isset($point_do_cat[$id_cat]) ? $point_do_cat[$id_cat] : 0 ).'</td></tr>'
            , 'content');
            $i++;
         }
E' tutto, grazie ancora!

Maurizio
Post Reply