From 62f596e0dea2c259690209bb29dbcf4c538dfa5c Mon Sep 17 00:00:00 2001 From: acanas Date: Mon, 30 Mar 2020 16:40:12 +0200 Subject: [PATCH] Version19.156.3 --- sql/cambios.sql | 8 ++--- swad_changelog.h | 4 ++- swad_test.c | 87 ++++++++++++++++++++++++++++++------------------ 3 files changed, 61 insertions(+), 38 deletions(-) diff --git a/sql/cambios.sql b/sql/cambios.sql index e411c7d8..d86350f3 100644 --- a/sql/cambios.sql +++ b/sql/cambios.sql @@ -13251,10 +13251,10 @@ INSERT INTO log SELECT * FROM log_full WHERE YEAR(ClickTime) = 2011; Hecho INSERT INTO log SELECT * FROM log_full WHERE YEAR(ClickTime) = 2012; Hecho INSERT INTO log SELECT * FROM log_full WHERE YEAR(ClickTime) = 2013; Hecho INSERT INTO log SELECT * FROM log_full WHERE ClickTime>='20140101' AND ClickTime<'20140201'; Hecho -INSERT INTO log SELECT * FROM log_full WHERE ClickTime>='20140201' AND ClickTime<'20140301'; -INSERT INTO log SELECT * FROM log_full WHERE ClickTime>='20140301' AND ClickTime<'20140401'; -INSERT INTO log SELECT * FROM log_full WHERE ClickTime>='20140401' AND ClickTime<'20140501'; -INSERT INTO log SELECT * FROM log_full WHERE ClickTime>='20140501' AND ClickTime<'20140601'; +INSERT INTO log SELECT * FROM log_full WHERE ClickTime>='20140201' AND ClickTime<'20140301'; Hecho +INSERT INTO log SELECT * FROM log_full WHERE ClickTime>='20140301' AND ClickTime<'20140401'; Hecho +INSERT INTO log SELECT * FROM log_full WHERE ClickTime>='20140401' AND ClickTime<'20140501'; Hecho +INSERT INTO log SELECT * FROM log_full WHERE ClickTime>='20140501' AND ClickTime<'20140601'; Hecho INSERT INTO log SELECT * FROM log_full WHERE ClickTime>='20140601' AND ClickTime<'20140701'; INSERT INTO log SELECT * FROM log_full WHERE ClickTime>='20140701' AND ClickTime<'20140801'; INSERT INTO log SELECT * FROM log_full WHERE ClickTime>='20140801' AND ClickTime<'20140901'; diff --git a/swad_changelog.h b/swad_changelog.h index 9a35aa98..d1700e9c 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -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.156.2 (2020-03-29)" +#define Log_PLATFORM_VERSION "SWAD 19.156.3 (2020-03-29)" #define CSS_FILE "swad19.146.css" #define JS_FILE "swad19.153.js" /* @@ -528,6 +528,8 @@ Param El examen se muestra en pantalla tomándolo del examen en la base de datos, no del formulario. Cuando el alumno pulsa en "He terminado" se le pregunta si está seguro y se vuelve a mostrar el examen cogiéndolo de la base de datos. + Version 19.156.4: Mar 29, 2020 Test exam is stored in database when it's generated. (? lines) + Version 19.156.3: Mar 29, 2020 Code refactoring in tests. (284585 lines) Version 19.156.2: Mar 29, 2020 Test exam with start date and end date. (284568 lines) Version 19.156.1: Mar 29, 2020 List of test exams with start date and end date. (284557 lines) Version 19.156: Mar 28, 2020 New action to confirm assessment of test exam. diff --git a/swad_test.c b/swad_test.c index 0e87c48d..db58acc6 100644 --- a/swad_test.c +++ b/swad_test.c @@ -129,6 +129,8 @@ static void Tst_FreeTagsList (struct Tst_Tags *Tags); static void Tst_ShowFormRequestTest (struct Tst_Test *Test); +static void Tst_PutCheckBoxAllowTeachers (bool AllowTeachers); + static void Tst_GetQuestionsAndAnswersFromForm (struct TsR_Result *Result); static bool Tst_CheckIfNextTstAllowed (void); static void Tst_SetTstStatus (unsigned NumTst,Tst_Status_t TstStatus); @@ -475,10 +477,8 @@ static void Tst_ShowFormRequestTest (struct Tst_Test *Test) void Tst_ShowNewTest (void) { extern const char *Hlp_ASSESSMENT_Tests; - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_No_questions_found_matching_your_search_criteria; extern const char *Txt_Test; - extern const char *Txt_Allow_teachers_to_consult_this_test; extern const char *Txt_Done_assess_test; struct Tst_Test Test; MYSQL_RES *mysql_res; @@ -497,12 +497,7 @@ void Tst_ShowNewTest (void) { /***** Get questions *****/ Tst_GetQuestionsForTest (&Test,&mysql_res); - if (Test.NumQsts == 0) // Query database - { - Ale_ShowAlert (Ale_INFO,Txt_No_questions_found_matching_your_search_criteria); - Tst_ShowFormRequestTest (&Test); // Show the form again - } - else + if (Test.NumQsts) { /***** Get and update number of hits *****/ NumAccessesTst = Tst_GetNumAccessesTst () + 1; @@ -524,19 +519,10 @@ void Tst_ShowNewTest (void) Par_PutHiddenParamUnsigned (NULL,"NumQst",Test.NumQsts); /***** List the questions *****/ - HTM_TABLE_BeginWideMarginPadding (10); Tst_ShowTestQuestionsWhenSeeing (Test.NumQsts,mysql_res); - HTM_TABLE_End (); /***** Test result will be saved? *****/ - HTM_DIV_Begin ("class=\"CM\""); - HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_INPUT_CHECKBOX ("AllowTchs",HTM_DONT_SUBMIT_ON_CHANGE, - "value=\"Y\"" - " checked=\"checked\""); // By default, teachers can see test result - HTM_TxtF (" %s",Txt_Allow_teachers_to_consult_this_test); - HTM_LABEL_End (); - HTM_DIV_End (); + Tst_PutCheckBoxAllowTeachers (true); /***** End form *****/ Btn_PutConfirmButton (Txt_Done_assess_test); @@ -552,6 +538,11 @@ void Tst_ShowNewTest (void) if (Gbl.Usrs.Me.Role.Logged == Rol_STD) Tst_UpdateLastAccTst (Test.NumQsts); } + else // No questions found + { + Ale_ShowAlert (Ale_INFO,Txt_No_questions_found_matching_your_search_criteria); + Tst_ShowFormRequestTest (&Test); // Show the form again + } /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -564,6 +555,27 @@ void Tst_ShowNewTest (void) Tst_TstDestructor (&Test); } +/*****************************************************************************/ +/************ Put checkbox to allow teachers to see test result **************/ +/*****************************************************************************/ + +static void Tst_PutCheckBoxAllowTeachers (bool AllowTeachers) + { + extern const char *The_ClassFormInBox[The_NUM_THEMES]; + extern const char *Txt_Allow_teachers_to_consult_this_test; + + /***** Test result will be available for teachers? *****/ + HTM_DIV_Begin ("class=\"CM\""); + HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]); + HTM_INPUT_CHECKBOX ("AllowTchs",HTM_DONT_SUBMIT_ON_CHANGE, + "value=\"Y\"%s", + AllowTeachers ? " checked=\"checked\"" : // Teachers can see test result + ""); + HTM_TxtF (" %s",Txt_Allow_teachers_to_consult_this_test); + HTM_LABEL_End (); + HTM_DIV_End (); + } + /*****************************************************************************/ /********************* Request the assessment of a test **********************/ /*****************************************************************************/ @@ -962,26 +974,35 @@ static void Tst_ShowTestQuestionsWhenSeeing (unsigned NumQsts, struct Tst_Question Question; MYSQL_ROW row; - /***** Write rows *****/ - for (NumQst = 0; - NumQst < NumQsts; - NumQst++) + if (NumQsts) { - Gbl.RowEvenOdd = NumQst % 2; + /***** Begin table *****/ + HTM_TABLE_BeginWideMarginPadding (10); - /* Create test question */ - Tst_QstConstructor (&Question); + /***** Write one row for each question *****/ + for (NumQst = 0; + NumQst < NumQsts; + NumQst++) + { + Gbl.RowEvenOdd = NumQst % 2; - /* Get question code (row[0]) */ - row = mysql_fetch_row (mysql_res); - if ((Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0) - Lay_ShowErrorAndExit ("Wrong code of question."); + /* Create test question */ + Tst_QstConstructor (&Question); - /* Show question */ - Tst_ShowOneTestQuestionWhenSeeing (NumQst,&Question); + /* Get question code (row[0]) */ + row = mysql_fetch_row (mysql_res); + if ((Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0) + Lay_ShowErrorAndExit ("Wrong code of question."); - /* Destroy test question */ - Tst_QstDestructor (&Question); + /* Show question */ + Tst_ShowOneTestQuestionWhenSeeing (NumQst,&Question); + + /* Destroy test question */ + Tst_QstDestructor (&Question); + } + + /***** End table *****/ + HTM_TABLE_End (); } }