diff --git a/swad_changelog.h b/swad_changelog.h index 25fbe9a02..8e146b0e2 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -50,7 +50,7 @@ (tv2.tv_usec - tv1.tv_usec); */ /* - DB_QueryINSERT ("can not debug", + DB_QueryINSERT ("can not debug", // TODO: Remove "INSERT INTO debug" " (DebugTime,Txt)" " VALUES" @@ -470,10 +470,11 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.12.1 (2019-09-24)" +#define Log_PLATFORM_VERSION "SWAD 19.12.2 (2019-09-24)" #define CSS_FILE "swad19.3.css" #define JS_FILE "swad18.130.2.js" /* + Version 19.12.2: Sep 24, 2019 View matches results. Not finished. (245977 lines) Version 19.12.1: Sep 24, 2019 View matches results. Not finished. (245987 lines) Version 19.12: Sep 24, 2019 View matches results. Not finished. (245973 lines) 1 change necessary in database: diff --git a/swad_match.c b/swad_match.c index 7f3289f92..b742c6487 100644 --- a/swad_match.c +++ b/swad_match.c @@ -2508,19 +2508,6 @@ void Mch_ReceiveQstAnsFromStd (void) Mch_ComputeScore (Match.MchCod,Gbl.Usrs.Me.UsrDat.UsrCod, &NumQsts,&NumQstsNotBlank,&TotalScore); - DB_QueryINSERT ("can not debug", // TODO: Remove - "INSERT INTO debug" - " (DebugTime,Txt)" - " VALUES" - " (NOW(),'NumQsts = %u')", - NumQsts); - DB_QueryINSERT ("can not debug", // TODO: Remove - "INSERT INTO debug" - " (DebugTime,Txt)" - " VALUES" - " (NOW(),'NumQstsNotBlank = %u')", - NumQstsNotBlank); - Str_SetDecimalPointToUS (); // To print the floating point as a dot if (DB_QueryCOUNT ("can not get if match result exists", "SELECT COUNT(*) FROM mch_results" diff --git a/swad_test.c b/swad_test.c index 212a10034..3aae156b9 100644 --- a/swad_test.c +++ b/swad_test.c @@ -4048,24 +4048,29 @@ void Tst_GetAnswersFromStr (const char StrAnswersOneQst[Tst_MAX_BYTES_ANSWERS_ON unsigned NumOpt; const char *Ptr; char StrOneAnswer[10 + 1]; - int AnsUsr; + unsigned AnsUsr; + /***** Initialize all answers to false *****/ for (NumOpt = 0; NumOpt < Tst_MAX_OPTIONS_PER_QUESTION; NumOpt++) AnswersUsr[NumOpt] = false; + + /***** Set selected answers to true *****/ for (NumOpt = 0, Ptr = StrAnswersOneQst; - NumOpt < Gbl.Test.Answer.NumOptions; + NumOpt < Tst_MAX_OPTIONS_PER_QUESTION && *Ptr; NumOpt++) - if (*Ptr) - { - Par_GetNextStrUntilSeparParamMult (&Ptr,StrOneAnswer,10); - if (sscanf (StrOneAnswer,"%d",&AnsUsr) != 1) - Lay_ShowErrorAndExit ("Bad user's answer."); - if (AnsUsr < 0 || AnsUsr >= Tst_MAX_OPTIONS_PER_QUESTION) - Lay_ShowErrorAndExit ("Bad user's answer."); - AnswersUsr[AnsUsr] = true; - } + { + Par_GetNextStrUntilSeparParamMult (&Ptr,StrOneAnswer,10); + + if (sscanf (StrOneAnswer,"%u",&AnsUsr) != 1) + Lay_ShowErrorAndExit ("Bad user's answer."); + + if (AnsUsr >= Tst_MAX_OPTIONS_PER_QUESTION) + Lay_ShowErrorAndExit ("Bad user's answer."); + + AnswersUsr[AnsUsr] = true; + } } /*****************************************************************************/