mirror of https://github.com/acanas/swad-core.git
Version 20.68.5: Apr 29, 2021 Fixed bug in matches. Reported by Jesús Garrido Alcázar.
This commit is contained in:
parent
c054fd3351
commit
4c2f1f3142
|
@ -13499,3 +13499,9 @@ RENAME TABLE roo_MACs TO roo_macs;
|
||||||
RENAME TABLE usr_IDs TO usr_ids;
|
RENAME TABLE usr_IDs TO usr_ids;
|
||||||
RENAME TABLE pho_clicks_without_photo TO usr_clicks_without_photo;
|
RENAME TABLE pho_clicks_without_photo TO usr_clicks_without_photo;
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
|
||||||
|
SELECT gam_questions.QstCod,gam_questions.QstInd,tst_questions.AnsType,tst_questions.Shuffle FROM gam_questions,tst_questions WHERE gam_questions.GamCod=7 AND gam_questions.QstCod=tst_questions.QstCod ORDER BY gam_questions.QstInd;
|
||||||
|
|
||||||
|
|
|
@ -600,13 +600,14 @@ TODO: Salvador Romero Cort
|
||||||
|
|
||||||
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
|
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 20.68.4 (2021-04-27)"
|
#define Log_PLATFORM_VERSION "SWAD 20.68.5 (2021-04-29)"
|
||||||
#define CSS_FILE "swad20.45.css"
|
#define CSS_FILE "swad20.45.css"
|
||||||
#define JS_FILE "swad20.6.2.js"
|
#define JS_FILE "swad20.6.2.js"
|
||||||
/*
|
/*
|
||||||
TODO: Rename CENTRE to CENTER in help wiki.
|
TODO: Rename CENTRE to CENTER in help wiki.
|
||||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||||
|
|
||||||
|
Version 20.68.5: Apr 29, 2021 Fixed bug in matches. Reported by Jesús Garrido Alcázar. (309746 lines)
|
||||||
Version 20.68.4: Apr 27, 2021 Fixed bug in question tags. Reported by Julio Ortega Lopera. (309802 lines)
|
Version 20.68.4: Apr 27, 2021 Fixed bug in question tags. Reported by Julio Ortega Lopera. (309802 lines)
|
||||||
Version 20.68.3: Apr 27, 2021 Maximum file size increased from 1.5 GiB to 2000 MiB. (309809 lines)
|
Version 20.68.3: Apr 27, 2021 Maximum file size increased from 1.5 GiB to 2000 MiB. (309809 lines)
|
||||||
Version 20.68.2: Apr 26, 2021 Code optimization in games and exams. (309807 lines)
|
Version 20.68.2: Apr 26, 2021 Code optimization in games and exams. (309807 lines)
|
||||||
|
|
|
@ -1139,8 +1139,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
|
||||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||||
{
|
{
|
||||||
/* Get course code (row[1]) */
|
/* Get course code (row[1]) */
|
||||||
ThisCrs = (Str_ConvertStrCodToLongCod (row[1]) ==
|
ThisCrs = (Str_ConvertStrCodToLongCod (row[1]) == Gbl.Hierarchy.Crs.CrsCod);
|
||||||
Gbl.Hierarchy.Crs.CrsCod);
|
|
||||||
|
|
||||||
/* Compute time from last access */
|
/* Compute time from last access */
|
||||||
if (sscanf (row[2],"%ld",&TimeDiff) != 1)
|
if (sscanf (row[2],"%ld",&TimeDiff) != 1)
|
||||||
|
|
|
@ -786,7 +786,7 @@ void Cty_GetBasicListOfCountries (void)
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/* Get numerical country code (row[0]) */
|
/* Get numerical country code (row[0]) */
|
||||||
if ((Cty->CtyCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Cty->CtyCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongCountrExit ();
|
Err_WrongCountrExit ();
|
||||||
|
|
||||||
/* Get Alpha-2 country code (row[1]) */
|
/* Get Alpha-2 country code (row[1]) */
|
||||||
|
@ -912,7 +912,7 @@ void Cty_GetFullListOfCountries (void)
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/* Get numerical country code (row[0]) */
|
/* Get numerical country code (row[0]) */
|
||||||
if ((Cty->CtyCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Cty->CtyCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongCountrExit ();
|
Err_WrongCountrExit ();
|
||||||
|
|
||||||
/* Get Alpha-2 country code (row[1]) */
|
/* Get Alpha-2 country code (row[1]) */
|
||||||
|
@ -981,7 +981,7 @@ void Cty_WriteSelectorOfCountry (void)
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/* Get country code (row[0]) */
|
/* Get country code (row[0]) */
|
||||||
if ((CtyCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((CtyCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongCountrExit ();
|
Err_WrongCountrExit ();
|
||||||
|
|
||||||
/* Write option */
|
/* Write option */
|
||||||
|
|
|
@ -711,7 +711,7 @@ void Crs_WriteSelectorOfCourse (void)
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/* Get course code (row[0]) */
|
/* Get course code (row[0]) */
|
||||||
if ((CrsCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((CrsCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongCourseExit ();
|
Err_WrongCourseExit ();
|
||||||
|
|
||||||
/* Write option */
|
/* Write option */
|
||||||
|
@ -1833,7 +1833,7 @@ bool Crs_GetDataOfCourseByCod (struct Crs_Course *Crs)
|
||||||
static void Crs_GetDataOfCourseFromRow (struct Crs_Course *Crs,MYSQL_ROW row)
|
static void Crs_GetDataOfCourseFromRow (struct Crs_Course *Crs,MYSQL_ROW row)
|
||||||
{
|
{
|
||||||
/***** Get course code (row[0]) *****/
|
/***** Get course code (row[0]) *****/
|
||||||
if ((Crs->CrsCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Crs->CrsCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongCourseExit ();
|
Err_WrongCourseExit ();
|
||||||
|
|
||||||
/***** Get code of degree (row[1]) *****/
|
/***** Get code of degree (row[1]) *****/
|
||||||
|
@ -2826,13 +2826,13 @@ static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/***** Get degree code (row[0]) *****/
|
/***** Get degree code (row[0]) *****/
|
||||||
if ((Deg.DegCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Deg.DegCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongDegreeExit ();
|
Err_WrongDegreeExit ();
|
||||||
if (!Deg_GetDataOfDegreeByCod (&Deg))
|
if (!Deg_GetDataOfDegreeByCod (&Deg))
|
||||||
Err_WrongDegreeExit ();
|
Err_WrongDegreeExit ();
|
||||||
|
|
||||||
/***** Get course code (row[1]) *****/
|
/***** Get course code (row[1]) *****/
|
||||||
if ((CrsCod = Str_ConvertStrCodToLongCod (row[1])) < 0)
|
if ((CrsCod = Str_ConvertStrCodToLongCod (row[1])) <= 0)
|
||||||
Err_WrongCourseExit ();
|
Err_WrongCourseExit ();
|
||||||
|
|
||||||
/***** Get number of teachers and students in this course *****/
|
/***** Get number of teachers and students in this course *****/
|
||||||
|
|
|
@ -296,7 +296,7 @@ void Deg_WriteSelectorOfDegree (void)
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/* Get degree code (row[0]) */
|
/* Get degree code (row[0]) */
|
||||||
if ((DegCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((DegCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongDegreeExit ();
|
Err_WrongDegreeExit ();
|
||||||
|
|
||||||
/* Write option */
|
/* Write option */
|
||||||
|
@ -1404,7 +1404,7 @@ bool Deg_GetDataOfDegreeByCod (struct Deg_Degree *Deg)
|
||||||
static void Deg_GetDataOfDegreeFromRow (struct Deg_Degree *Deg,MYSQL_ROW row)
|
static void Deg_GetDataOfDegreeFromRow (struct Deg_Degree *Deg,MYSQL_ROW row)
|
||||||
{
|
{
|
||||||
/***** Get degree code (row[0]) *****/
|
/***** Get degree code (row[0]) *****/
|
||||||
if ((Deg->DegCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Deg->DegCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongDegreeExit ();
|
Err_WrongDegreeExit ();
|
||||||
|
|
||||||
/***** Get center code (row[1]) *****/
|
/***** Get center code (row[1]) *****/
|
||||||
|
|
45
swad_exam.c
45
swad_exam.c
|
@ -1729,51 +1729,6 @@ static void Exa_UpdateExam (struct Exa_Exam *Exam,const char *Txt)
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_exam_has_been_modified);
|
Ale_ShowAlert (Ale_SUCCESS,Txt_The_exam_has_been_modified);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/****************** Write parameter with index of question *******************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void Exa_PutParamQstInd (unsigned QstInd)
|
|
||||||
{
|
|
||||||
Par_PutHiddenParamUnsigned (NULL,"QstInd",QstInd);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/******************* Get parameter with index of question ********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
unsigned Exa_GetParamQstInd (void)
|
|
||||||
{
|
|
||||||
long QstInd;
|
|
||||||
|
|
||||||
if ((QstInd = Par_GetParToLong ("QstInd")) <= 0)
|
|
||||||
Err_WrongQuestionIndexExit ();
|
|
||||||
|
|
||||||
return (unsigned) QstInd;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************ Get question code given exam and index of question *************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
long Exa_GetQstCodFromQstInd (long ExaCod,unsigned QstInd)
|
|
||||||
{
|
|
||||||
long QstCod;
|
|
||||||
|
|
||||||
/***** Get question code of the question to be moved up *****/
|
|
||||||
QstCod = DB_QuerySELECTCode ("can not get question code",
|
|
||||||
"SELECT QstCod"
|
|
||||||
" FROM exa_set_questions"
|
|
||||||
" WHERE ExaCod=%ld"
|
|
||||||
" AND QstInd=%u",
|
|
||||||
ExaCod,
|
|
||||||
QstInd);
|
|
||||||
if (QstCod <= 0)
|
|
||||||
Err_WrongQuestionIndexExit ();
|
|
||||||
|
|
||||||
return QstCod;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********** Get number of sessions and check is edition is possible **********/
|
/********** Get number of sessions and check is edition is possible **********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -89,10 +89,6 @@ void Exa_PutFormEditionExam (struct Exa_Exams *Exams,
|
||||||
|
|
||||||
void Exa_ReceiveFormExam (void);
|
void Exa_ReceiveFormExam (void);
|
||||||
|
|
||||||
void Exa_PutParamQstInd (unsigned QstInd);
|
|
||||||
unsigned Exa_GetParamQstInd (void);
|
|
||||||
long Exa_GetQstCodFromQstInd (long ExaCod,unsigned QstInd);
|
|
||||||
|
|
||||||
bool Exa_CheckIfEditable (const struct Exa_Exam *Exam);
|
bool Exa_CheckIfEditable (const struct Exa_Exam *Exam);
|
||||||
|
|
||||||
unsigned Exa_GetNumCoursesWithExams (Hie_Lvl_Level_t Scope);
|
unsigned Exa_GetNumCoursesWithExams (Hie_Lvl_Level_t Scope);
|
||||||
|
|
|
@ -635,11 +635,11 @@ void ExaPrn_GetPrintQuestionsFromDB (struct ExaPrn_Print *Print)
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/* Get question code (row[0]) */
|
/* Get question code (row[0]) */
|
||||||
if ((Print->PrintedQuestions[QstInd].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Print->PrintedQuestions[QstInd].QstCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongQuestionExit ();
|
Err_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Get set code (row[1]) */
|
/* Get set code (row[1]) */
|
||||||
if ((Print->PrintedQuestions[QstInd].SetCod = Str_ConvertStrCodToLongCod (row[1])) < 0)
|
if ((Print->PrintedQuestions[QstInd].SetCod = Str_ConvertStrCodToLongCod (row[1])) <= 0)
|
||||||
Err_WrongSetExit ();
|
Err_WrongSetExit ();
|
||||||
|
|
||||||
/* Get score (row[2]) */
|
/* Get score (row[2]) */
|
||||||
|
@ -1152,7 +1152,7 @@ static unsigned ExaPrn_GetParamQstInd (void)
|
||||||
{
|
{
|
||||||
long QstInd;
|
long QstInd;
|
||||||
|
|
||||||
if ((QstInd = Par_GetParToLong ("QstInd")) < 0)
|
if ((QstInd = Par_GetParToLong ("QstInd")) < 0) // In exams, question index should be 0, 1, 2, 3...
|
||||||
Err_WrongQuestionIndexExit ();
|
Err_WrongQuestionIndexExit ();
|
||||||
|
|
||||||
return (unsigned) QstInd;
|
return (unsigned) QstInd;
|
||||||
|
|
|
@ -1802,7 +1802,7 @@ unsigned Gam_GetParamQstInd (void)
|
||||||
{
|
{
|
||||||
long QstInd;
|
long QstInd;
|
||||||
|
|
||||||
if ((QstInd = Par_GetParToLong ("QstInd")) <= 0)
|
if ((QstInd = Par_GetParToLong ("QstInd")) <= 0) // In games, question index should be 1, 2, 3...
|
||||||
Err_WrongQuestionIndexExit ();
|
Err_WrongQuestionIndexExit ();
|
||||||
|
|
||||||
return (unsigned) QstInd;
|
return (unsigned) QstInd;
|
||||||
|
@ -1859,7 +1859,7 @@ long Gam_GetQstCodFromQstInd (long GamCod,unsigned QstInd)
|
||||||
GamCod,
|
GamCod,
|
||||||
QstInd);
|
QstInd);
|
||||||
if (QstCod <= 0)
|
if (QstCod <= 0)
|
||||||
Err_WrongQuestionIndexExit ();
|
Err_WrongQuestionExit ();
|
||||||
|
|
||||||
return QstCod;
|
return QstCod;
|
||||||
}
|
}
|
||||||
|
@ -2404,11 +2404,11 @@ void Gam_MoveUpQst (void)
|
||||||
QstIndBottom = Gam_GetParamQstInd ();
|
QstIndBottom = Gam_GetParamQstInd ();
|
||||||
|
|
||||||
/***** Move up question *****/
|
/***** Move up question *****/
|
||||||
if (QstIndBottom > 1)
|
if (QstIndBottom > 1) // 2, 3, 4...
|
||||||
{
|
{
|
||||||
/* Indexes of questions to be exchanged */
|
/* Indexes of questions to be exchanged */
|
||||||
QstIndTop = Gam_GetPrevQuestionIndexInGame (Game.GamCod,QstIndBottom);
|
QstIndTop = Gam_GetPrevQuestionIndexInGame (Game.GamCod,QstIndBottom);
|
||||||
if (!QstIndTop)
|
if (QstIndTop == 0)
|
||||||
Err_WrongQuestionIndexExit ();
|
Err_WrongQuestionIndexExit ();
|
||||||
|
|
||||||
/* Exchange questions */
|
/* Exchange questions */
|
||||||
|
|
|
@ -723,7 +723,7 @@ static void Ind_GetNumCoursesWithIndicators (unsigned NumCrssWithIndicatorYes[1
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/* Get course code (row[2]) */
|
/* Get course code (row[2]) */
|
||||||
if ((CrsCod = Str_ConvertStrCodToLongCod (row[2])) < 0)
|
if ((CrsCod = Str_ConvertStrCodToLongCod (row[2])) <= 0)
|
||||||
Err_WrongCourseExit ();
|
Err_WrongCourseExit ();
|
||||||
|
|
||||||
/* Get stored number of indicators of this course */
|
/* Get stored number of indicators of this course */
|
||||||
|
@ -991,7 +991,7 @@ static void Ind_ShowTableOfCoursesWithIndicators (const struct Ind_Indicators *I
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/* Get course code (row[2]) */
|
/* Get course code (row[2]) */
|
||||||
if ((CrsCod = Str_ConvertStrCodToLongCod (row[2])) < 0)
|
if ((CrsCod = Str_ConvertStrCodToLongCod (row[2])) <= 0)
|
||||||
Err_WrongCourseExit ();
|
Err_WrongCourseExit ();
|
||||||
|
|
||||||
/* Get stored number of indicators of this course */
|
/* Get stored number of indicators of this course */
|
||||||
|
|
|
@ -835,7 +835,7 @@ bool Ins_GetDataOfInstitutionByCod (struct Ins_Instit *Ins)
|
||||||
static void Ins_GetDataOfInstitFromRow (struct Ins_Instit *Ins,MYSQL_ROW row)
|
static void Ins_GetDataOfInstitFromRow (struct Ins_Instit *Ins,MYSQL_ROW row)
|
||||||
{
|
{
|
||||||
/***** Get institution code (row[0]) *****/
|
/***** Get institution code (row[0]) *****/
|
||||||
if ((Ins->InsCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Ins->InsCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongInstitExit ();
|
Err_WrongInstitExit ();
|
||||||
|
|
||||||
/***** Get country code (row[1]) *****/
|
/***** Get country code (row[1]) *****/
|
||||||
|
@ -1030,7 +1030,7 @@ void Ins_WriteSelectorOfInstitution (void)
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/* Get institution code (row[0]) */
|
/* Get institution code (row[0]) */
|
||||||
if ((InsCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((InsCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongInstitExit ();
|
Err_WrongInstitExit ();
|
||||||
|
|
||||||
/* Write option */
|
/* Write option */
|
||||||
|
|
17
swad_match.c
17
swad_match.c
|
@ -1796,7 +1796,6 @@ static void Mch_CreateIndexes (long GamCod,long MchCod)
|
||||||
unsigned NumQsts;
|
unsigned NumQsts;
|
||||||
unsigned NumQst;
|
unsigned NumQst;
|
||||||
struct Tst_Question Question;
|
struct Tst_Question Question;
|
||||||
long LongNum;
|
|
||||||
unsigned QstInd;
|
unsigned QstInd;
|
||||||
|
|
||||||
/***** Get questions of the game *****/
|
/***** Get questions of the game *****/
|
||||||
|
@ -1835,9 +1834,7 @@ static void Mch_CreateIndexes (long GamCod,long MchCod)
|
||||||
Err_WrongQuestionExit ();
|
Err_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Get question index (row[1]) */
|
/* Get question index (row[1]) */
|
||||||
if ((LongNum = Str_ConvertStrCodToLongCod (row[1])) <= 0)
|
QstInd = Str_ConvertStrToUnsigned (row[1]);
|
||||||
Err_WrongQuestionIndexExit ();
|
|
||||||
QstInd = (unsigned) LongNum;
|
|
||||||
|
|
||||||
/* Get answer type (row[2]) */
|
/* Get answer type (row[2]) */
|
||||||
Question.Answer.Type = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[2]);
|
Question.Answer.Type = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[2]);
|
||||||
|
@ -1869,7 +1866,6 @@ static void Mch_ReorderAnswer (long MchCod,unsigned QstInd,
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
unsigned NumAnss;
|
unsigned NumAnss;
|
||||||
unsigned NumAns;
|
unsigned NumAns;
|
||||||
long LongNum;
|
|
||||||
unsigned AnsInd;
|
unsigned AnsInd;
|
||||||
char StrOneAnswer[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
char StrOneAnswer[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
||||||
char StrAnswersOneQst[Tst_MAX_BYTES_ANSWERS_ONE_QST + 1];
|
char StrAnswersOneQst[Tst_MAX_BYTES_ANSWERS_ONE_QST + 1];
|
||||||
|
@ -1896,9 +1892,7 @@ static void Mch_ReorderAnswer (long MchCod,unsigned QstInd,
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/* Get answer index (row[0]) */
|
/* Get answer index (row[0]) */
|
||||||
if ((LongNum = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
AnsInd = Str_ConvertStrToUnsigned (row[0]);
|
||||||
Err_WrongAnswerIndexExit ();
|
|
||||||
AnsInd = (unsigned) LongNum;
|
|
||||||
snprintf (StrOneAnswer,sizeof (StrOneAnswer),"%u",AnsInd);
|
snprintf (StrOneAnswer,sizeof (StrOneAnswer),"%u",AnsInd);
|
||||||
|
|
||||||
/* Concatenate answer index to list of answers */
|
/* Concatenate answer index to list of answers */
|
||||||
|
@ -4290,7 +4284,6 @@ void Mch_GetMatchQuestionsFromDB (struct MchPrn_Print *Print)
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
unsigned NumQst;
|
unsigned NumQst;
|
||||||
long LongNum;
|
|
||||||
unsigned QstInd;
|
unsigned QstInd;
|
||||||
struct Mch_UsrAnswer UsrAnswer;
|
struct Mch_UsrAnswer UsrAnswer;
|
||||||
|
|
||||||
|
@ -4315,13 +4308,11 @@ void Mch_GetMatchQuestionsFromDB (struct MchPrn_Print *Print)
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/* Get question code (row[0]) */
|
/* Get question code (row[0]) */
|
||||||
if ((Print->PrintedQuestions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Print->PrintedQuestions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongQuestionExit ();
|
Err_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Get question index (row[1]) */
|
/* Get question index (row[1]) */
|
||||||
if ((LongNum = Str_ConvertStrCodToLongCod (row[1])) < 0)
|
QstInd = Str_ConvertStrToUnsigned (row[1]);
|
||||||
Err_WrongQuestionExit ();
|
|
||||||
QstInd = (unsigned) LongNum;
|
|
||||||
|
|
||||||
/* Get indexes for this question (row[2]) */
|
/* Get indexes for this question (row[2]) */
|
||||||
Str_Copy (Print->PrintedQuestions[NumQst].StrIndexes,row[2],
|
Str_Copy (Print->PrintedQuestions[NumQst].StrIndexes,row[2],
|
||||||
|
|
|
@ -2936,7 +2936,7 @@ static void Msg_GetDistinctCoursesInMyMessages (struct Msg_Messages *Messages)
|
||||||
/* Get next course */
|
/* Get next course */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
Crs.CrsCod = Str_ConvertStrCodToLongCod (row[0]);
|
Crs.CrsCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
if (Crs.CrsCod >= 0 && Messages->NumCourses < Crs_MAX_COURSES_PER_USR)
|
if (Crs.CrsCod > 0 && Messages->NumCourses < Crs_MAX_COURSES_PER_USR)
|
||||||
if (Crs_GetDataOfCourseByCod (&Crs))
|
if (Crs_GetDataOfCourseByCod (&Crs))
|
||||||
{
|
{
|
||||||
Messages->Courses[Messages->NumCourses].CrsCod = Crs.CrsCod;
|
Messages->Courses[Messages->NumCourses].CrsCod = Crs.CrsCod;
|
||||||
|
|
|
@ -2232,7 +2232,7 @@ static void Pho_ShowOrPrintListDegrees (struct Pho_DegPhotos *DegPhotos,
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/* Get degree code (row[0]) */
|
/* Get degree code (row[0]) */
|
||||||
if ((Deg.DegCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Deg.DegCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongDegreeExit ();
|
Err_WrongDegreeExit ();
|
||||||
|
|
||||||
/* Get data of degree */
|
/* Get data of degree */
|
||||||
|
|
|
@ -1557,7 +1557,6 @@ static bool Prj_CheckIfPrjIsFaulty (long PrjCod,struct Prj_Faults *Faults)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
long LongNum;
|
|
||||||
bool IsAssigned;
|
bool IsAssigned;
|
||||||
bool HasTitle;
|
bool HasTitle;
|
||||||
bool HasDescription;
|
bool HasDescription;
|
||||||
|
@ -1591,9 +1590,7 @@ static bool Prj_CheckIfPrjIsFaulty (long PrjCod,struct Prj_Faults *Faults)
|
||||||
IsAssigned = (row[0][0] != '0');
|
IsAssigned = (row[0][0] != '0');
|
||||||
|
|
||||||
/* Get if project is assigned or not (row[1]) */
|
/* Get if project is assigned or not (row[1]) */
|
||||||
LongNum = Str_ConvertStrCodToLongCod (row[1]);
|
NumProposedStds = Str_ConvertStrToUnsigned (row[1]);
|
||||||
NumProposedStds = (LongNum > 0) ? (unsigned) LongNum :
|
|
||||||
0;
|
|
||||||
|
|
||||||
/* Get the title of the project (row[2]) */
|
/* Get the title of the project (row[2]) */
|
||||||
HasTitle = (row[2][0] != '0');
|
HasTitle = (row[2][0] != '0');
|
||||||
|
@ -3179,7 +3176,6 @@ void Prj_GetDataOfProjectByCod (struct Prj_Project *Prj)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
long LongNum;
|
|
||||||
Prj_Proposal_t Proposal;
|
Prj_Proposal_t Proposal;
|
||||||
|
|
||||||
if (Prj->PrjCod > 0)
|
if (Prj->PrjCod > 0)
|
||||||
|
@ -3235,9 +3231,7 @@ void Prj_GetDataOfProjectByCod (struct Prj_Project *Prj)
|
||||||
Prj_NONASSIG;
|
Prj_NONASSIG;
|
||||||
|
|
||||||
/* Get number of students (row[6]) */
|
/* Get number of students (row[6]) */
|
||||||
LongNum = Str_ConvertStrCodToLongCod (row[6]);
|
Prj->NumStds = Str_ConvertStrToUnsigned (row[6]);
|
||||||
Prj->NumStds = (LongNum > 0) ? (unsigned) LongNum :
|
|
||||||
0;
|
|
||||||
|
|
||||||
/* Get project status (row[7]) */
|
/* Get project status (row[7]) */
|
||||||
Prj->Proposal = Prj_PROPOSAL_DEFAULT;
|
Prj->Proposal = Prj_PROPOSAL_DEFAULT;
|
||||||
|
|
|
@ -2747,8 +2747,7 @@ static void Svy_ShowFormEditOneQst (struct Svy_Surveys *Surveys,
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/* Get question index inside survey (row[0]) */
|
/* Get question index inside survey (row[0]) */
|
||||||
if (sscanf (row[0],"%u",&(SvyQst->QstInd)) != 1)
|
SvyQst->QstInd = Str_ConvertStrToUnsigned (row[0]);
|
||||||
Err_WrongQuestionIndexExit ();
|
|
||||||
|
|
||||||
/* Get the type of answer (row[1]) */
|
/* Get the type of answer (row[1]) */
|
||||||
SvyQst->AnswerType = Svy_ConvertFromStrAnsTypDBToAnsTyp (row[1]);
|
SvyQst->AnswerType = Svy_ConvertFromStrAnsTypDBToAnsTyp (row[1]);
|
||||||
|
@ -3389,8 +3388,7 @@ static void Svy_ListSvyQuestions (struct Svy_Surveys *Surveys,
|
||||||
|
|
||||||
/* Write index of question inside survey (row[1]) */
|
/* Write index of question inside survey (row[1]) */
|
||||||
HTM_TD_Begin ("class=\"DAT_SMALL CT COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"DAT_SMALL CT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
if (sscanf (row[1],"%u",&(SvyQst.QstInd)) != 1)
|
SvyQst.QstInd = Str_ConvertStrToUnsigned (row[1]);
|
||||||
Err_WrongQuestionIndexExit ();
|
|
||||||
HTM_Unsigned (SvyQst.QstInd + 1);
|
HTM_Unsigned (SvyQst.QstInd + 1);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
|
10
swad_test.c
10
swad_test.c
|
@ -2000,7 +2000,7 @@ static void Tst_GetQuestionsForNewTestFromDB (struct Tst_Test *Test,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Get question code (row[0]) */
|
/* Get question code (row[0]) */
|
||||||
if ((Print->PrintedQuestions[QstInd].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Print->PrintedQuestions[QstInd].QstCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_ShowErrorAndExit ("Wrong code of question.");
|
Err_ShowErrorAndExit ("Wrong code of question.");
|
||||||
|
|
||||||
/* Get answer type (row[1]) */
|
/* Get answer type (row[1]) */
|
||||||
|
@ -2169,7 +2169,7 @@ static void Tst_ListOneOrMoreQuestionsForEdition (struct Tst_Test *Test,
|
||||||
|
|
||||||
/***** Get question code (row[0]) *****/
|
/***** Get question code (row[0]) *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
if ((Test->Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Test->Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongQuestionExit ();
|
Err_WrongQuestionExit ();
|
||||||
|
|
||||||
/***** Write question row *****/
|
/***** Write question row *****/
|
||||||
|
@ -2432,7 +2432,7 @@ static void Tst_ListOneOrMoreQuestionsForSelectionForSet (struct Exa_Exams *Exam
|
||||||
|
|
||||||
/* Get question code (row[0]) */
|
/* Get question code (row[0]) */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
if ((Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongQuestionExit ();
|
Err_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Write question row */
|
/* Write question row */
|
||||||
|
@ -2517,7 +2517,7 @@ static void Tst_ListOneOrMoreQuestionsForSelectionForGame (struct Gam_Games *Gam
|
||||||
|
|
||||||
/* Get question code (row[0]) */
|
/* Get question code (row[0]) */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
if ((Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongQuestionExit ();
|
Err_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Write question row */
|
/* Write question row */
|
||||||
|
@ -4714,7 +4714,7 @@ void Tst_RemoveSelectedQsts (void)
|
||||||
{
|
{
|
||||||
/* Get question code (row[0]) */
|
/* Get question code (row[0]) */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
if ((QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((QstCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongQuestionExit ();
|
Err_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Remove test question from database */
|
/* Remove test question from database */
|
||||||
|
|
|
@ -2106,7 +2106,7 @@ static void TstPrn_ShowUsrPrints (struct UsrData *UsrDat)
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/* Get print code (row[0]) */
|
/* Get print code (row[0]) */
|
||||||
if ((Print.PrnCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Print.PrnCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongTestExit ();
|
Err_WrongTestExit ();
|
||||||
|
|
||||||
/* Get print data */
|
/* Get print data */
|
||||||
|
|
|
@ -1050,7 +1050,7 @@ static void Tmt_FillTimeTableFromDB (struct Tmt_Timetable *Timetable,
|
||||||
/* Course code (row[6]) */
|
/* Course code (row[6]) */
|
||||||
Tmt_TimeTable[Weekday][Interval].Columns[FirstFreeColumn].CrsCod =
|
Tmt_TimeTable[Weekday][Interval].Columns[FirstFreeColumn].CrsCod =
|
||||||
(Timetable->Type == Tmt_MY_TIMETABLE ? Str_ConvertStrCodToLongCod (row[6]) :
|
(Timetable->Type == Tmt_MY_TIMETABLE ? Str_ConvertStrCodToLongCod (row[6]) :
|
||||||
Gbl.Hierarchy.Crs.CrsCod);
|
Gbl.Hierarchy.Crs.CrsCod);
|
||||||
/* falls through */
|
/* falls through */
|
||||||
/* no break */
|
/* no break */
|
||||||
case Tmt_TUTORING_TIMETABLE:
|
case Tmt_TUTORING_TIMETABLE:
|
||||||
|
|
|
@ -1791,8 +1791,7 @@ void Usr_GetMyCourses (void)
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/* Get course code */
|
/* Get course code */
|
||||||
CrsCod = Str_ConvertStrCodToLongCod (row[0]);
|
if ((CrsCod = Str_ConvertStrCodToLongCod (row[0])) > 0)
|
||||||
if (CrsCod > 0)
|
|
||||||
{
|
{
|
||||||
if (Gbl.Usrs.Me.MyCrss.Num == Crs_MAX_COURSES_PER_USR)
|
if (Gbl.Usrs.Me.MyCrss.Num == Crs_MAX_COURSES_PER_USR)
|
||||||
Err_ShowErrorAndExit ("Maximum number of courses of a user exceeded.");
|
Err_ShowErrorAndExit ("Maximum number of courses of a user exceeded.");
|
||||||
|
|
Loading…
Reference in New Issue