mirror of https://github.com/acanas/swad-core.git
Version19.151.4
This commit is contained in:
parent
4bdc8daf78
commit
2e74679789
|
@ -13117,5 +13117,44 @@ SELECT EXISTS (SELECT * FROM centres WHERE InsCod=1 AND Latitude<>0 AND Longitud
|
|||
|
||||
|
||||
|
||||
-----------------------
|
||||
|
||||
Restaurar una tabla desde la copia de seguridad:
|
||||
|
||||
awk '/Table structure for table `log_full`/,/Table structure for table `log_recent`/{print}' swad_backup_20200322.sql > swad_backup_20200322_log_full.sql
|
||||
^ ^
|
||||
tabla a buscar tabla siguiente
|
||||
|
||||
En el nuevo fichero sql cambiar crs_grp_usr por crs_grp_usr_borrame
|
||||
|
||||
sed -i 's/log_full/log_full_new/g' swad_backup_20200322_log_full.sql
|
||||
|
||||
mysql -u swad -p swad < swad_backup_20200322_log_full.sql
|
||||
|
||||
Importante para que REPAIR TABLE vaya rápido:
|
||||
https://dev.mysql.com/doc/refman/5.7/en/repair-table-optimization.html
|
||||
|
||||
SET SESSION myisam_sort_buffer_size = 256*1024*1024;
|
||||
SET SESSION read_buffer_size = 64*1024*1024;
|
||||
SET GLOBAL myisam_max_sort_file_size = 100*1024*1024*1024;
|
||||
SET GLOBAL repair_cache.key_buffer_size = 128*1024*1024;
|
||||
CACHE INDEX log_full_new IN repair_cache;
|
||||
LOAD INDEX INTO CACHE log_full_new;
|
||||
REPAIR TABLE log_full_new;
|
||||
|
||||
RENAME TABLE log_full TO log_full_old;
|
||||
RENAME TABLE log_full_new TO log_full;
|
||||
|
||||
-------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
SELECT LogCod,ActCod,UNIX_TIMESTAMP()-UNIX_TIMESTAMP(ClickTime),Role,CtyCod,InsCod,CtrCod,DegCod FROM log_recent ORDER BY LogCod DESC LIMIT 20;
|
||||
|
||||
|
||||
|
||||
|
|
@ -497,7 +497,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
|||
En OpenSWAD:
|
||||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 19.151.3 (2020-03-22)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 19.151.4 (2020-03-22)"
|
||||
#define CSS_FILE "swad19.146.css"
|
||||
#define JS_FILE "swad19.91.1.js"
|
||||
/*
|
||||
|
@ -524,6 +524,7 @@ Param
|
|||
// TODO: Oresti Baños: cambiar ojos por candados en descriptores para prohibir/permitir y dejar los ojos para poder elegir descriptores
|
||||
// TODO: Si el alumno ha marcado "Permitir que los profesores...", entonces pedir confirmación al pulsar el botón azul, para evitar que se envíe por error antes de tiempo
|
||||
|
||||
Version 19.151.4: Mar 22, 2020 Code refactoring in tests. (283471 lines)
|
||||
Version 19.151.3: Mar 22, 2020 Code refactoring in tests. (283433 lines)
|
||||
Version 19.151.2: Mar 21, 2020 Code refactoring in tests. (283446 lines)
|
||||
Version 19.151.1: Mar 21, 2020 Code refactoring in tests. (283360 lines)
|
||||
|
|
|
@ -654,7 +654,6 @@ struct Globals
|
|||
long QstCodes[TstCfg_MAX_QUESTIONS_PER_TEST]; // Codes of the sent/received questions in a test
|
||||
char StrIndexesOneQst[TstCfg_MAX_QUESTIONS_PER_TEST][Tst_MAX_BYTES_INDEXES_ONE_QST + 1]; // 0 1 2 3, 3 0 2 1, etc.
|
||||
char StrAnswersOneQst[TstCfg_MAX_QUESTIONS_PER_TEST][Tst_MAX_BYTES_ANSWERS_ONE_QST + 1]; // Answers selected by user
|
||||
Tst_QuestionsOrder_t SelectedOrder;
|
||||
} Test;
|
||||
struct
|
||||
{
|
||||
|
|
97
swad_test.c
97
swad_test.c
|
@ -172,6 +172,7 @@ static void Tst_PutInputFieldNumQst (const char *Field,const char *Label,
|
|||
static void Tst_ShowFormAnswerTypes (const struct Tst_AnswerTypes *AnswerTypes);
|
||||
static unsigned long Tst_GetQuestions (const struct Tst_Tags *Tags,
|
||||
const struct Tst_AnswerTypes *AnswerTypes,
|
||||
Tst_QuestionsOrder_t SelectedOrder,
|
||||
MYSQL_RES **mysql_res);
|
||||
static unsigned long Tst_GetQuestionsForTest (const struct Tst_Tags *Tags,
|
||||
const struct Tst_AnswerTypes *AnswerTypes,
|
||||
|
@ -179,16 +180,20 @@ static unsigned long Tst_GetQuestionsForTest (const struct Tst_Tags *Tags,
|
|||
MYSQL_RES **mysql_res);
|
||||
static void Tst_ListOneQstToEdit (long QstCod,
|
||||
const struct Tst_Tags *Tags,
|
||||
const struct Tst_AnswerTypes *AnswerTypes);
|
||||
const struct Tst_AnswerTypes *AnswerTypes,
|
||||
Tst_QuestionsOrder_t SelectedOrder);
|
||||
static void Tst_ListOneOrMoreQuestionsForEdition (const struct Tst_Tags *Tags,
|
||||
const struct Tst_AnswerTypes *AnswerTypes,
|
||||
Tst_QuestionsOrder_t SelectedOrder,
|
||||
unsigned long NumRows,
|
||||
MYSQL_RES *mysql_res);
|
||||
static void Tst_WriteHeadingRowQuestionsForEdition (const struct Tst_Tags *Tags,
|
||||
const struct Tst_AnswerTypes *AnswerTypes,
|
||||
Tst_QuestionsOrder_t SelectedOrder,
|
||||
unsigned long NumRows);
|
||||
static void Tst_WriteQuestionRowForEdition (const struct Tst_Tags *Tags,
|
||||
const struct Tst_AnswerTypes *AnswerTypes,
|
||||
Tst_QuestionsOrder_t SelectedOrder,
|
||||
unsigned long NumRows,
|
||||
unsigned long NumRow,
|
||||
long QstCod);
|
||||
|
@ -264,6 +269,7 @@ static void Tst_WriteParamQstCod (unsigned NumQst,long QstCod);
|
|||
static bool Tst_GetParamsTst (struct Tst_Tags *Tags,
|
||||
struct Tst_AnswerTypes *AnswerTypes,
|
||||
unsigned *NumQsts,
|
||||
Tst_QuestionsOrder_t *SelectedOrder,
|
||||
Tst_ActionToDoWithQuestions_t ActionToDoWithQuestions);
|
||||
static unsigned Tst_GetAndCheckParamNumTst (void);
|
||||
static unsigned Tst_GetParamNumQsts (void);
|
||||
|
@ -471,6 +477,7 @@ void Tst_ShowNewTest (void)
|
|||
struct Tst_Tags Tags;
|
||||
struct Tst_AnswerTypes AnswerTypes;
|
||||
unsigned NumQsts;
|
||||
Tst_QuestionsOrder_t SelectedOrder;
|
||||
MYSQL_RES *mysql_res;
|
||||
unsigned long NumRows;
|
||||
unsigned NumAccessesTst;
|
||||
|
@ -481,7 +488,7 @@ void Tst_ShowNewTest (void)
|
|||
if (Tst_CheckIfNextTstAllowed ())
|
||||
{
|
||||
/***** Check that all parameters used to generate a test are valid *****/
|
||||
if (Tst_GetParamsTst (&Tags,&AnswerTypes,&NumQsts,Tst_SHOW_TEST_TO_ANSWER)) // Get parameters from form
|
||||
if (Tst_GetParamsTst (&Tags,&AnswerTypes,&NumQsts,&SelectedOrder,Tst_SHOW_TEST_TO_ANSWER)) // Get parameters from form
|
||||
{
|
||||
/***** Get questions *****/
|
||||
if ((NumRows = Tst_GetQuestionsForTest (&Tags,&AnswerTypes,NumQsts,
|
||||
|
@ -1398,7 +1405,7 @@ static void Tst_ShowFormRequestEditTests (const struct Tst_Tags *Tags,
|
|||
if ((NumRows = Tst_GetAllTagsFromCurrentCrs (&mysql_res)))
|
||||
{
|
||||
Frm_StartForm (ActLstTstQst);
|
||||
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Tst_ORDER_STEM);
|
||||
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Tst_DEFAULT_ORDER);
|
||||
|
||||
HTM_TABLE_BeginPadding (2);
|
||||
|
||||
|
@ -2311,14 +2318,15 @@ void Tst_ListQuestionsToEdit (void)
|
|||
struct Tst_Tags Tags;
|
||||
struct Tst_AnswerTypes AnswerTypes;
|
||||
unsigned NumQsts;
|
||||
Tst_QuestionsOrder_t SelectedOrder;
|
||||
MYSQL_RES *mysql_res;
|
||||
unsigned long NumRows;
|
||||
|
||||
/***** Get parameters, query the database and list the questions *****/
|
||||
if (Tst_GetParamsTst (&Tags,&AnswerTypes,&NumQsts,Tst_EDIT_TEST)) // Get parameters from the form
|
||||
if (Tst_GetParamsTst (&Tags,&AnswerTypes,&NumQsts,&SelectedOrder,Tst_EDIT_TEST)) // Get parameters from the form
|
||||
{
|
||||
/***** Get question codes from database *****/
|
||||
if ((NumRows = Tst_GetQuestions (&Tags,&AnswerTypes,&mysql_res)) != 0) // Query database
|
||||
if ((NumRows = Tst_GetQuestions (&Tags,&AnswerTypes,SelectedOrder,&mysql_res)) != 0) // Query database
|
||||
{
|
||||
/* Contextual menu */
|
||||
Mnu_ContextMenuBegin ();
|
||||
|
@ -2327,11 +2335,11 @@ void Tst_ListQuestionsToEdit (void)
|
|||
TsI_CreateXML (NumRows,mysql_res); // Create XML file with exported questions...
|
||||
// ...and put a link to download it
|
||||
else
|
||||
TsI_PutFormToExportQuestions (&Tags,&AnswerTypes); // Export questions
|
||||
TsI_PutFormToExportQuestions (&Tags,&AnswerTypes,SelectedOrder); // Export questions
|
||||
Mnu_ContextMenuEnd ();
|
||||
|
||||
/* Show the table with the questions */
|
||||
Tst_ListOneOrMoreQuestionsForEdition (&Tags,&AnswerTypes,NumRows,mysql_res);
|
||||
Tst_ListOneOrMoreQuestionsForEdition (&Tags,&AnswerTypes,SelectedOrder,NumRows,mysql_res);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -2354,13 +2362,14 @@ void Tst_ListQuestionsToSelect (void)
|
|||
struct Tst_Tags Tags;
|
||||
struct Tst_AnswerTypes AnswerTypes;
|
||||
unsigned NumQsts;
|
||||
Tst_QuestionsOrder_t SelectedOrder;
|
||||
MYSQL_RES *mysql_res;
|
||||
unsigned long NumRows;
|
||||
|
||||
/***** Get parameters, query the database and list the questions *****/
|
||||
if (Tst_GetParamsTst (&Tags,&AnswerTypes,&NumQsts,Tst_SELECT_QUESTIONS_FOR_GAME)) // Get parameters from the form
|
||||
if (Tst_GetParamsTst (&Tags,&AnswerTypes,&NumQsts,&SelectedOrder,Tst_SELECT_QUESTIONS_FOR_GAME)) // Get parameters from the form
|
||||
{
|
||||
if ((NumRows = Tst_GetQuestions (&Tags,&AnswerTypes,&mysql_res)) != 0) // Query database
|
||||
if ((NumRows = Tst_GetQuestions (&Tags,&AnswerTypes,SelectedOrder,&mysql_res)) != 0) // Query database
|
||||
/* Show the table with the questions */
|
||||
Tst_ListOneOrMoreQuestionsForSelection (NumRows,mysql_res);
|
||||
|
||||
|
@ -2383,6 +2392,7 @@ void Tst_ListQuestionsToSelect (void)
|
|||
|
||||
static unsigned long Tst_GetQuestions (const struct Tst_Tags *Tags,
|
||||
const struct Tst_AnswerTypes *AnswerTypes,
|
||||
Tst_QuestionsOrder_t SelectedOrder,
|
||||
MYSQL_RES **mysql_res)
|
||||
{
|
||||
extern const char *Txt_No_questions_found_matching_your_search_criteria;
|
||||
|
@ -2499,7 +2509,7 @@ static unsigned long Tst_GetQuestions (const struct Tst_Tags *Tags,
|
|||
Str_Concat (Query," GROUP BY tst_questions.QstCod",
|
||||
Tst_MAX_BYTES_QUERY_TEST);
|
||||
|
||||
switch (Gbl.Test.SelectedOrder)
|
||||
switch (SelectedOrder)
|
||||
{
|
||||
case Tst_ORDER_STEM:
|
||||
Str_Concat (Query," ORDER BY tst_questions.Stem",
|
||||
|
@ -2660,7 +2670,8 @@ static unsigned long Tst_GetQuestionsForTest (const struct Tst_Tags *Tags,
|
|||
|
||||
static void Tst_ListOneQstToEdit (long QstCod,
|
||||
const struct Tst_Tags *Tags,
|
||||
const struct Tst_AnswerTypes *AnswerTypes)
|
||||
const struct Tst_AnswerTypes *AnswerTypes,
|
||||
Tst_QuestionsOrder_t SelectedOrder)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Tests;
|
||||
extern const char *Txt_Questions;
|
||||
|
@ -2673,10 +2684,10 @@ static void Tst_ListOneQstToEdit (long QstCod,
|
|||
|
||||
/***** Write the heading *****/
|
||||
HTM_TABLE_BeginWideMarginPadding (2);
|
||||
Tst_WriteHeadingRowQuestionsForEdition (Tags,AnswerTypes,1);
|
||||
Tst_WriteHeadingRowQuestionsForEdition (Tags,AnswerTypes,SelectedOrder,1);
|
||||
|
||||
/***** Write question row *****/
|
||||
Tst_WriteQuestionRowForEdition (Tags,AnswerTypes,1,0,QstCod);
|
||||
Tst_WriteQuestionRowForEdition (Tags,AnswerTypes,SelectedOrder,1,0,QstCod);
|
||||
|
||||
/***** End table *****/
|
||||
HTM_TABLE_End ();
|
||||
|
@ -2717,6 +2728,7 @@ bool Tst_GetOneQuestionByCod (long QstCod,MYSQL_RES **mysql_res)
|
|||
|
||||
static void Tst_ListOneOrMoreQuestionsForEdition (const struct Tst_Tags *Tags,
|
||||
const struct Tst_AnswerTypes *AnswerTypes,
|
||||
Tst_QuestionsOrder_t SelectedOrder,
|
||||
unsigned long NumRows,
|
||||
MYSQL_RES *mysql_res)
|
||||
{
|
||||
|
@ -2734,7 +2746,7 @@ static void Tst_ListOneOrMoreQuestionsForEdition (const struct Tst_Tags *Tags,
|
|||
|
||||
/***** Write the heading *****/
|
||||
HTM_TABLE_BeginWideMarginPadding (2);
|
||||
Tst_WriteHeadingRowQuestionsForEdition (Tags,AnswerTypes,NumRows);
|
||||
Tst_WriteHeadingRowQuestionsForEdition (Tags,AnswerTypes,SelectedOrder,NumRows);
|
||||
|
||||
/***** Write rows *****/
|
||||
for (NumRow = 0;
|
||||
|
@ -2749,7 +2761,7 @@ static void Tst_ListOneOrMoreQuestionsForEdition (const struct Tst_Tags *Tags,
|
|||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
||||
|
||||
/***** Write question row *****/
|
||||
Tst_WriteQuestionRowForEdition (Tags,AnswerTypes,NumRows,NumRow,QstCod);
|
||||
Tst_WriteQuestionRowForEdition (Tags,AnswerTypes,SelectedOrder,NumRows,NumRow,QstCod);
|
||||
}
|
||||
|
||||
/***** End table *****/
|
||||
|
@ -2768,6 +2780,7 @@ static void Tst_ListOneOrMoreQuestionsForEdition (const struct Tst_Tags *Tags,
|
|||
|
||||
static void Tst_WriteHeadingRowQuestionsForEdition (const struct Tst_Tags *Tags,
|
||||
const struct Tst_AnswerTypes *AnswerTypes,
|
||||
Tst_QuestionsOrder_t SelectedOrder,
|
||||
unsigned long NumRows)
|
||||
{
|
||||
extern const char *Txt_No_INDEX;
|
||||
|
@ -2809,13 +2822,13 @@ static void Tst_WriteHeadingRowQuestionsForEdition (const struct Tst_Tags *Tags,
|
|||
Tst_WriteParamEditQst ();
|
||||
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Order);
|
||||
HTM_BUTTON_SUBMIT_Begin (Txt_TST_STR_ORDER_FULL[Order],"BT_LINK TIT_TBL",NULL);
|
||||
if (Order == Gbl.Test.SelectedOrder)
|
||||
if (Order == SelectedOrder)
|
||||
HTM_U_Begin ();
|
||||
}
|
||||
HTM_Txt (Txt_TST_STR_ORDER_SHORT[Order]);
|
||||
if (NumRows > 1)
|
||||
{
|
||||
if (Order == Gbl.Test.SelectedOrder)
|
||||
if (Order == SelectedOrder)
|
||||
HTM_U_End ();
|
||||
HTM_BUTTON_End ();
|
||||
Frm_EndForm ();
|
||||
|
@ -2834,6 +2847,7 @@ static void Tst_WriteHeadingRowQuestionsForEdition (const struct Tst_Tags *Tags,
|
|||
|
||||
static void Tst_WriteQuestionRowForEdition (const struct Tst_Tags *Tags,
|
||||
const struct Tst_AnswerTypes *AnswerTypes,
|
||||
Tst_QuestionsOrder_t SelectedOrder,
|
||||
unsigned long NumRows,
|
||||
unsigned long NumRow,
|
||||
long QstCod)
|
||||
|
@ -2943,7 +2957,7 @@ static void Tst_WriteQuestionRowForEdition (const struct Tst_Tags *Tags,
|
|||
Tst_WriteParamEditQst ();
|
||||
if (NumRows == 1)
|
||||
Par_PutHiddenParamChar ("OnlyThisQst",'Y'); // If editing only one question, don't edit others
|
||||
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Gbl.Test.SelectedOrder);
|
||||
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) SelectedOrder);
|
||||
HTM_INPUT_CHECKBOX ("Shuffle",HTM_SUBMIT_ON_CHANGE,
|
||||
"value=\"Y\"%s",
|
||||
row[2][0] == 'Y' ? " checked=\"checked\"" :
|
||||
|
@ -3286,6 +3300,20 @@ static void Tst_GetParamGblAnswerTypes (struct Tst_AnswerTypes *AnswerTypesDst)
|
|||
Tst_MAX_BYTES_LIST_ANSWER_TYPES);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Function parameter with answer types ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Tst_SetParamGblSelectedOrder (Tst_QuestionsOrder_t SelectedOrder)
|
||||
{
|
||||
Tst_Test.SelectedOrder = SelectedOrder;
|
||||
}
|
||||
|
||||
Tst_QuestionsOrder_t Tst_GetParamGblSelectedOrder (void)
|
||||
{
|
||||
return Tst_Test.SelectedOrder;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************** Get answers of a test question from database ****************/
|
||||
/*****************************************************************************/
|
||||
|
@ -4988,6 +5016,7 @@ void Tst_GetAndWriteTagsQst (long QstCod)
|
|||
static bool Tst_GetParamsTst (struct Tst_Tags *Tags,
|
||||
struct Tst_AnswerTypes *AnswerTypes,
|
||||
unsigned *NumQsts,
|
||||
Tst_QuestionsOrder_t *SelectedOrder,
|
||||
Tst_ActionToDoWithQuestions_t ActionToDoWithQuestions)
|
||||
{
|
||||
extern const char *Txt_You_must_select_one_ore_more_tags;
|
||||
|
@ -5062,20 +5091,17 @@ static bool Tst_GetParamsTst (struct Tst_Tags *Tags,
|
|||
/* Get ordering criteria */
|
||||
Par_GetParMultiToText ("Order",UnsignedStr,Cns_MAX_DECIMAL_DIGITS_UINT);
|
||||
if (sscanf (UnsignedStr,"%u",&UnsignedNum) == 1)
|
||||
Gbl.Test.SelectedOrder = (Tst_QuestionsOrder_t) ((UnsignedNum < Tst_NUM_TYPES_ORDER_QST) ? UnsignedNum :
|
||||
0);
|
||||
*SelectedOrder = (Tst_QuestionsOrder_t) ((UnsignedNum < Tst_NUM_TYPES_ORDER_QST) ? UnsignedNum :
|
||||
0);
|
||||
else
|
||||
Gbl.Test.SelectedOrder = (Tst_QuestionsOrder_t) 0;
|
||||
|
||||
/* Get whether we must create the XML file or not */
|
||||
// Gbl.Test.XML.CreateXML = Tst_GetCreateXMLFromForm ();
|
||||
*SelectedOrder = (Tst_QuestionsOrder_t) 0;
|
||||
break;
|
||||
case Tst_SELECT_QUESTIONS_FOR_GAME:
|
||||
/* Get starting and ending dates */
|
||||
Dat_GetIniEndDatesFromForm ();
|
||||
|
||||
/* Order question by stem */
|
||||
Gbl.Test.SelectedOrder = Tst_ORDER_STEM;
|
||||
*SelectedOrder = Tst_ORDER_STEM;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -6038,6 +6064,7 @@ void Tst_ReceiveQst (void)
|
|||
struct Tst_Question Question;
|
||||
struct Tst_Tags Tags;
|
||||
struct Tst_AnswerTypes AnswerTypes;
|
||||
Tst_QuestionsOrder_t SelectedOrder;
|
||||
char Stem[Cns_MAX_BYTES_TEXT + 1];
|
||||
char Feedback[Cns_MAX_BYTES_TEXT + 1];
|
||||
|
||||
|
@ -6045,6 +6072,7 @@ void Tst_ReceiveQst (void)
|
|||
Tst_QstConstructor (&Question);
|
||||
Tst_ResetTags (&Tags);
|
||||
Tst_ResetAnswerTypes (&AnswerTypes);
|
||||
SelectedOrder = Tst_DEFAULT_ORDER;
|
||||
|
||||
/***** Get parameters of the question from form *****/
|
||||
Stem[0] = Feedback[0] = '\0';
|
||||
|
@ -6063,7 +6091,7 @@ void Tst_ReceiveQst (void)
|
|||
QstCod = Tst_InsertOrUpdateQstTagsAnsIntoDB (QstCod,&Question,&Tags);
|
||||
|
||||
/***** Show the question just inserted in the database *****/
|
||||
Tst_ListOneQstToEdit (QstCod,&Tags,&AnswerTypes);
|
||||
Tst_ListOneQstToEdit (QstCod,&Tags,&AnswerTypes,SelectedOrder);
|
||||
}
|
||||
else // Question is wrong
|
||||
{
|
||||
|
@ -6709,11 +6737,12 @@ void Tst_RequestRemoveSelectedQsts (void)
|
|||
extern const char *Txt_Do_you_really_want_to_remove_the_selected_questions;
|
||||
extern const char *Txt_Remove_questions;
|
||||
unsigned NumQsts;
|
||||
Tst_QuestionsOrder_t SelectedOrder;
|
||||
struct Tst_Tags Tags;
|
||||
struct Tst_AnswerTypes AnswerTypes;
|
||||
|
||||
/***** Get parameters *****/
|
||||
if (Tst_GetParamsTst (&Tags,&AnswerTypes,&NumQsts,Tst_EDIT_TEST)) // Get parameters from the form
|
||||
if (Tst_GetParamsTst (&Tags,&AnswerTypes,&NumQsts,&SelectedOrder,Tst_EDIT_TEST)) // Get parameters from the form
|
||||
{
|
||||
/***** Show question and button to remove question *****/
|
||||
Tst_SetParamGblTags (&Tags);
|
||||
|
@ -6753,6 +6782,7 @@ void Tst_RemoveSelectedQsts (void)
|
|||
struct Tst_Tags Tags;
|
||||
struct Tst_AnswerTypes AnswerTypes;
|
||||
unsigned NumQsts;
|
||||
Tst_QuestionsOrder_t SelectedOrder;
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned NumRows;
|
||||
|
@ -6760,10 +6790,10 @@ void Tst_RemoveSelectedQsts (void)
|
|||
long QstCod;
|
||||
|
||||
/***** Get parameters *****/
|
||||
if (Tst_GetParamsTst (&Tags,&AnswerTypes,&NumQsts,Tst_EDIT_TEST)) // Get parameters
|
||||
if (Tst_GetParamsTst (&Tags,&AnswerTypes,&NumQsts,&SelectedOrder,Tst_EDIT_TEST)) // Get parameters
|
||||
{
|
||||
/***** Get question codes *****/
|
||||
NumRows = (unsigned) Tst_GetQuestions (&Tags,&AnswerTypes,&mysql_res); // Query database
|
||||
NumRows = (unsigned) Tst_GetQuestions (&Tags,&AnswerTypes,SelectedOrder,&mysql_res); // Query database
|
||||
|
||||
/***** Remove questions one by one *****/
|
||||
for (NumRow = 0;
|
||||
|
@ -6809,6 +6839,7 @@ void Tst_RequestRemoveOneQst (void)
|
|||
struct Tst_Tags Tags;
|
||||
struct Tst_AnswerTypes AnswerTypes;
|
||||
unsigned NumQsts;
|
||||
Tst_QuestionsOrder_t SelectedOrder;
|
||||
|
||||
/***** Get main parameters from form *****/
|
||||
/* Get the question code */
|
||||
|
@ -6822,7 +6853,7 @@ void Tst_RequestRemoveOneQst (void)
|
|||
|
||||
/* Get other parameters */
|
||||
if (!EditingOnlyThisQst)
|
||||
if (!Tst_GetParamsTst (&Tags,&AnswerTypes,&NumQsts,Tst_EDIT_TEST))
|
||||
if (!Tst_GetParamsTst (&Tags,&AnswerTypes,&NumQsts,&SelectedOrder,Tst_EDIT_TEST))
|
||||
Lay_ShowErrorAndExit ("Wrong test parameters.");
|
||||
|
||||
/***** Show question and button to remove question *****/
|
||||
|
@ -6838,7 +6869,7 @@ void Tst_RequestRemoveOneQst (void)
|
|||
|
||||
/***** Continue editing questions *****/
|
||||
if (EditingOnlyThisQst)
|
||||
Tst_ListOneQstToEdit (QstCod,&Tags,&AnswerTypes);
|
||||
Tst_ListOneQstToEdit (QstCod,&Tags,&AnswerTypes,SelectedOrder);
|
||||
else
|
||||
{
|
||||
Tst_FreeTagsList (&Tags);
|
||||
|
@ -6943,6 +6974,7 @@ void Tst_ChangeShuffleQst (void)
|
|||
bool Shuffle;
|
||||
struct Tst_Tags Tags;
|
||||
struct Tst_AnswerTypes AnswerTypes;
|
||||
Tst_QuestionsOrder_t SelectedOrder;
|
||||
|
||||
/***** Get the question code *****/
|
||||
QstCod = Tst_GetQstCod ();
|
||||
|
@ -6974,7 +7006,8 @@ void Tst_ChangeShuffleQst (void)
|
|||
{
|
||||
Tst_ResetTags (&Tags);
|
||||
Tst_ResetAnswerTypes (&AnswerTypes);
|
||||
Tst_ListOneQstToEdit (QstCod,&Tags,&AnswerTypes);
|
||||
SelectedOrder = Tst_DEFAULT_ORDER;
|
||||
Tst_ListOneQstToEdit (QstCod,&Tags,&AnswerTypes,SelectedOrder);
|
||||
}
|
||||
else
|
||||
Tst_ListQuestionsToEdit ();
|
||||
|
|
|
@ -90,17 +90,18 @@ typedef enum
|
|||
Tst_ORDER_NUM_HITS_NOT_BLANK = 3,
|
||||
Tst_ORDER_AVERAGE_SCORE_NOT_BLANK = 4,
|
||||
} Tst_QuestionsOrder_t;
|
||||
#define Tst_DEFAULT_ORDER Tst_ORDER_STEM
|
||||
|
||||
struct Tst_Test
|
||||
{
|
||||
struct Tst_Tags Tags;
|
||||
struct Tst_AnswerTypes AnswerTypes;
|
||||
Tst_QuestionsOrder_t SelectedOrder;
|
||||
long QstCodes[TstCfg_MAX_QUESTIONS_PER_TEST]; // Codes of the sent/received questions in a test
|
||||
char StrIndexesOneQst[TstCfg_MAX_QUESTIONS_PER_TEST]
|
||||
[Tst_MAX_BYTES_INDEXES_ONE_QST + 1]; // 0 1 2 3, 3 0 2 1, etc.
|
||||
char StrAnswersOneQst[TstCfg_MAX_QUESTIONS_PER_TEST]
|
||||
[Tst_MAX_BYTES_ANSWERS_ONE_QST + 1]; // Answers selected by user
|
||||
Tst_QuestionsOrder_t SelectedOrder;
|
||||
};
|
||||
|
||||
struct Tst_Question
|
||||
|
@ -184,6 +185,8 @@ void Tst_WriteParamEditQst (void);
|
|||
|
||||
void Tst_SetParamGblTags (const struct Tst_Tags *TagsSrc);
|
||||
void Tst_SetParamGblAnswerTypes (const struct Tst_AnswerTypes *AnswerTypesSrc);
|
||||
void Tst_SetParamGblSelectedOrder (Tst_QuestionsOrder_t SelectedOrder);
|
||||
Tst_QuestionsOrder_t Tst_GetParamGblSelectedOrder (void);
|
||||
|
||||
unsigned Tst_GetNumAnswersQst (long QstCod);
|
||||
unsigned Tst_GetAnswersQst (long QstCod,MYSQL_RES **mysql_res,bool Shuffle);
|
||||
|
|
|
@ -90,13 +90,15 @@ static void TsI_WriteRowImportedQst (struct XMLElement *StemElem,
|
|||
/*****************************************************************************/
|
||||
|
||||
void TsI_PutFormToExportQuestions (const struct Tst_Tags *Tags,
|
||||
const struct Tst_AnswerTypes *AnswerTypes)
|
||||
const struct Tst_AnswerTypes *AnswerTypes,
|
||||
Tst_QuestionsOrder_t SelectedOrder)
|
||||
{
|
||||
extern const char *Txt_Export_questions;
|
||||
|
||||
/***** Put a link to create a file with questions *****/
|
||||
Tst_SetParamGblTags (Tags);
|
||||
Tst_SetParamGblAnswerTypes (AnswerTypes);
|
||||
Tst_SetParamGblSelectedOrder (SelectedOrder);
|
||||
Lay_PutContextualLinkIconText (ActLstTstQst,NULL,TsI_PutParamsExportQsts,
|
||||
"file-import.svg",
|
||||
Txt_Export_questions);
|
||||
|
@ -111,7 +113,8 @@ static void TsI_PutParamsExportQsts (void)
|
|||
Dat_WriteParamsIniEndDates ();
|
||||
Tst_WriteParamEditQst ();
|
||||
Par_PutHiddenParamChar ("OnlyThisQst",'N');
|
||||
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Gbl.Test.SelectedOrder);
|
||||
Par_PutHiddenParamUnsigned (NULL,"Order",
|
||||
(unsigned) Tst_GetParamGblSelectedOrder ());
|
||||
TsI_PutCreateXMLParam ();
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,8 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
void TsI_PutFormToExportQuestions (const struct Tst_Tags *Tags,
|
||||
const struct Tst_AnswerTypes *AnswerTypes);
|
||||
const struct Tst_AnswerTypes *AnswerTypes,
|
||||
Tst_QuestionsOrder_t SelectedOrder);
|
||||
bool TsI_GetCreateXMLParamFromForm (void);
|
||||
void TsI_PutFormToImportQuestions (void);
|
||||
void TsI_CreateXML (unsigned long NumRows,MYSQL_RES *mysql_res);
|
||||
|
|
Loading…
Reference in New Issue