mirror of https://github.com/acanas/swad-core.git
Version19.158
This commit is contained in:
parent
d8233a0aa8
commit
38bb6cbd69
|
@ -11,7 +11,7 @@
|
|||
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
|
||||
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-35785511966438130" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-35536074215974130" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
|
||||
|
|
6
Makefile
6
Makefile
|
@ -57,9 +57,9 @@ OBJS = swad_account.o swad_action.o swad_agenda.o swad_alert.o \
|
|||
swad_scope.o swad_search.o swad_session.o swad_setting.o \
|
||||
swad_statistic.o swad_string.o swad_survey.o swad_syllabus.o \
|
||||
swad_system_config.o \
|
||||
swad_tab.o swad_test.o swad_test_config.o swad_test_import.o \
|
||||
swad_test_result.o \
|
||||
swad_test_visibility.o swad_theme.o swad_timeline.o swad_timetable.o \
|
||||
swad_tab.o swad_test.o swad_test_config.o swad_test_exam.o \
|
||||
swad_test_import.o swad_test_visibility.o swad_theme.o swad_timeline.o \
|
||||
swad_timetable.o \
|
||||
swad_user.o \
|
||||
swad_xml.o \
|
||||
swad_zip.o
|
||||
|
|
|
@ -1304,18 +1304,18 @@ CREATE TABLE IF NOT EXISTS tst_config (
|
|||
-- Table tst_exam_questions: stores the questions and answers in test exams made by users
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS tst_exam_questions (
|
||||
TstCod INT NOT NULL,
|
||||
ExaCod INT NOT NULL,
|
||||
QstCod INT NOT NULL,
|
||||
QstInd INT NOT NULL,
|
||||
Score DOUBLE PRECISION NOT NULL DEFAULT 0,
|
||||
Indexes TEXT NOT NULL,
|
||||
Answers TEXT NOT NULL,
|
||||
INDEX(TstCod,QstCod));
|
||||
UNIQUE INDEX(ExaCod,QstCod));
|
||||
--
|
||||
-- Table tst_exams: stores the test exams made by users
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS tst_exams (
|
||||
TstCod INT NOT NULL AUTO_INCREMENT,
|
||||
ExaCod INT NOT NULL AUTO_INCREMENT,
|
||||
CrsCod INT NOT NULL,
|
||||
UsrCod INT NOT NULL,
|
||||
StartTime DATETIME NOT NULL,
|
||||
|
@ -1324,7 +1324,7 @@ CREATE TABLE IF NOT EXISTS tst_exams (
|
|||
NumQstsNotBlank INT NOT NULL DEFAULT 0,
|
||||
AllowTeachers ENUM('N','Y') NOT NULL DEFAULT 'N',
|
||||
Score DOUBLE PRECISION NOT NULL DEFAULT 0,
|
||||
UNIQUE INDEX(TstCod),
|
||||
UNIQUE INDEX(ExaCod),
|
||||
INDEX(CrsCod,UsrCod));
|
||||
--
|
||||
-- Table tst_question_tags: stores the tags associated to each test question
|
||||
|
|
28
swad_API.c
28
swad_API.c
|
@ -3949,7 +3949,7 @@ int swad__sendNotice (struct soap *soap,
|
|||
/****************** Return test configuration in a course ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define TsR_MAX_BYTES_FEEDBACK_TYPE 32
|
||||
#define TstExa_MAX_BYTES_FEEDBACK_TYPE 32
|
||||
|
||||
int swad__getTestConfig (struct soap *soap,
|
||||
char *wsKey,int courseCode, // input
|
||||
|
@ -4001,10 +4001,10 @@ int swad__getTestConfig (struct soap *soap,
|
|||
getTestConfigOut->minQuestions =
|
||||
getTestConfigOut->defQuestions =
|
||||
getTestConfigOut->maxQuestions = 0;
|
||||
getTestConfigOut->visibility = TsV_MIN_VISIBILITY;
|
||||
getTestConfigOut->visibility = TstVis_MIN_VISIBILITY;
|
||||
|
||||
/* TODO: Remove these lines in 2021 */
|
||||
getTestConfigOut->feedback = (char *) soap_malloc (soap,TsR_MAX_BYTES_FEEDBACK_TYPE + 1);
|
||||
getTestConfigOut->feedback = (char *) soap_malloc (soap,TstExa_MAX_BYTES_FEEDBACK_TYPE + 1);
|
||||
getTestConfigOut->feedback[0] = '\0';
|
||||
|
||||
/***** Get test configuration *****/
|
||||
|
@ -4019,26 +4019,26 @@ int swad__getTestConfig (struct soap *soap,
|
|||
|
||||
/* Convert from visibility to old feedback */
|
||||
/* TODO: Remove these lines in 2021 */
|
||||
if (!TsV_IsVisibleTotalScore (TstCfg_GetConfigVisibility ()))
|
||||
if (!TstVis_IsVisibleTotalScore (TstCfg_GetConfigVisibility ()))
|
||||
Str_Copy (getTestConfigOut->feedback,
|
||||
"nothing",
|
||||
TsR_MAX_BYTES_FEEDBACK_TYPE);
|
||||
else if (!TsV_IsVisibleEachQstScore (TstCfg_GetConfigVisibility ()))
|
||||
TstExa_MAX_BYTES_FEEDBACK_TYPE);
|
||||
else if (!TstVis_IsVisibleEachQstScore (TstCfg_GetConfigVisibility ()))
|
||||
Str_Copy (getTestConfigOut->feedback,
|
||||
"totalResult",
|
||||
TsR_MAX_BYTES_FEEDBACK_TYPE);
|
||||
else if (!TsV_IsVisibleCorrectAns (TstCfg_GetConfigVisibility ()))
|
||||
TstExa_MAX_BYTES_FEEDBACK_TYPE);
|
||||
else if (!TstVis_IsVisibleCorrectAns (TstCfg_GetConfigVisibility ()))
|
||||
Str_Copy (getTestConfigOut->feedback,
|
||||
"eachResult",
|
||||
TsR_MAX_BYTES_FEEDBACK_TYPE);
|
||||
else if (!TsV_IsVisibleFeedbackTxt (TstCfg_GetConfigVisibility ()))
|
||||
TstExa_MAX_BYTES_FEEDBACK_TYPE);
|
||||
else if (!TstVis_IsVisibleFeedbackTxt (TstCfg_GetConfigVisibility ()))
|
||||
Str_Copy (getTestConfigOut->feedback,
|
||||
"eachGoodBad",
|
||||
TsR_MAX_BYTES_FEEDBACK_TYPE);
|
||||
TstExa_MAX_BYTES_FEEDBACK_TYPE);
|
||||
else
|
||||
Str_Copy (getTestConfigOut->feedback,
|
||||
"fullFeedback",
|
||||
TsR_MAX_BYTES_FEEDBACK_TYPE);
|
||||
TstExa_MAX_BYTES_FEEDBACK_TYPE);
|
||||
|
||||
/***** Get number of tests *****/
|
||||
if (TstCfg_GetConfigPluggable () == TstCfg_PLUGGABLE_YES &&
|
||||
|
@ -4073,7 +4073,7 @@ static int API_GetTstConfig (long CrsCod)
|
|||
TstCfg_SetConfigMin (0);
|
||||
TstCfg_SetConfigDef (0);
|
||||
TstCfg_SetConfigMax (0);
|
||||
TstCfg_SetConfigVisibility (TsV_VISIBILITY_DEFAULT);
|
||||
TstCfg_SetConfigVisibility (TstVis_VISIBILITY_DEFAULT);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -4906,7 +4906,7 @@ int swad__getGames (struct soap *soap,
|
|||
getGamesOut->gamesArray.__ptr[NumGame].maxGrade = 0.0;
|
||||
|
||||
/* Get visibility (row[5]) */
|
||||
getGamesOut->gamesArray.__ptr[NumGame].visibility = TsV_GetVisibilityFromStr (row[5]);
|
||||
getGamesOut->gamesArray.__ptr[NumGame].visibility = TstVis_GetVisibilityFromStr (row[5]);
|
||||
|
||||
/* Get title of the game (row[6]) */
|
||||
Length = strlen (row[6]);
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "swad_parameter.h"
|
||||
#include "swad_profile.h"
|
||||
#include "swad_report.h"
|
||||
#include "swad_test_exam.h"
|
||||
#include "swad_timeline.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1076,7 +1077,7 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
|
|||
UsrDat->FullName);
|
||||
|
||||
/***** Remove test results made by user in all courses *****/
|
||||
TsR_RemoveTestResultsMadeByUsrInAllCrss (UsrDat->UsrCod);
|
||||
TstExa_RemoveExamsMadeByUsrInAllCrss (UsrDat->UsrCod);
|
||||
|
||||
/***** Remove user's notifications *****/
|
||||
Ntf_RemoveUsrNtfs (UsrDat->UsrCod);
|
||||
|
|
|
@ -644,12 +644,12 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
[ActRenTag ] = { 143,-1,TabUnk,ActReqTst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_RenameTag ,NULL},
|
||||
[ActRcvCfgTst ] = { 454,-1,TabUnk,ActReqTst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstCfg_ReceiveConfigTst ,NULL},
|
||||
|
||||
[ActReqSeeMyTstRes ] = {1083,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,TsR_SelDatesToSeeMyTstResults ,NULL},
|
||||
[ActSeeMyTstRes ] = {1084,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TsR_ShowMyTstResults ,NULL},
|
||||
[ActSeeOneTstResMe ] = {1085,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TsR_ShowOneTstResult ,NULL},
|
||||
[ActReqSeeUsrTstRes ] = {1080,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,TsR_SelUsrsToViewUsrsTstResults,NULL},
|
||||
[ActSeeUsrTstRes ] = {1081,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TsR_GetUsrsAndShowTstResults ,NULL},
|
||||
[ActSeeOneTstResOth ] = {1082,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TsR_ShowOneTstResult ,NULL},
|
||||
[ActReqSeeMyTstRes ] = {1083,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,TstExa_SelDatesToSeeMyExams ,NULL},
|
||||
[ActSeeMyTstRes ] = {1084,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstExa_ShowMyExams ,NULL},
|
||||
[ActSeeOneTstResMe ] = {1085,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstExa_ShowOneExam ,NULL},
|
||||
[ActReqSeeUsrTstRes ] = {1080,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,TstExa_SelUsrsToViewUsrsExams ,NULL},
|
||||
[ActSeeUsrTstRes ] = {1081,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstExa_GetUsrsAndShowExams ,NULL},
|
||||
[ActSeeOneTstResOth ] = {1082,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstExa_ShowOneExam ,NULL},
|
||||
|
||||
[ActSeeGam ] = {1650,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_SeeOneGame ,NULL},
|
||||
|
||||
|
@ -672,16 +672,16 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
[ActAnsMchQstStd ] = {1651,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Mch_GetMatchBeingPlayed ,Mch_ReceiveQuestionAnswer ,NULL},
|
||||
[ActRefMchStd ] = {1782,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_AJAX_RFRESH,Mch_GetMatchBeingPlayed ,Mch_RefreshMatchStd ,NULL},
|
||||
|
||||
[ActSeeMyMchResCrs ] = {1796,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_ShowMyMchResultsInCrs ,NULL},
|
||||
[ActSeeMyMchResGam ] = {1810,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_ShowMyMchResultsInGam ,NULL},
|
||||
[ActSeeMyMchResMch ] = {1812,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_ShowMyMchResultsInMch ,NULL},
|
||||
[ActSeeOneMchResMe ] = {1797,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_ShowOneMchResult ,NULL},
|
||||
[ActSeeMyMchResCrs ] = {1796,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowMyMchResultsInCrs ,NULL},
|
||||
[ActSeeMyMchResGam ] = {1810,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowMyMchResultsInGam ,NULL},
|
||||
[ActSeeMyMchResMch ] = {1812,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowMyMchResultsInMch ,NULL},
|
||||
[ActSeeOneMchResMe ] = {1797,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowOneMchResult ,NULL},
|
||||
|
||||
[ActReqSeeAllMchRes ] = {1798,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_SelUsrsToViewMchResults ,NULL},
|
||||
[ActSeeAllMchResCrs ] = {1799,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_ShowAllMchResultsInCrs ,NULL},
|
||||
[ActSeeAllMchResGam ] = {1811,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_ShowAllMchResultsInGam ,NULL},
|
||||
[ActSeeAllMchResMch ] = {1813,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_ShowAllMchResultsInMch ,NULL},
|
||||
[ActSeeOneMchResOth ] = {1800,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_ShowOneMchResult ,NULL},
|
||||
[ActReqSeeAllMchRes ] = {1798,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_SelUsrsToViewMchResults ,NULL},
|
||||
[ActSeeAllMchResCrs ] = {1799,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowAllMchResultsInCrs ,NULL},
|
||||
[ActSeeAllMchResGam ] = {1811,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowAllMchResultsInGam ,NULL},
|
||||
[ActSeeAllMchResMch ] = {1813,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowAllMchResultsInMch ,NULL},
|
||||
[ActSeeOneMchResOth ] = {1800,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowOneMchResult ,NULL},
|
||||
|
||||
[ActChgVisResMchUsr ] = {1801,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ToggleVisibilResultsMchUsr ,NULL},
|
||||
|
||||
|
|
|
@ -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.157 (2020-04-01)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 19.158 (2020-04-02)"
|
||||
#define CSS_FILE "swad19.146.css"
|
||||
#define JS_FILE "swad19.153.js"
|
||||
/*
|
||||
|
@ -522,11 +522,19 @@ Param
|
|||
// TODO: En la lista de conectados central, poner el logo de la institución a la que pertenece el usuario
|
||||
// TODO: Miguel Damas: al principio de los exámenes tendría que poner cuánto resta cada pregunta
|
||||
// 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
|
||||
// TODO: Tener en cuenta en los resultados de test (exámenes) el tiempo de inicio y el tiempo de fin
|
||||
Cuando el alumno ve un test, se crea un examen (en la base de datos), aunque no se conteste, a partir de los datos del formulario.
|
||||
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.
|
||||
// TODO: Los exámenes de test que no se han confirmado
|
||||
deben aparecer en la base de datos con un código especial,
|
||||
no contando en la nota y no mostrándose la fecha de finalización.
|
||||
El botón de confirmar envío de examen debería ser verde.
|
||||
|
||||
Version 19.158: Apr 02, 2020 Lot of code refactoring in tests. (285031 lines)
|
||||
5 changes necessary in database:
|
||||
ALTER TABLE tst_exams RENAME INDEX TstCod TO ExaCod;
|
||||
ALTER TABLE tst_exams CHANGE COLUMN TstCod ExaCod INT NOT NULL AUTO_INCREMENT;
|
||||
|
||||
DROP INDEX TstCod ON tst_exam_questions;
|
||||
ALTER TABLE tst_exam_questions CHANGE COLUMN TstCod ExaCod INT NOT NULL;
|
||||
ALTER TABLE tst_exam_questions ADD UNIQUE INDEX(ExaCod,QstCod);
|
||||
|
||||
Version 19.157: Apr 01, 2020 Code refactoring in tests.
|
||||
Test exam is stored in database when it's generated. Not tested. (285023 lines)
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "swad_HTML.h"
|
||||
#include "swad_info.h"
|
||||
#include "swad_logo.h"
|
||||
#include "swad_test_exam.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** External global variables from others modules ****************/
|
||||
|
@ -1891,7 +1892,7 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
|
|||
Svy_RemoveSurveys (Hie_CRS,CrsCod);
|
||||
|
||||
/***** Remove all test exams made in the course *****/
|
||||
TsR_RemoveCrsTestResults (CrsCod);
|
||||
TstExa_RemoveCrsExams (CrsCod);
|
||||
|
||||
/***** Remove all tests questions in the course *****/
|
||||
Tst_RemoveCrsTests (CrsCod);
|
||||
|
|
|
@ -1465,7 +1465,7 @@ mysql> DESCRIBE mch_indexes;
|
|||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS mch_indexes ("
|
||||
"MchCod INT NOT NULL,"
|
||||
"QstInd INT NOT NULL,"
|
||||
"Indexes TEXT NOT NULL," // Tst_MAX_BYTES_INDEXES_ONE_QST
|
||||
"Indexes TEXT NOT NULL," // TstExa_MAX_BYTES_INDEXES_ONE_QST
|
||||
"UNIQUE INDEX(MchCod,QstInd))");
|
||||
|
||||
/***** Table mch_results *****/
|
||||
|
@ -2768,8 +2768,8 @@ mysql> DESCRIBE tst_exam_questions;
|
|||
+---------+---------+------+-----+---------+-------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+---------+---------+------+-----+---------+-------+
|
||||
| TstCod | int(11) | NO | MUL | NULL | |
|
||||
| QstCod | int(11) | NO | | NULL | |
|
||||
| ExaCod | int(11) | NO | PRI | NULL | |
|
||||
| QstCod | int(11) | NO | PRI | NULL | |
|
||||
| QstInd | int(11) | NO | | NULL | |
|
||||
| Score | double | NO | | 0 | |
|
||||
| Indexes | text | NO | | NULL | |
|
||||
|
@ -2778,13 +2778,13 @@ mysql> DESCRIBE tst_exam_questions;
|
|||
6 rows in set (0.00 sec)
|
||||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tst_exam_questions ("
|
||||
"TstCod INT NOT NULL,"
|
||||
"ExaCod INT NOT NULL,"
|
||||
"QstCod INT NOT NULL,"
|
||||
"QstInd INT NOT NULL,"
|
||||
"Score DOUBLE PRECISION NOT NULL DEFAULT 0,"
|
||||
"Indexes TEXT NOT NULL," // Tst_MAX_BYTES_INDEXES_ONE_QST
|
||||
"Answers TEXT NOT NULL," // Tst_MAX_BYTES_ANSWERS_ONE_QST
|
||||
"INDEX(TstCod,QstCod))");
|
||||
"Indexes TEXT NOT NULL," // TstExa_MAX_BYTES_INDEXES_ONE_QST
|
||||
"Answers TEXT NOT NULL," // TstExa_MAX_BYTES_ANSWERS_ONE_QST
|
||||
"UNIQUE INDEX(ExaCod,QstCod))");
|
||||
|
||||
/***** Table tst_exams *****/
|
||||
/*
|
||||
|
@ -2792,7 +2792,7 @@ mysql> DESCRIBE tst_exams;
|
|||
+-----------------+---------------+------+-----+---------+----------------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+-----------------+---------------+------+-----+---------+----------------+
|
||||
| TstCod | int(11) | NO | PRI | NULL | auto_increment |
|
||||
| ExaCod | int(11) | NO | PRI | NULL | auto_increment |
|
||||
| CrsCod | int(11) | NO | MUL | NULL | |
|
||||
| UsrCod | int(11) | NO | | NULL | |
|
||||
| StartTime | datetime | NO | | NULL | |
|
||||
|
@ -2805,7 +2805,7 @@ mysql> DESCRIBE tst_exams;
|
|||
9 rows in set (0.00 sec)
|
||||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tst_exams ("
|
||||
"TstCod INT NOT NULL AUTO_INCREMENT,"
|
||||
"ExaCod INT NOT NULL AUTO_INCREMENT,"
|
||||
"CrsCod INT NOT NULL,"
|
||||
"UsrCod INT NOT NULL,"
|
||||
"StartTime DATETIME NOT NULL,"
|
||||
|
@ -2814,7 +2814,7 @@ mysql> DESCRIBE tst_exams;
|
|||
"NumQstsNotBlank INT NOT NULL DEFAULT 0,"
|
||||
"AllowTeachers ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||
"Score DOUBLE PRECISION NOT NULL DEFAULT 0,"
|
||||
"UNIQUE INDEX(TstCod),"
|
||||
"UNIQUE INDEX(ExaCod),"
|
||||
"INDEX(CrsCod,UsrCod))");
|
||||
|
||||
/***** Table tst_question_tags *****/
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "swad_notification.h"
|
||||
#include "swad_parameter.h"
|
||||
#include "swad_role.h"
|
||||
#include "swad_test_exam.h"
|
||||
#include "swad_user.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -4112,7 +4113,7 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,
|
|||
Brw_RemoveSomeInfoAboutCrsUsrFilesFromDB (UsrDat->UsrCod,Crs->CrsCod);
|
||||
|
||||
/***** Remove test results made by user in course *****/
|
||||
TsR_RemoveTestResultsMadeByUsrInCrs (UsrDat->UsrCod,Crs->CrsCod);
|
||||
TstExa_RemoveExamsMadeByUsrInCrs (UsrDat->UsrCod,Crs->CrsCod);
|
||||
|
||||
/***** Set all the notifications for this user in this course as removed,
|
||||
except notifications about new messages *****/
|
||||
|
|
14
swad_game.c
14
swad_game.c
|
@ -541,7 +541,7 @@ static void Gam_ShowOneGame (struct Game *Game,bool ShowOnlyThisGame)
|
|||
HTM_Double (Game->MaxGrade);
|
||||
HTM_BR ();
|
||||
HTM_TxtColonNBSP (Txt_Result_visibility);
|
||||
TsV_ShowVisibilityIcons (Game->Visibility,Game->Hidden);
|
||||
TstVis_ShowVisibilityIcons (Game->Visibility,Game->Hidden);
|
||||
HTM_DIV_End ();
|
||||
|
||||
/***** Number of matches in game *****/
|
||||
|
@ -619,13 +619,13 @@ static void Gam_PutIconToShowResultsOfGame (void *Args)
|
|||
switch (Gbl.Usrs.Me.Role.Logged)
|
||||
{
|
||||
case Rol_STD:
|
||||
Ico_PutContextualIconToShowResults (ActSeeMyMchResGam,McR_RESULTS_BOX_ID,
|
||||
Ico_PutContextualIconToShowResults (ActSeeMyMchResGam,MchRes_RESULTS_BOX_ID,
|
||||
Gam_PutParams,&Gbl);
|
||||
break;
|
||||
case Rol_NET:
|
||||
case Rol_TCH:
|
||||
case Rol_SYS_ADM:
|
||||
Ico_PutContextualIconToShowResults (ActSeeAllMchResGam,McR_RESULTS_BOX_ID,
|
||||
Ico_PutContextualIconToShowResults (ActSeeAllMchResGam,MchRes_RESULTS_BOX_ID,
|
||||
Gam_PutParams,&Gbl);
|
||||
break;
|
||||
default:
|
||||
|
@ -990,7 +990,7 @@ void Gam_GetDataOfGameByCod (struct Game *Game)
|
|||
Game->MaxGrade = 0.0;
|
||||
|
||||
/* Get visibility (row[5]) */
|
||||
Game->Visibility = TsV_GetVisibilityFromStr (row[5]);
|
||||
Game->Visibility = TstVis_GetVisibilityFromStr (row[5]);
|
||||
|
||||
/* Get the title of the game (row[6]) */
|
||||
Str_Copy (Game->Title,row[6],
|
||||
|
@ -1054,7 +1054,7 @@ static void Gam_ResetGame (struct Game *Game)
|
|||
Game->CrsCod = -1L;
|
||||
Game->UsrCod = -1L;
|
||||
Game->MaxGrade = Gam_MAX_GRADE_DEFAULT;
|
||||
Game->Visibility = TsV_VISIBILITY_DEFAULT;
|
||||
Game->Visibility = TstVis_VISIBILITY_DEFAULT;
|
||||
Game->TimeUTC[Dat_START_TIME] = (time_t) 0;
|
||||
Game->TimeUTC[Dat_END_TIME ] = (time_t) 0;
|
||||
Game->Title[0] = '\0';
|
||||
|
@ -1403,7 +1403,7 @@ static void Gam_PutFormsEditionGame (struct Game *Game,
|
|||
HTM_TD_End ();
|
||||
|
||||
HTM_TD_Begin ("class=\"LB\"");
|
||||
TsV_PutVisibilityCheckboxes (Game->Visibility);
|
||||
TstVis_PutVisibilityCheckboxes (Game->Visibility);
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
|
@ -1503,7 +1503,7 @@ static void Gam_ReceiveGameFieldsFromForm (struct Game *Game,
|
|||
Game->MaxGrade = 0.0;
|
||||
|
||||
/***** Get visibility *****/
|
||||
Game->Visibility = TsV_GetVisibilityFromForm ();
|
||||
Game->Visibility = TstVis_GetVisibilityFromForm ();
|
||||
|
||||
/***** Get game text *****/
|
||||
Par_GetParToHTML ("Txt",Txt,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
|
||||
|
|
26
swad_match.c
26
swad_match.c
|
@ -222,7 +222,7 @@ static void Mch_GetNumPlayers (struct Match *Match);
|
|||
|
||||
static void Mch_RemoveMyAnswerToMatchQuestion (const struct Match *Match);
|
||||
|
||||
static void Mch_ComputeScore (struct TsR_Result *Result);
|
||||
static void Mch_ComputeScore (struct TstExa_Exam *Result);
|
||||
|
||||
static unsigned Mch_GetNumUsrsWhoHaveAnswerMch (long MchCod);
|
||||
|
||||
|
@ -784,7 +784,7 @@ static void Mch_ListOneOrMoreMatchesResultStd (const struct Match *Match)
|
|||
/* Result is visible by me */
|
||||
Gam_SetCurrentGamCod (Match->GamCod); // Used to pass parameter
|
||||
Mch_SetCurrentMchCod (Match->MchCod); // Used to pass parameter
|
||||
Lay_PutContextualLinkOnlyIcon (ActSeeMyMchResMch,McR_RESULTS_BOX_ID,
|
||||
Lay_PutContextualLinkOnlyIcon (ActSeeMyMchResMch,MchRes_RESULTS_BOX_ID,
|
||||
Mch_PutParamsEdit,&Gbl,
|
||||
"trophy.svg",
|
||||
Txt_Results);
|
||||
|
@ -807,7 +807,7 @@ static void Mch_ListOneOrMoreMatchesResultTch (const struct Match *Match)
|
|||
Mch_SetCurrentMchCod (Match->MchCod); // Used to pass parameter
|
||||
|
||||
/* Show match results */
|
||||
Lay_PutContextualLinkOnlyIcon (ActSeeAllMchResMch,McR_RESULTS_BOX_ID,
|
||||
Lay_PutContextualLinkOnlyIcon (ActSeeAllMchResMch,MchRes_RESULTS_BOX_ID,
|
||||
Mch_PutParamsEdit,&Gbl,
|
||||
"trophy.svg",
|
||||
Txt_Results);
|
||||
|
@ -1541,7 +1541,7 @@ static void Mch_ReorderAnswer (long MchCod,unsigned QstInd,
|
|||
long LongNum;
|
||||
unsigned AnsInd;
|
||||
char StrOneAnswer[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
||||
char StrAnswersOneQst[Tst_MAX_BYTES_ANSWERS_ONE_QST + 1];
|
||||
char StrAnswersOneQst[TstExa_MAX_BYTES_ANSWERS_ONE_QST + 1];
|
||||
|
||||
/***** Initialize list of answers to empty string *****/
|
||||
StrAnswersOneQst[0] = '\0';
|
||||
|
@ -1574,9 +1574,9 @@ static void Mch_ReorderAnswer (long MchCod,unsigned QstInd,
|
|||
/* Concatenate answer index to list of answers */
|
||||
if (NumAns)
|
||||
Str_Concat (StrAnswersOneQst,",",
|
||||
Tst_MAX_BYTES_ANSWERS_ONE_QST);
|
||||
TstExa_MAX_BYTES_ANSWERS_ONE_QST);
|
||||
Str_Concat (StrAnswersOneQst,StrOneAnswer,
|
||||
Tst_MAX_BYTES_ANSWERS_ONE_QST);
|
||||
TstExa_MAX_BYTES_ANSWERS_ONE_QST);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -1600,7 +1600,7 @@ void Mch_GetIndexes (long MchCod,unsigned QstInd,
|
|||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
char StrIndexesOneQst[Tst_MAX_BYTES_INDEXES_ONE_QST + 1];
|
||||
char StrIndexesOneQst[TstExa_MAX_BYTES_INDEXES_ONE_QST + 1];
|
||||
|
||||
/***** Get indexes for a question from database *****/
|
||||
if (!DB_QuerySELECT (&mysql_res,"can not get data of a question",
|
||||
|
@ -1613,14 +1613,14 @@ void Mch_GetIndexes (long MchCod,unsigned QstInd,
|
|||
|
||||
/* Get indexes (row[0]) */
|
||||
Str_Copy (StrIndexesOneQst,row[0],
|
||||
Tst_MAX_BYTES_INDEXES_ONE_QST);
|
||||
TstExa_MAX_BYTES_INDEXES_ONE_QST);
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
/***** Get indexes from string *****/
|
||||
Par_ReplaceCommaBySeparatorMultiple (StrIndexesOneQst);
|
||||
Tst_GetIndexesFromStr (StrIndexesOneQst,Indexes);
|
||||
TstExa_GetIndexesFromStr (StrIndexesOneQst,Indexes);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -3834,7 +3834,7 @@ void Mch_ReceiveQuestionAnswer (void)
|
|||
unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION];
|
||||
struct Mch_UsrAnswer PreviousUsrAnswer;
|
||||
struct Mch_UsrAnswer UsrAnswer;
|
||||
struct TsR_Result Result;
|
||||
struct TstExa_Exam Result;
|
||||
|
||||
/***** Get data of the match from database *****/
|
||||
Match.MchCod = Gbl.Games.MchCodBeingPlayed;
|
||||
|
@ -3889,7 +3889,7 @@ void Mch_ReceiveQuestionAnswer (void)
|
|||
UsrAnswer.AnsInd);
|
||||
|
||||
/***** Update student's match result *****/
|
||||
McR_GetMatchResultQuestionsFromDB (Match.MchCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
MchRes_GetMatchResultQuestionsFromDB (Match.MchCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
&Result);
|
||||
Mch_ComputeScore (&Result);
|
||||
|
||||
|
@ -3952,7 +3952,7 @@ static void Mch_RemoveMyAnswerToMatchQuestion (const struct Match *Match)
|
|||
/******************** Compute match score for a student **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Mch_ComputeScore (struct TsR_Result *Result)
|
||||
static void Mch_ComputeScore (struct TstExa_Exam *Result)
|
||||
{
|
||||
unsigned NumQst;
|
||||
struct Tst_Question Question;
|
||||
|
@ -3967,7 +3967,7 @@ static void Mch_ComputeScore (struct TsR_Result *Result)
|
|||
Question.Answer.Type = Tst_ANS_UNIQUE_CHOICE;
|
||||
|
||||
/***** Compute score for this answer ******/
|
||||
Tst_ComputeChoiceAnsScore (Result,NumQst,&Question);
|
||||
TstExa_ComputeChoiceAnsScore (Result,NumQst,&Question);
|
||||
|
||||
/***** Update total score *****/
|
||||
Result->Score += Result->Questions[NumQst].Score;
|
||||
|
|
|
@ -70,41 +70,41 @@ extern struct Globals Gbl;
|
|||
/***************************** Private prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void McR_ListMyMchResultsInCrs (void);
|
||||
static void McR_ListMyMchResultsInGam (long GamCod);
|
||||
static void McR_ListMyMchResultsInMch (long MchCod);
|
||||
static void McR_ShowAllMchResultsInSelectedGames (void);
|
||||
static void McR_ListAllMchResultsInSelectedGames (void);
|
||||
static void McR_ListAllMchResultsInGam (long GamCod);
|
||||
static void McR_ListAllMchResultsInMch (long MchCod);
|
||||
static void MchRes_ListMyMchResultsInCrs (void);
|
||||
static void MchRes_ListMyMchResultsInGam (long GamCod);
|
||||
static void MchRes_ListMyMchResultsInMch (long MchCod);
|
||||
static void MchRes_ShowAllMchResultsInSelectedGames (void);
|
||||
static void MchRes_ListAllMchResultsInSelectedGames (void);
|
||||
static void MchRes_ListAllMchResultsInGam (long GamCod);
|
||||
static void MchRes_ListAllMchResultsInMch (long MchCod);
|
||||
|
||||
static void McR_ShowResultsBegin (const char *Title,bool ListGamesToSelect);
|
||||
static void McR_ShowResultsEnd (void);
|
||||
static void MchRes_ShowResultsBegin (const char *Title,bool ListGamesToSelect);
|
||||
static void MchRes_ShowResultsEnd (void);
|
||||
|
||||
static void McR_ListGamesToSelect (void);
|
||||
static void McR_ShowHeaderMchResults (Usr_MeOrOther_t MeOrOther);
|
||||
static void MchRes_ListGamesToSelect (void);
|
||||
static void MchRes_ShowHeaderMchResults (Usr_MeOrOther_t MeOrOther);
|
||||
|
||||
static void McR_BuildGamesSelectedCommas (char **GamesSelectedCommas);
|
||||
static void McR_ShowMchResults (Usr_MeOrOther_t MeOrOther,
|
||||
static void MchRes_BuildGamesSelectedCommas (char **GamesSelectedCommas);
|
||||
static void MchRes_ShowMchResults (Usr_MeOrOther_t MeOrOther,
|
||||
long MchCod, // <= 0 ==> any
|
||||
long GamCod, // <= 0 ==> any
|
||||
const char *GamesSelectedCommas);
|
||||
static void McR_ShowMchResultsSummaryRow (unsigned NumResults,
|
||||
static void MchRes_ShowMchResultsSummaryRow (unsigned NumResults,
|
||||
unsigned NumTotalQsts,
|
||||
unsigned NumTotalQstsNotBlank,
|
||||
double TotalScoreOfAllResults,
|
||||
double TotalGrade);
|
||||
static void McR_GetMatchResultDataByMchCod (long MchCod,long UsrCod,
|
||||
struct TsR_Result *Result);
|
||||
static void MchRes_GetMatchResultDataByMchCod (long MchCod,long UsrCod,
|
||||
struct TstExa_Exam *Exam);
|
||||
|
||||
static bool McR_CheckIfICanSeeMatchResult (struct Match *Match,long UsrCod);
|
||||
static bool McR_CheckIfICanViewScore (bool ICanViewResult,unsigned Visibility);
|
||||
static bool MchRes_CheckIfICanSeeMatchResult (struct Match *Match,long UsrCod);
|
||||
static bool MchRes_CheckIfICanViewScore (bool ICanViewResult,unsigned Visibility);
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********** Select users and dates to show their matches results ************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void McR_SelUsrsToViewMchResults (void)
|
||||
void MchRes_SelUsrsToViewMchResults (void)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Games_results;
|
||||
extern const char *Txt_Results;
|
||||
|
@ -123,7 +123,7 @@ void McR_SelUsrsToViewMchResults (void)
|
|||
/*************************** Show my matches results *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void McR_ShowMyMchResultsInCrs (void)
|
||||
void MchRes_ShowMyMchResultsInCrs (void)
|
||||
{
|
||||
extern const char *Txt_Results;
|
||||
|
||||
|
@ -132,26 +132,26 @@ void McR_ShowMyMchResultsInCrs (void)
|
|||
Gam_GetListSelectedGamCods ();
|
||||
|
||||
/***** List my matches results in the current course *****/
|
||||
McR_ShowResultsBegin (Txt_Results,true); // List games to select
|
||||
McR_ListMyMchResultsInCrs ();
|
||||
McR_ShowResultsEnd ();
|
||||
MchRes_ShowResultsBegin (Txt_Results,true); // List games to select
|
||||
MchRes_ListMyMchResultsInCrs ();
|
||||
MchRes_ShowResultsEnd ();
|
||||
|
||||
/***** Free list of games *****/
|
||||
free (Gbl.Games.GamCodsSelected);
|
||||
Gam_FreeListGames ();
|
||||
}
|
||||
|
||||
static void McR_ListMyMchResultsInCrs (void)
|
||||
static void MchRes_ListMyMchResultsInCrs (void)
|
||||
{
|
||||
char *GamesSelectedCommas = NULL; // Initialized to avoid warning
|
||||
|
||||
/***** Table header *****/
|
||||
McR_ShowHeaderMchResults (Usr_ME);
|
||||
MchRes_ShowHeaderMchResults (Usr_ME);
|
||||
|
||||
/***** List my matches results in the current course *****/
|
||||
TstCfg_GetConfigFromDB (); // Get feedback type
|
||||
McR_BuildGamesSelectedCommas (&GamesSelectedCommas);
|
||||
McR_ShowMchResults (Usr_ME,-1L,-1L,GamesSelectedCommas);
|
||||
MchRes_BuildGamesSelectedCommas (&GamesSelectedCommas);
|
||||
MchRes_ShowMchResults (Usr_ME,-1L,-1L,GamesSelectedCommas);
|
||||
free (GamesSelectedCommas);
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ static void McR_ListMyMchResultsInCrs (void)
|
|||
/***************** Show my matches results in a given game *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void McR_ShowMyMchResultsInGam (void)
|
||||
void MchRes_ShowMyMchResultsInGam (void)
|
||||
{
|
||||
extern const char *Txt_Results_of_game_X;
|
||||
struct Game Game;
|
||||
|
@ -175,31 +175,31 @@ void McR_ShowMyMchResultsInGam (void)
|
|||
false); // Do not put form to start new match
|
||||
|
||||
/***** List my matches results in game *****/
|
||||
McR_ShowResultsBegin (Str_BuildStringStr (Txt_Results_of_game_X,Game.Title),
|
||||
MchRes_ShowResultsBegin (Str_BuildStringStr (Txt_Results_of_game_X,Game.Title),
|
||||
false); // Do not list games to select
|
||||
Str_FreeString ();
|
||||
McR_ListMyMchResultsInGam (Game.GamCod);
|
||||
McR_ShowResultsEnd ();
|
||||
MchRes_ListMyMchResultsInGam (Game.GamCod);
|
||||
MchRes_ShowResultsEnd ();
|
||||
|
||||
/***** Game end *****/
|
||||
Gam_ShowOnlyOneGameEnd ();
|
||||
}
|
||||
|
||||
static void McR_ListMyMchResultsInGam (long GamCod)
|
||||
static void MchRes_ListMyMchResultsInGam (long GamCod)
|
||||
{
|
||||
/***** Table header *****/
|
||||
McR_ShowHeaderMchResults (Usr_ME);
|
||||
MchRes_ShowHeaderMchResults (Usr_ME);
|
||||
|
||||
/***** List my matches results in game *****/
|
||||
TstCfg_GetConfigFromDB (); // Get feedback type
|
||||
McR_ShowMchResults (Usr_ME,-1L,GamCod,NULL);
|
||||
MchRes_ShowMchResults (Usr_ME,-1L,GamCod,NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Show my matches results in a given match ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void McR_ShowMyMchResultsInMch (void)
|
||||
void MchRes_ShowMyMchResultsInMch (void)
|
||||
{
|
||||
extern const char *Txt_Results_of_match_X;
|
||||
struct Game Game;
|
||||
|
@ -219,42 +219,42 @@ void McR_ShowMyMchResultsInMch (void)
|
|||
false); // Do not put form to start new match
|
||||
|
||||
/***** List my matches results in match *****/
|
||||
McR_ShowResultsBegin (Str_BuildStringStr (Txt_Results_of_match_X,Match.Title),
|
||||
MchRes_ShowResultsBegin (Str_BuildStringStr (Txt_Results_of_match_X,Match.Title),
|
||||
false); // Do not list games to select
|
||||
Str_FreeString ();
|
||||
McR_ListMyMchResultsInMch (Match.MchCod);
|
||||
McR_ShowResultsEnd ();
|
||||
MchRes_ListMyMchResultsInMch (Match.MchCod);
|
||||
MchRes_ShowResultsEnd ();
|
||||
|
||||
/***** Game end *****/
|
||||
Gam_ShowOnlyOneGameEnd ();
|
||||
}
|
||||
|
||||
static void McR_ListMyMchResultsInMch (long MchCod)
|
||||
static void MchRes_ListMyMchResultsInMch (long MchCod)
|
||||
{
|
||||
/***** Table header *****/
|
||||
McR_ShowHeaderMchResults (Usr_ME);
|
||||
MchRes_ShowHeaderMchResults (Usr_ME);
|
||||
|
||||
/***** List my matches results in game *****/
|
||||
TstCfg_GetConfigFromDB (); // Get feedback type
|
||||
McR_ShowMchResults (Usr_ME,MchCod,-1L,NULL);
|
||||
MchRes_ShowMchResults (Usr_ME,MchCod,-1L,NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Get users and show their matches results *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void McR_ShowAllMchResultsInCrs (void)
|
||||
void MchRes_ShowAllMchResultsInCrs (void)
|
||||
{
|
||||
Usr_GetSelectedUsrsAndGoToAct (&Gbl.Usrs.Selected,
|
||||
McR_ShowAllMchResultsInSelectedGames,
|
||||
McR_SelUsrsToViewMchResults);
|
||||
MchRes_ShowAllMchResultsInSelectedGames,
|
||||
MchRes_SelUsrsToViewMchResults);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Show matches results for several users *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void McR_ShowAllMchResultsInSelectedGames (void)
|
||||
static void MchRes_ShowAllMchResultsInSelectedGames (void)
|
||||
{
|
||||
extern const char *Txt_Results;
|
||||
|
||||
|
@ -263,25 +263,25 @@ static void McR_ShowAllMchResultsInSelectedGames (void)
|
|||
Gam_GetListSelectedGamCods ();
|
||||
|
||||
/***** List the matches results of the selected users *****/
|
||||
McR_ShowResultsBegin (Txt_Results,true); // List games to select
|
||||
McR_ListAllMchResultsInSelectedGames ();
|
||||
McR_ShowResultsEnd ();
|
||||
MchRes_ShowResultsBegin (Txt_Results,true); // List games to select
|
||||
MchRes_ListAllMchResultsInSelectedGames ();
|
||||
MchRes_ShowResultsEnd ();
|
||||
|
||||
/***** Free list of games *****/
|
||||
free (Gbl.Games.GamCodsSelected);
|
||||
Gam_FreeListGames ();
|
||||
}
|
||||
|
||||
static void McR_ListAllMchResultsInSelectedGames (void)
|
||||
static void MchRes_ListAllMchResultsInSelectedGames (void)
|
||||
{
|
||||
char *GamesSelectedCommas = NULL; // Initialized to avoid warning
|
||||
const char *Ptr;
|
||||
|
||||
/***** Table head *****/
|
||||
McR_ShowHeaderMchResults (Usr_OTHER);
|
||||
MchRes_ShowHeaderMchResults (Usr_OTHER);
|
||||
|
||||
/***** List the matches results of the selected users *****/
|
||||
McR_BuildGamesSelectedCommas (&GamesSelectedCommas);
|
||||
MchRes_BuildGamesSelectedCommas (&GamesSelectedCommas);
|
||||
Ptr = Gbl.Usrs.Selected.List[Rol_UNK];
|
||||
while (*Ptr)
|
||||
{
|
||||
|
@ -293,7 +293,7 @@ static void McR_ListAllMchResultsInSelectedGames (void)
|
|||
{
|
||||
/***** Show matches results *****/
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
||||
McR_ShowMchResults (Usr_OTHER,-1L,-1L,GamesSelectedCommas);
|
||||
MchRes_ShowMchResults (Usr_OTHER,-1L,-1L,GamesSelectedCommas);
|
||||
}
|
||||
}
|
||||
free (GamesSelectedCommas);
|
||||
|
@ -303,7 +303,7 @@ static void McR_ListAllMchResultsInSelectedGames (void)
|
|||
/*** Show matches results of a game for the users who answered in that game **/
|
||||
/*****************************************************************************/
|
||||
|
||||
void McR_ShowAllMchResultsInGam (void)
|
||||
void MchRes_ShowAllMchResultsInGam (void)
|
||||
{
|
||||
extern const char *Txt_Results_of_game_X;
|
||||
struct Game Game;
|
||||
|
@ -319,17 +319,17 @@ void McR_ShowAllMchResultsInGam (void)
|
|||
false); // Do not put form to start new match
|
||||
|
||||
/***** List matches results in game *****/
|
||||
McR_ShowResultsBegin (Str_BuildStringStr (Txt_Results_of_game_X,Game.Title),
|
||||
MchRes_ShowResultsBegin (Str_BuildStringStr (Txt_Results_of_game_X,Game.Title),
|
||||
false); // Do not list games to select
|
||||
Str_FreeString ();
|
||||
McR_ListAllMchResultsInGam (Game.GamCod);
|
||||
McR_ShowResultsEnd ();
|
||||
MchRes_ListAllMchResultsInGam (Game.GamCod);
|
||||
MchRes_ShowResultsEnd ();
|
||||
|
||||
/***** Game end *****/
|
||||
Gam_ShowOnlyOneGameEnd ();
|
||||
}
|
||||
|
||||
static void McR_ListAllMchResultsInGam (long GamCod)
|
||||
static void MchRes_ListAllMchResultsInGam (long GamCod)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
|
@ -337,7 +337,7 @@ static void McR_ListAllMchResultsInGam (long GamCod)
|
|||
unsigned long NumUsr;
|
||||
|
||||
/***** Table head *****/
|
||||
McR_ShowHeaderMchResults (Usr_OTHER);
|
||||
MchRes_ShowHeaderMchResults (Usr_OTHER);
|
||||
|
||||
/***** Get all users who have answered any match question in this game *****/
|
||||
NumUsrs = DB_QuerySELECT (&mysql_res,"can not get users in game",
|
||||
|
@ -371,7 +371,7 @@ static void McR_ListAllMchResultsInGam (long GamCod)
|
|||
{
|
||||
/***** Show matches results *****/
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
||||
McR_ShowMchResults (Usr_OTHER,-1L,GamCod,NULL);
|
||||
MchRes_ShowMchResults (Usr_OTHER,-1L,GamCod,NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ static void McR_ListAllMchResultsInGam (long GamCod)
|
|||
/** Show matches results of a match for the users who answered in that match */
|
||||
/*****************************************************************************/
|
||||
|
||||
void McR_ShowAllMchResultsInMch (void)
|
||||
void MchRes_ShowAllMchResultsInMch (void)
|
||||
{
|
||||
extern const char *Txt_Results_of_match_X;
|
||||
struct Game Game;
|
||||
|
@ -404,17 +404,17 @@ void McR_ShowAllMchResultsInMch (void)
|
|||
false); // Do not put form to start new match
|
||||
|
||||
/***** List matches results in match *****/
|
||||
McR_ShowResultsBegin (Str_BuildStringStr (Txt_Results_of_match_X,Match.Title),
|
||||
MchRes_ShowResultsBegin (Str_BuildStringStr (Txt_Results_of_match_X,Match.Title),
|
||||
false); // Do not list games to select
|
||||
Str_FreeString ();
|
||||
McR_ListAllMchResultsInMch (Match.MchCod);
|
||||
McR_ShowResultsEnd ();
|
||||
MchRes_ListAllMchResultsInMch (Match.MchCod);
|
||||
MchRes_ShowResultsEnd ();
|
||||
|
||||
/***** Game end *****/
|
||||
Gam_ShowOnlyOneGameEnd ();
|
||||
}
|
||||
|
||||
static void McR_ListAllMchResultsInMch (long MchCod)
|
||||
static void MchRes_ListAllMchResultsInMch (long MchCod)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
|
@ -422,7 +422,7 @@ static void McR_ListAllMchResultsInMch (long MchCod)
|
|||
unsigned long NumUsr;
|
||||
|
||||
/***** Table head *****/
|
||||
McR_ShowHeaderMchResults (Usr_OTHER);
|
||||
MchRes_ShowHeaderMchResults (Usr_OTHER);
|
||||
|
||||
/***** Get all users who have answered any match question in this game *****/
|
||||
NumUsrs = DB_QuerySELECT (&mysql_res,"can not get users in match",
|
||||
|
@ -456,7 +456,7 @@ static void McR_ListAllMchResultsInMch (long MchCod)
|
|||
{
|
||||
/***** Show matches results *****/
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
||||
McR_ShowMchResults (Usr_OTHER,MchCod,-1L,NULL);
|
||||
MchRes_ShowMchResults (Usr_OTHER,MchCod,-1L,NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -469,26 +469,26 @@ static void McR_ListAllMchResultsInMch (long MchCod)
|
|||
/************************ Show results (begin / end) *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void McR_ShowResultsBegin (const char *Title,bool ListGamesToSelect)
|
||||
static void MchRes_ShowResultsBegin (const char *Title,bool ListGamesToSelect)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Games_results;
|
||||
|
||||
/***** Begin box *****/
|
||||
HTM_SECTION_Begin (McR_RESULTS_BOX_ID);
|
||||
HTM_SECTION_Begin (MchRes_RESULTS_BOX_ID);
|
||||
Box_BoxBegin ("100%",Title,
|
||||
NULL,NULL,
|
||||
Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE);
|
||||
|
||||
/***** List games to select *****/
|
||||
if (ListGamesToSelect)
|
||||
McR_ListGamesToSelect ();
|
||||
MchRes_ListGamesToSelect ();
|
||||
|
||||
/***** Begin match results table *****/
|
||||
HTM_SECTION_Begin (McR_RESULTS_TABLE_ID);
|
||||
HTM_SECTION_Begin (MchRes_RESULTS_TABLE_ID);
|
||||
HTM_TABLE_BeginWidePadding (2);
|
||||
}
|
||||
|
||||
static void McR_ShowResultsEnd (void)
|
||||
static void MchRes_ShowResultsEnd (void)
|
||||
{
|
||||
/***** End match results table *****/
|
||||
HTM_TABLE_End ();
|
||||
|
@ -503,7 +503,7 @@ static void McR_ShowResultsEnd (void)
|
|||
/********** Write list of those attendance events that have students *********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void McR_ListGamesToSelect (void)
|
||||
static void MchRes_ListGamesToSelect (void)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Games_results;
|
||||
extern const char *The_ClassFormLinkInBoxBold[The_NUM_THEMES];
|
||||
|
@ -521,7 +521,7 @@ static void McR_ListGamesToSelect (void)
|
|||
|
||||
/***** Begin form to update the results
|
||||
depending on the games selected *****/
|
||||
Frm_StartFormAnchor (Gbl.Action.Act,McR_RESULTS_TABLE_ID);
|
||||
Frm_StartFormAnchor (Gbl.Action.Act,MchRes_RESULTS_TABLE_ID);
|
||||
Grp_PutParamsCodGrps ();
|
||||
Usr_PutHiddenParSelectedUsrsCods (&Gbl.Usrs.Selected);
|
||||
|
||||
|
@ -596,7 +596,7 @@ static void McR_ListGamesToSelect (void)
|
|||
/********************* Show header of my matches results *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void McR_ShowHeaderMchResults (Usr_MeOrOther_t MeOrOther)
|
||||
static void MchRes_ShowHeaderMchResults (Usr_MeOrOther_t MeOrOther)
|
||||
{
|
||||
extern const char *Txt_User[Usr_NUM_SEXS];
|
||||
extern const char *Txt_Match;
|
||||
|
@ -629,7 +629,7 @@ static void McR_ShowHeaderMchResults (Usr_MeOrOther_t MeOrOther)
|
|||
/******* from list of selected games ********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void McR_BuildGamesSelectedCommas (char **GamesSelectedCommas)
|
||||
static void MchRes_BuildGamesSelectedCommas (char **GamesSelectedCommas)
|
||||
{
|
||||
size_t MaxLength;
|
||||
unsigned NumGame;
|
||||
|
@ -658,7 +658,7 @@ static void McR_BuildGamesSelectedCommas (char **GamesSelectedCommas)
|
|||
/********* Show the matches results of a user in the current course **********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void McR_ShowMchResults (Usr_MeOrOther_t MeOrOther,
|
||||
static void MchRes_ShowMchResults (Usr_MeOrOther_t MeOrOther,
|
||||
long MchCod, // <= 0 ==> any
|
||||
long GamCod, // <= 0 ==> any
|
||||
const char *GamesSelectedCommas)
|
||||
|
@ -776,11 +776,11 @@ static void McR_ShowMchResults (Usr_MeOrOther_t MeOrOther,
|
|||
Mch_GetDataOfMatchByCod (&Match);
|
||||
|
||||
/* Get visibility (row[7]) */
|
||||
Visibility = TsV_GetVisibilityFromStr (row[7]);
|
||||
Visibility = TstVis_GetVisibilityFromStr (row[7]);
|
||||
|
||||
/* Show match result? */
|
||||
ICanViewResult = McR_CheckIfICanSeeMatchResult (&Match,UsrDat->UsrCod);
|
||||
ICanViewScore = McR_CheckIfICanViewScore (ICanViewResult,Visibility);
|
||||
ICanViewResult = MchRes_CheckIfICanSeeMatchResult (&Match,UsrDat->UsrCod);
|
||||
ICanViewScore = MchRes_CheckIfICanViewScore (ICanViewResult,Visibility);
|
||||
|
||||
if (NumResult)
|
||||
HTM_TR_Begin (NULL);
|
||||
|
@ -872,8 +872,8 @@ static void McR_ShowMchResults (Usr_MeOrOther_t MeOrOther,
|
|||
HTM_TD_Begin ("class=\"DAT RT COLOR%u\"",Gbl.RowEvenOdd);
|
||||
if (ICanViewScore)
|
||||
{
|
||||
Grade = Tst_ComputeGrade (NumQstsInThisResult,ScoreInThisResult,MaxGrade);
|
||||
Tst_ShowGrade (Grade,MaxGrade);
|
||||
Grade = TstExa_ComputeGrade (NumQstsInThisResult,ScoreInThisResult,MaxGrade);
|
||||
TstExa_ShowGrade (Grade,MaxGrade);
|
||||
TotalGrade += Grade;
|
||||
}
|
||||
else
|
||||
|
@ -909,7 +909,7 @@ static void McR_ShowMchResults (Usr_MeOrOther_t MeOrOther,
|
|||
}
|
||||
|
||||
/***** Write totals for this user *****/
|
||||
McR_ShowMchResultsSummaryRow (NumResults,
|
||||
MchRes_ShowMchResultsSummaryRow (NumResults,
|
||||
NumTotalQsts,NumTotalQstsNotBlank,
|
||||
TotalScoreOfAllResults,
|
||||
TotalGrade);
|
||||
|
@ -930,7 +930,7 @@ static void McR_ShowMchResults (Usr_MeOrOther_t MeOrOther,
|
|||
/************** Show row with summary of user's matches results **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void McR_ShowMchResultsSummaryRow (unsigned NumResults,
|
||||
static void MchRes_ShowMchResultsSummaryRow (unsigned NumResults,
|
||||
unsigned NumTotalQsts,
|
||||
unsigned NumTotalQstsNotBlank,
|
||||
double TotalScoreOfAllResults,
|
||||
|
@ -988,7 +988,7 @@ static void McR_ShowMchResultsSummaryRow (unsigned NumResults,
|
|||
/******************* Show one match result of another user *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void McR_ShowOneMchResult (void)
|
||||
void MchRes_ShowOneMchResult (void)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Games_results;
|
||||
extern const char *Txt_The_user_does_not_exist;
|
||||
|
@ -1005,7 +1005,7 @@ void McR_ShowOneMchResult (void)
|
|||
struct UsrData *UsrDat;
|
||||
Dat_StartEndTime_t StartEndTime;
|
||||
char *Id;
|
||||
struct TsR_Result Result;
|
||||
struct TstExa_Exam Exam;
|
||||
bool ShowPhoto;
|
||||
char PhotoURL[PATH_MAX + 1];
|
||||
bool ICanViewResult;
|
||||
|
@ -1030,16 +1030,16 @@ void McR_ShowOneMchResult (void)
|
|||
}
|
||||
|
||||
/***** Get match result data *****/
|
||||
McR_GetMatchResultDataByMchCod (Match.MchCod,UsrDat->UsrCod,
|
||||
&Result);
|
||||
MchRes_GetMatchResultDataByMchCod (Match.MchCod,UsrDat->UsrCod,
|
||||
&Exam);
|
||||
|
||||
/***** Check if I can view this match result *****/
|
||||
switch (Gbl.Usrs.Me.Role.Logged)
|
||||
{
|
||||
case Rol_STD:
|
||||
ICanViewResult = McR_CheckIfICanSeeMatchResult (&Match,UsrDat->UsrCod);
|
||||
ICanViewResult = MchRes_CheckIfICanSeeMatchResult (&Match,UsrDat->UsrCod);
|
||||
if (ICanViewResult)
|
||||
ICanViewScore = TsV_IsVisibleTotalScore (Game.Visibility);
|
||||
ICanViewScore = TstVis_IsVisibleTotalScore (Game.Visibility);
|
||||
else
|
||||
ICanViewScore = false;
|
||||
break;
|
||||
|
@ -1061,8 +1061,8 @@ void McR_ShowOneMchResult (void)
|
|||
if (ICanViewResult) // I am allowed to view this match result
|
||||
{
|
||||
/***** Get questions and user's answers of the match result from database *****/
|
||||
McR_GetMatchResultQuestionsFromDB (Match.MchCod,UsrDat->UsrCod,
|
||||
&Result);
|
||||
MchRes_GetMatchResultQuestionsFromDB (Match.MchCod,UsrDat->UsrCod,
|
||||
&Exam);
|
||||
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin (NULL,Match.Title,
|
||||
|
@ -1120,7 +1120,7 @@ void McR_ShowOneMchResult (void)
|
|||
if (asprintf (&Id,"match_%u",(unsigned) StartEndTime) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
HTM_TD_Begin ("id=\"%s\" class=\"DAT LT\"",Id);
|
||||
Dat_WriteLocalDateHMSFromUTC (Id,Result.TimeUTC[StartEndTime],
|
||||
Dat_WriteLocalDateHMSFromUTC (Id,Exam.TimeUTC[StartEndTime],
|
||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA,
|
||||
true,true,true,0x7);
|
||||
HTM_TD_End ();
|
||||
|
@ -1138,8 +1138,8 @@ void McR_ShowOneMchResult (void)
|
|||
|
||||
HTM_TD_Begin ("class=\"DAT LT\"");
|
||||
HTM_TxtF ("%u (%u %s)",
|
||||
Result.NumQsts,
|
||||
Result.NumQstsNotBlank,Txt_non_blank_QUESTIONS);
|
||||
Exam.NumQsts,
|
||||
Exam.NumQstsNotBlank,Txt_non_blank_QUESTIONS);
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
|
@ -1153,7 +1153,7 @@ void McR_ShowOneMchResult (void)
|
|||
|
||||
HTM_TD_Begin ("class=\"DAT LT\"");
|
||||
if (ICanViewScore)
|
||||
HTM_Double2Decimals (Result.Score);
|
||||
HTM_Double2Decimals (Exam.Score);
|
||||
else
|
||||
Ico_PutIconNotVisible ();
|
||||
HTM_TD_End ();
|
||||
|
@ -1169,8 +1169,8 @@ void McR_ShowOneMchResult (void)
|
|||
|
||||
HTM_TD_Begin ("class=\"DAT LT\"");
|
||||
if (ICanViewScore)
|
||||
Tst_ComputeAndShowGrade (Result.NumQsts,
|
||||
Result.Score,
|
||||
TstExa_ComputeAndShowGrade (Exam.NumQsts,
|
||||
Exam.Score,
|
||||
Game.MaxGrade);
|
||||
else
|
||||
Ico_PutIconNotVisible ();
|
||||
|
@ -1192,7 +1192,7 @@ void McR_ShowOneMchResult (void)
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Write answers and solutions *****/
|
||||
TsR_ShowTestResult (UsrDat,&Result,Game.Visibility);
|
||||
TstExa_ShowExamAnswers (UsrDat,&Exam,Game.Visibility);
|
||||
|
||||
/***** End table *****/
|
||||
HTM_TABLE_End ();
|
||||
|
@ -1202,10 +1202,10 @@ void McR_ShowOneMchResult (void)
|
|||
{
|
||||
HTM_DIV_Begin ("class=\"DAT_N_BOLD CM\"");
|
||||
HTM_TxtColonNBSP (Txt_Score);
|
||||
HTM_Double2Decimals (Result.Score);
|
||||
HTM_Double2Decimals (Exam.Score);
|
||||
HTM_BR ();
|
||||
HTM_TxtColonNBSP (Txt_Grade);
|
||||
Tst_ComputeAndShowGrade (Result.NumQsts,Result.Score,Game.MaxGrade);
|
||||
TstExa_ComputeAndShowGrade (Exam.NumQsts,Exam.Score,Game.MaxGrade);
|
||||
HTM_DIV_End ();
|
||||
}
|
||||
|
||||
|
@ -1220,8 +1220,8 @@ void McR_ShowOneMchResult (void)
|
|||
/************ Get the questions of a match result from database **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void McR_GetMatchResultQuestionsFromDB (long MchCod,long UsrCod,
|
||||
struct TsR_Result *Result)
|
||||
void MchRes_GetMatchResultQuestionsFromDB (long MchCod,long UsrCod,
|
||||
struct TstExa_Exam *Exam)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
|
@ -1231,27 +1231,27 @@ void McR_GetMatchResultQuestionsFromDB (long MchCod,long UsrCod,
|
|||
struct Mch_UsrAnswer UsrAnswer;
|
||||
|
||||
/***** Get questions and answers of a match result *****/
|
||||
Result->NumQsts = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get questions and answers"
|
||||
" of a match result",
|
||||
"SELECT gam_questions.QstCod," // row[0]
|
||||
"gam_questions.QstInd," // row[1]
|
||||
"mch_indexes.Indexes" // row[2]
|
||||
" FROM mch_matches,gam_questions,mch_indexes"
|
||||
" WHERE mch_matches.MchCod=%ld"
|
||||
" AND mch_matches.GamCod=gam_questions.GamCod"
|
||||
" AND mch_matches.MchCod=mch_indexes.MchCod"
|
||||
" AND gam_questions.QstInd=mch_indexes.QstInd"
|
||||
" ORDER BY gam_questions.QstInd",
|
||||
MchCod);
|
||||
for (NumQst = 0, Result->NumQstsNotBlank = 0;
|
||||
NumQst < Result->NumQsts;
|
||||
Exam->NumQsts = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get questions and answers"
|
||||
" of a match result",
|
||||
"SELECT gam_questions.QstCod," // row[0]
|
||||
"gam_questions.QstInd," // row[1]
|
||||
"mch_indexes.Indexes" // row[2]
|
||||
" FROM mch_matches,gam_questions,mch_indexes"
|
||||
" WHERE mch_matches.MchCod=%ld"
|
||||
" AND mch_matches.GamCod=gam_questions.GamCod"
|
||||
" AND mch_matches.MchCod=mch_indexes.MchCod"
|
||||
" AND gam_questions.QstInd=mch_indexes.QstInd"
|
||||
" ORDER BY gam_questions.QstInd",
|
||||
MchCod);
|
||||
for (NumQst = 0, Exam->NumQstsNotBlank = 0;
|
||||
NumQst < Exam->NumQsts;
|
||||
NumQst++)
|
||||
{
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get question code (row[0]) */
|
||||
if ((Result->Questions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||
if ((Exam->Questions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
||||
|
||||
/* Get question index (row[1]) */
|
||||
|
@ -1260,24 +1260,24 @@ void McR_GetMatchResultQuestionsFromDB (long MchCod,long UsrCod,
|
|||
QstInd = (unsigned) LongNum;
|
||||
|
||||
/* Get indexes for this question (row[2]) */
|
||||
Str_Copy (Result->Questions[NumQst].StrIndexes,row[2],
|
||||
Tst_MAX_BYTES_INDEXES_ONE_QST);
|
||||
Str_Copy (Exam->Questions[NumQst].StrIndexes,row[2],
|
||||
TstExa_MAX_BYTES_INDEXES_ONE_QST);
|
||||
|
||||
/* Get answers selected by user for this question */
|
||||
Mch_GetQstAnsFromDB (MchCod,UsrCod,QstInd,&UsrAnswer);
|
||||
if (UsrAnswer.AnsInd >= 0) // UsrAnswer.AnsInd >= 0 ==> answer selected
|
||||
{
|
||||
snprintf (Result->Questions[NumQst].StrAnswers,Tst_MAX_BYTES_ANSWERS_ONE_QST + 1,
|
||||
snprintf (Exam->Questions[NumQst].StrAnswers,TstExa_MAX_BYTES_ANSWERS_ONE_QST + 1,
|
||||
"%d",UsrAnswer.AnsInd);
|
||||
Result->NumQstsNotBlank++;
|
||||
Exam->NumQstsNotBlank++;
|
||||
}
|
||||
else // UsrAnswer.AnsInd < 0 ==> no answer selected
|
||||
Result->Questions[NumQst].StrAnswers[0] = '\0'; // Empty answer
|
||||
Exam->Questions[NumQst].StrAnswers[0] = '\0'; // Empty answer
|
||||
|
||||
/* Replace each comma by a separator of multiple parameters */
|
||||
/* In database commas are used as separators instead of special chars */
|
||||
Par_ReplaceCommaBySeparatorMultiple (Result->Questions[NumQst].StrIndexes);
|
||||
Par_ReplaceCommaBySeparatorMultiple (Result->Questions[NumQst].StrAnswers);
|
||||
Par_ReplaceCommaBySeparatorMultiple (Exam->Questions[NumQst].StrIndexes);
|
||||
Par_ReplaceCommaBySeparatorMultiple (Exam->Questions[NumQst].StrAnswers);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -1288,8 +1288,8 @@ void McR_GetMatchResultQuestionsFromDB (long MchCod,long UsrCod,
|
|||
/************* Get data of a match result using its match code ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void McR_GetMatchResultDataByMchCod (long MchCod,long UsrCod,
|
||||
struct TsR_Result *Result)
|
||||
static void MchRes_GetMatchResultDataByMchCod (long MchCod,long UsrCod,
|
||||
struct TstExa_Exam *Exam)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
|
@ -1318,27 +1318,27 @@ static void McR_GetMatchResultDataByMchCod (long MchCod,long UsrCod,
|
|||
for (StartEndTime = (Dat_StartEndTime_t) 0;
|
||||
StartEndTime <= (Dat_StartEndTime_t) (Dat_NUM_START_END_TIME - 1);
|
||||
StartEndTime++)
|
||||
Result->TimeUTC[StartEndTime] = Dat_GetUNIXTimeFromStr (row[StartEndTime]);
|
||||
Exam->TimeUTC[StartEndTime] = Dat_GetUNIXTimeFromStr (row[StartEndTime]);
|
||||
|
||||
/* Get number of questions (row[2]) */
|
||||
if (sscanf (row[2],"%u",&Result->NumQsts) != 1)
|
||||
Result->NumQsts = 0;
|
||||
if (sscanf (row[2],"%u",&Exam->NumQsts) != 1)
|
||||
Exam->NumQsts = 0;
|
||||
|
||||
/* Get number of questions not blank (row[3]) */
|
||||
if (sscanf (row[3],"%u",&Result->NumQstsNotBlank) != 1)
|
||||
Result->NumQstsNotBlank = 0;
|
||||
if (sscanf (row[3],"%u",&Exam->NumQstsNotBlank) != 1)
|
||||
Exam->NumQstsNotBlank = 0;
|
||||
|
||||
/* Get score (row[4]) */
|
||||
Str_SetDecimalPointToUS (); // To get the decimal point as a dot
|
||||
if (sscanf (row[4],"%lf",&Result->Score) != 1)
|
||||
Result->Score = 0.0;
|
||||
if (sscanf (row[4],"%lf",&Exam->Score) != 1)
|
||||
Exam->Score = 0.0;
|
||||
Str_SetDecimalPointToLocal (); // Return to local system
|
||||
}
|
||||
else
|
||||
{
|
||||
Result->NumQsts = 0;
|
||||
Result->NumQstsNotBlank = 0;
|
||||
Result->Score = 0.0;
|
||||
Exam->NumQsts = 0;
|
||||
Exam->NumQstsNotBlank = 0;
|
||||
Exam->Score = 0.0;
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -1349,7 +1349,7 @@ static void McR_GetMatchResultDataByMchCod (long MchCod,long UsrCod,
|
|||
/********************** Get if I can see match result ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static bool McR_CheckIfICanSeeMatchResult (struct Match *Match,long UsrCod)
|
||||
static bool MchRes_CheckIfICanSeeMatchResult (struct Match *Match,long UsrCod)
|
||||
{
|
||||
bool ItsMe;
|
||||
|
||||
|
@ -1376,13 +1376,13 @@ static bool McR_CheckIfICanSeeMatchResult (struct Match *Match,long UsrCod)
|
|||
/********************** Get if I can see match result ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static bool McR_CheckIfICanViewScore (bool ICanViewResult,unsigned Visibility)
|
||||
static bool MchRes_CheckIfICanViewScore (bool ICanViewResult,unsigned Visibility)
|
||||
{
|
||||
switch (Gbl.Usrs.Me.Role.Logged)
|
||||
{
|
||||
case Rol_STD:
|
||||
if (ICanViewResult)
|
||||
return TsV_IsVisibleTotalScore (Visibility);
|
||||
return TstVis_IsVisibleTotalScore (Visibility);
|
||||
return false;
|
||||
break;
|
||||
case Rol_NET:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// swad_match_result.h: matches results in games using remote control
|
||||
|
||||
#ifndef _SWAD_MCR
|
||||
#define _SWAD_MCR
|
||||
#ifndef _SWAD_MCH_RES
|
||||
#define _SWAD_MCH_RES
|
||||
/*
|
||||
SWAD (Shared Workspace At a Distance in Spanish),
|
||||
is a web platform developed at the University of Granada (Spain),
|
||||
|
@ -27,29 +27,31 @@
|
|||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#include "swad_test_exam.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Public types and constants ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define McR_RESULTS_BOX_ID "mcr_box"
|
||||
#define McR_RESULTS_TABLE_ID "mcr_table"
|
||||
#define MchRes_RESULTS_BOX_ID "mcr_box"
|
||||
#define MchRes_RESULTS_TABLE_ID "mcr_table"
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void McR_SelUsrsToViewMchResults (void);
|
||||
void MchRes_SelUsrsToViewMchResults (void);
|
||||
|
||||
void McR_ShowMyMchResultsInCrs (void);
|
||||
void McR_ShowMyMchResultsInGam (void);
|
||||
void McR_ShowMyMchResultsInMch (void);
|
||||
void MchRes_ShowMyMchResultsInCrs (void);
|
||||
void MchRes_ShowMyMchResultsInGam (void);
|
||||
void MchRes_ShowMyMchResultsInMch (void);
|
||||
|
||||
void McR_ShowAllMchResultsInCrs (void);
|
||||
void McR_ShowAllMchResultsInGam (void);
|
||||
void McR_ShowAllMchResultsInMch (void);
|
||||
void MchRes_ShowAllMchResultsInCrs (void);
|
||||
void MchRes_ShowAllMchResultsInGam (void);
|
||||
void MchRes_ShowAllMchResultsInMch (void);
|
||||
|
||||
void McR_ShowOneMchResult (void);
|
||||
void McR_GetMatchResultQuestionsFromDB (long MchCod,long UsrCod,
|
||||
struct TsR_Result *Result);
|
||||
void MchRes_ShowOneMchResult (void);
|
||||
void MchRes_GetMatchResultQuestionsFromDB (long MchCod,long UsrCod,
|
||||
struct TstExa_Exam *Exam);
|
||||
|
||||
#endif
|
||||
|
|
2028
swad_test.c
2028
swad_test.c
File diff suppressed because it is too large
Load Diff
21
swad_test.h
21
swad_test.h
|
@ -30,7 +30,7 @@
|
|||
#include "swad_game.h"
|
||||
#include "swad_media.h"
|
||||
#include "swad_test_config.h"
|
||||
#include "swad_test_result.h"
|
||||
// #include "swad_test_exam.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public constants ******************************/
|
||||
|
@ -46,6 +46,8 @@
|
|||
|
||||
#define Tst_MAX_BYTES_ANSWER_TYPE 32
|
||||
|
||||
#define Tst_MAX_OPTIONS_PER_QUESTION 10
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Public types ********************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -155,23 +157,8 @@ void Tst_ShowNewTest (void);
|
|||
void Tst_RequestAssessTest (void);
|
||||
void Tst_AssessTest (void);
|
||||
|
||||
void Tst_ComputeChoiceAnsScore (struct TsR_Result *Result,
|
||||
unsigned NumQst,
|
||||
struct Tst_Question *Question);
|
||||
void Tst_GetIndexesFromStr (const char StrIndexesOneQst[Tst_MAX_BYTES_INDEXES_ONE_QST + 1], // 0 1 2 3, 3 0 2 1, etc.
|
||||
unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION]);
|
||||
|
||||
void Tst_ComputeAndShowGrade (unsigned NumQsts,double Score,double MaxGrade);
|
||||
double Tst_ComputeGrade (unsigned NumQsts,double Score,double MaxGrade);
|
||||
void Tst_ShowGrade (double Grade,double MaxGrade);
|
||||
|
||||
void Tst_ShowTagList (unsigned NumTags,MYSQL_RES *mysql_res);
|
||||
|
||||
void Tst_WriteQstAndAnsTestResult (struct UsrData *UsrDat,
|
||||
struct TsR_Result *Result,
|
||||
unsigned NumQst,
|
||||
MYSQL_ROW row,
|
||||
unsigned Visibility);
|
||||
void Tst_WriteNumQst (unsigned NumQst);
|
||||
void Tst_WriteAnswerType (Tst_AnswerType_t AnswerType);
|
||||
void Tst_WriteQstStem (const char *Stem,const char *ClassStem,bool Visible);
|
||||
|
@ -191,6 +178,7 @@ void Tst_GetAnswersQst (struct Tst_Question *Question,MYSQL_RES **mysql_res,
|
|||
void Tst_WriteAnswersListing (struct Tst_Question *Question);
|
||||
bool Tst_CheckIfQuestionIsValidForGame (long QstCod);
|
||||
void Tst_WriteAnsTF (char AnsTF);
|
||||
void Tst_GetChoiceAns (struct Tst_Question *Question,MYSQL_RES *mysql_res);
|
||||
void Tst_CheckIfNumberOfAnswersIsOne (const struct Tst_Question *Question);
|
||||
|
||||
unsigned long Tst_GetTagsQst (long QstCod,MYSQL_RES **mysql_res);
|
||||
|
@ -210,6 +198,7 @@ void Tst_QstDestructor (struct Tst_Question *Question);
|
|||
|
||||
bool Tst_AllocateTextChoiceAnswer (struct Tst_Question *Question,unsigned NumOpt);
|
||||
|
||||
Tst_AnswerType_t Tst_GetQstAnswerType (long QstCod);
|
||||
Tst_AnswerType_t Tst_ConvertFromStrAnsTypDBToAnsTyp (const char *StrAnsTypeBD);
|
||||
void Tst_ReceiveQst (void);
|
||||
bool Tst_CheckIfQstFormatIsCorrectAndCountNumOptions (struct Tst_Question *Question);
|
||||
|
|
|
@ -103,7 +103,7 @@ void TstCfg_GetConfigFromDB (void)
|
|||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
TstCfg_SetConfigMinTimeNxtTstPerQst (0UL);
|
||||
TstCfg_SetConfigVisibility (TsV_VISIBILITY_DEFAULT);
|
||||
TstCfg_SetConfigVisibility (TstVis_VISIBILITY_DEFAULT);
|
||||
if (NumRows == 0)
|
||||
{
|
||||
TstCfg_SetConfigPluggable (TstCfg_PLUGGABLE_UNKNOWN);
|
||||
|
@ -173,7 +173,7 @@ void TstCfg_GetConfigFromRow (MYSQL_ROW row)
|
|||
TstCfg_SetConfigMinTimeNxtTstPerQst (0UL);
|
||||
|
||||
/***** Get visibility (row[5]) *****/
|
||||
TstCfg_SetConfigVisibility (TsV_GetVisibilityFromStr (row[5]));
|
||||
TstCfg_SetConfigVisibility (TstVis_GetVisibilityFromStr (row[5]));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -219,7 +219,7 @@ void TstCfg_ReceiveConfigTst (void)
|
|||
0));
|
||||
|
||||
/***** Get visibility from form *****/
|
||||
TstCfg_SetConfigVisibility (TsV_GetVisibilityFromForm ());
|
||||
TstCfg_SetConfigVisibility (TstVis_GetVisibilityFromForm ());
|
||||
|
||||
/***** Update database *****/
|
||||
DB_QueryREPLACE ("can not save configuration of tests",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,110 @@
|
|||
// swad_test_exam.c: test exams made by users
|
||||
|
||||
#ifndef _SWAD_TST_EXA
|
||||
#define _SWAD_TST_EXA
|
||||
/*
|
||||
SWAD (Shared Workspace At a Distance in Spanish),
|
||||
is a web platform developed at the University of Granada (Spain),
|
||||
and used to support university teaching.
|
||||
|
||||
This file is part of SWAD core.
|
||||
Copyright (C) 1999-2020 Antonio Cañas Vargas
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#include "swad_user.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define TstExa_MAX_BYTES_INDEXES_ONE_QST (Tst_MAX_OPTIONS_PER_QUESTION * (3 + 1))
|
||||
#define TstExa_MAX_BYTES_ANSWERS_ONE_QST (Tst_MAX_OPTIONS_PER_QUESTION * (3 + 1))
|
||||
|
||||
#define TstExa_SCORE_MAX 10 // Maximum score of a test (10 in Spain). Must be unsigned! // TODO: Make this configurable by teachers
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Public types ********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
struct TstExa_Exam
|
||||
{
|
||||
long ExaCod; // Test exam code
|
||||
time_t TimeUTC[Dat_NUM_START_END_TIME];
|
||||
unsigned NumQsts; // Number of questions
|
||||
unsigned NumQstsNotBlank; // Number of questions not blank
|
||||
bool AllowTeachers; // Are teachers allowed to see this test exam?
|
||||
double Score; // Total score of the test exam
|
||||
struct
|
||||
{
|
||||
long QstCod; // Question code
|
||||
char StrIndexes[TstExa_MAX_BYTES_INDEXES_ONE_QST + 1]; // 0 1 2 3, 3 0 2 1, etc.
|
||||
char StrAnswers[TstExa_MAX_BYTES_ANSWERS_ONE_QST + 1]; // Answers selected by user
|
||||
double Score; // Question score
|
||||
bool AnswerIsNotBlank; // Answer not blank?
|
||||
} Questions[TstCfg_MAX_QUESTIONS_PER_TEST];
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TstExa_CreateExamInDB (struct TstExa_Exam *Exam);
|
||||
void TstExa_UpdateExamInDB (const struct TstExa_Exam *Exam);
|
||||
|
||||
void TstExa_ShowExamAfterAssess (struct TstExa_Exam *Exam);
|
||||
void TstExa_WriteQstAndAnsExam (struct UsrData *UsrDat,
|
||||
struct TstExa_Exam *Result,
|
||||
unsigned NumQst,
|
||||
MYSQL_ROW row,
|
||||
unsigned Visibility);
|
||||
|
||||
void TstExa_ComputeScoresAndStoreExamQuestions (struct TstExa_Exam *Exam,
|
||||
bool UpdateQstScore);
|
||||
void TstExa_ComputeChoiceAnsScore (struct TstExa_Exam *Result,
|
||||
unsigned NumQst,
|
||||
struct Tst_Question *Question);
|
||||
void TstExa_GetIndexesFromStr (const char StrIndexesOneQst[TstExa_MAX_BYTES_INDEXES_ONE_QST + 1], // 0 1 2 3, 3 0 2 1, etc.
|
||||
unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION]);
|
||||
void TstExa_GetAnswersFromStr (const char StrAnswersOneQst[TstExa_MAX_BYTES_ANSWERS_ONE_QST + 1],
|
||||
bool UsrAnswers[Tst_MAX_OPTIONS_PER_QUESTION]);
|
||||
|
||||
void TstExa_ComputeAndShowGrade (unsigned NumQsts,double Score,double MaxGrade);
|
||||
double TstExa_ComputeGrade (unsigned NumQsts,double Score,double MaxGrade);
|
||||
void TstExa_ShowGrade (double Grade,double MaxGrade);
|
||||
|
||||
void TstExa_SelUsrsToViewUsrsExams (void);
|
||||
void TstExa_SelDatesToSeeMyExams (void);
|
||||
void TstExa_ShowMyExams (void);
|
||||
void TstExa_GetUsrsAndShowExams (void);
|
||||
|
||||
void TstExa_PutParamExaCod (long ExaCod);
|
||||
long TstExa_GetParamExaCod (void);
|
||||
|
||||
void TstExa_ShowOneExam (void);
|
||||
void TstExa_ShowExamAnswers (struct UsrData *UsrDat,
|
||||
struct TstExa_Exam *Exam,
|
||||
unsigned Visibility);
|
||||
void TstExa_GetExamDataByExaCod (struct TstExa_Exam *Exam);
|
||||
|
||||
void TstExa_GetExamQuestionsFromDB (struct TstExa_Exam *Exam);
|
||||
void TstExa_RemoveExamsMadeByUsrInAllCrss (long UsrCod);
|
||||
void TstExa_RemoveExamsMadeByUsrInCrs (long UsrCod,long CrsCod);
|
||||
void TstExa_RemoveCrsExams (long CrsCod);
|
||||
|
||||
#endif
|
1157
swad_test_result.c
1157
swad_test_result.c
File diff suppressed because it is too large
Load Diff
|
@ -1,84 +0,0 @@
|
|||
// swad_test_results.h: test results
|
||||
|
||||
#ifndef _SWAD_TSR
|
||||
#define _SWAD_TSR
|
||||
/*
|
||||
SWAD (Shared Workspace At a Distance in Spanish),
|
||||
is a web platform developed at the University of Granada (Spain),
|
||||
and used to support university teaching.
|
||||
|
||||
This file is part of SWAD core.
|
||||
Copyright (C) 1999-2020 Antonio Cañas Vargas
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#include "swad_user.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Tst_MAX_OPTIONS_PER_QUESTION 10
|
||||
#define Tst_MAX_BYTES_INDEXES_ONE_QST (Tst_MAX_OPTIONS_PER_QUESTION * (3 + 1))
|
||||
#define Tst_MAX_BYTES_ANSWERS_ONE_QST (Tst_MAX_OPTIONS_PER_QUESTION * (3 + 1))
|
||||
|
||||
#define TsR_SCORE_MAX 10 // Maximum score of a test (10 in Spain). Must be unsigned! // TODO: Make this configurable by teachers
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Public types ********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
struct TsR_Result
|
||||
{
|
||||
long TstCod; // Exam code
|
||||
time_t TimeUTC[Dat_NUM_START_END_TIME];
|
||||
unsigned NumQsts; // Number of questions
|
||||
unsigned NumQstsNotBlank; // Number of questions not blank
|
||||
bool AllowTeachers; // Are teachers allowed to see this test result?
|
||||
double Score; // Total score of the test result
|
||||
struct
|
||||
{
|
||||
long QstCod; // Question code
|
||||
char StrIndexes[Tst_MAX_BYTES_INDEXES_ONE_QST + 1]; // 0 1 2 3, 3 0 2 1, etc.
|
||||
char StrAnswers[Tst_MAX_BYTES_ANSWERS_ONE_QST + 1]; // Answers selected by user
|
||||
double Score; // Question score
|
||||
bool AnswerIsNotBlank; // Answer not blank?
|
||||
} Questions[TstCfg_MAX_QUESTIONS_PER_TEST];
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TsR_SelUsrsToViewUsrsTstResults (void);
|
||||
void TsR_SelDatesToSeeMyTstResults (void);
|
||||
void TsR_ShowMyTstResults (void);
|
||||
void TsR_CreateTestResultInDB (struct TsR_Result *Result);
|
||||
void TsR_UpdateScoreOfTestResultInDB (const struct TsR_Result *Result);
|
||||
void TsR_GetUsrsAndShowTstResults (void);
|
||||
void TsR_ShowOneTstResult (void);
|
||||
void TsR_ShowTestResult (struct UsrData *UsrDat,
|
||||
struct TsR_Result *Result,
|
||||
unsigned Visibility);
|
||||
void TsR_StoreOneTestResultQstInDB (const struct TsR_Result *Result,
|
||||
unsigned NumQst);
|
||||
void TsR_RemoveTestResultsMadeByUsrInAllCrss (long UsrCod);
|
||||
void TsR_RemoveTestResultsMadeByUsrInCrs (long UsrCod,long CrsCod);
|
||||
void TsR_RemoveCrsTestResults (long CrsCod);
|
||||
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
// swad_test_visibility.c: visibility of test results
|
||||
// swad_test_visibility.c: visibility of test exams
|
||||
|
||||
/*
|
||||
SWAD (Shared Workspace At a Distance),
|
||||
|
@ -63,33 +63,33 @@ extern struct Globals Gbl;
|
|||
/******************************* Show visibility *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TsV_ShowVisibilityIcons (unsigned SelectedVisibility,bool Hidden)
|
||||
void TstVis_ShowVisibilityIcons (unsigned SelectedVisibility,bool Hidden)
|
||||
{
|
||||
extern const char *Txt_TST_STR_VISIBILITY[TsV_NUM_ITEMS_VISIBILITY];
|
||||
extern const char *Txt_TST_STR_VISIBILITY[TstVis_NUM_ITEMS_VISIBILITY];
|
||||
extern const char *Txt_TST_HIDDEN_VISIBLE[2];
|
||||
static const char *Icons[TsV_NUM_ITEMS_VISIBILITY][2] =
|
||||
static const char *Icons[TstVis_NUM_ITEMS_VISIBILITY][2] =
|
||||
{
|
||||
[TsV_VISIBLE_QST_ANS_TXT ][false] = "file-alt-red.svg",
|
||||
[TsV_VISIBLE_QST_ANS_TXT ][true ] = "file-alt-green.svg",
|
||||
[TstVis_VISIBLE_QST_ANS_TXT ][false] = "file-alt-red.svg",
|
||||
[TstVis_VISIBLE_QST_ANS_TXT ][true ] = "file-alt-green.svg",
|
||||
|
||||
[TsV_VISIBLE_FEEDBACK_TXT ][false] = "file-signature-red.svg",
|
||||
[TsV_VISIBLE_FEEDBACK_TXT ][true ] = "file-signature-green.svg",
|
||||
[TstVis_VISIBLE_FEEDBACK_TXT ][false] = "file-signature-red.svg",
|
||||
[TstVis_VISIBLE_FEEDBACK_TXT ][true ] = "file-signature-green.svg",
|
||||
|
||||
[TsV_VISIBLE_CORRECT_ANSWER][false] = "spell-check-red.svg",
|
||||
[TsV_VISIBLE_CORRECT_ANSWER][true ] = "spell-check-green.svg",
|
||||
[TstVis_VISIBLE_CORRECT_ANSWER][false] = "spell-check-red.svg",
|
||||
[TstVis_VISIBLE_CORRECT_ANSWER][true ] = "spell-check-green.svg",
|
||||
|
||||
[TsV_VISIBLE_EACH_QST_SCORE][false] = "tasks-red.svg",
|
||||
[TsV_VISIBLE_EACH_QST_SCORE][true ] = "tasks-green.svg",
|
||||
[TstVis_VISIBLE_EACH_QST_SCORE][false] = "tasks-red.svg",
|
||||
[TstVis_VISIBLE_EACH_QST_SCORE][true ] = "tasks-green.svg",
|
||||
|
||||
[TsV_VISIBLE_TOTAL_SCORE ][false] = "check-circle-regular-red.svg",
|
||||
[TsV_VISIBLE_TOTAL_SCORE ][true ] = "check-circle-regular-green.svg",
|
||||
[TstVis_VISIBLE_TOTAL_SCORE ][false] = "check-circle-regular-red.svg",
|
||||
[TstVis_VISIBLE_TOTAL_SCORE ][true ] = "check-circle-regular-green.svg",
|
||||
};
|
||||
TsV_Visibility_t Visibility;
|
||||
TstVis_Visibility_t Visibility;
|
||||
bool ItemVisible;
|
||||
char *Title;
|
||||
|
||||
for (Visibility = (TsV_Visibility_t) 0;
|
||||
Visibility <= (TsV_Visibility_t) (TsV_NUM_ITEMS_VISIBILITY - 1);
|
||||
for (Visibility = (TstVis_Visibility_t) 0;
|
||||
Visibility <= (TstVis_Visibility_t) (TstVis_NUM_ITEMS_VISIBILITY - 1);
|
||||
Visibility++)
|
||||
{
|
||||
ItemVisible = (SelectedVisibility & (1 << Visibility)) != 0;
|
||||
|
@ -106,25 +106,25 @@ void TsV_ShowVisibilityIcons (unsigned SelectedVisibility,bool Hidden)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************ Put checkboxes in form to select result visibility *************/
|
||||
/************* Put checkboxes in form to select exam visibility **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TsV_PutVisibilityCheckboxes (unsigned SelectedVisibility)
|
||||
void TstVis_PutVisibilityCheckboxes (unsigned SelectedVisibility)
|
||||
{
|
||||
extern const char *Txt_TST_STR_VISIBILITY[TsV_NUM_ITEMS_VISIBILITY];
|
||||
static const char *Icons[TsV_NUM_ITEMS_VISIBILITY] =
|
||||
extern const char *Txt_TST_STR_VISIBILITY[TstVis_NUM_ITEMS_VISIBILITY];
|
||||
static const char *Icons[TstVis_NUM_ITEMS_VISIBILITY] =
|
||||
{
|
||||
[TsV_VISIBLE_QST_ANS_TXT ] = "file-alt.svg",
|
||||
[TsV_VISIBLE_FEEDBACK_TXT ] = "file-signature.svg",
|
||||
[TsV_VISIBLE_CORRECT_ANSWER] = "spell-check.svg",
|
||||
[TsV_VISIBLE_EACH_QST_SCORE] = "tasks.svg",
|
||||
[TsV_VISIBLE_TOTAL_SCORE ] = "check-circle-regular.svg",
|
||||
[TstVis_VISIBLE_QST_ANS_TXT ] = "file-alt.svg",
|
||||
[TstVis_VISIBLE_FEEDBACK_TXT ] = "file-signature.svg",
|
||||
[TstVis_VISIBLE_CORRECT_ANSWER] = "spell-check.svg",
|
||||
[TstVis_VISIBLE_EACH_QST_SCORE] = "tasks.svg",
|
||||
[TstVis_VISIBLE_TOTAL_SCORE ] = "check-circle-regular.svg",
|
||||
};
|
||||
TsV_Visibility_t Visibility;
|
||||
TstVis_Visibility_t Visibility;
|
||||
bool ItemVisible;
|
||||
|
||||
for (Visibility = (TsV_Visibility_t) 0;
|
||||
Visibility <= (TsV_Visibility_t) (TsV_NUM_ITEMS_VISIBILITY - 1);
|
||||
for (Visibility = (TstVis_Visibility_t) 0;
|
||||
Visibility <= (TstVis_Visibility_t) (TstVis_NUM_ITEMS_VISIBILITY - 1);
|
||||
Visibility++)
|
||||
{
|
||||
ItemVisible = (SelectedVisibility & (1 << Visibility)) != 0;
|
||||
|
@ -145,18 +145,18 @@ void TsV_PutVisibilityCheckboxes (unsigned SelectedVisibility)
|
|||
/************************** Get visibility from form *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned TsV_GetVisibilityFromForm (void)
|
||||
unsigned TstVis_GetVisibilityFromForm (void)
|
||||
{
|
||||
size_t MaxSizeListVisibilitySelected;
|
||||
char *StrVisibilitySelected;
|
||||
const char *Ptr;
|
||||
char UnsignedStr[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
||||
unsigned UnsignedNum;
|
||||
TsV_Visibility_t VisibilityItem;
|
||||
TstVis_Visibility_t VisibilityItem;
|
||||
unsigned Visibility = 0; // Nothing selected
|
||||
|
||||
/***** Allocate memory for list of attendance events selected *****/
|
||||
MaxSizeListVisibilitySelected = TsV_NUM_ITEMS_VISIBILITY * (Cns_MAX_DECIMAL_DIGITS_UINT + 1);
|
||||
MaxSizeListVisibilitySelected = TstVis_NUM_ITEMS_VISIBILITY * (Cns_MAX_DECIMAL_DIGITS_UINT + 1);
|
||||
if ((StrVisibilitySelected = (char *) malloc (MaxSizeListVisibilitySelected + 1)) == NULL)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
|
||||
|
@ -172,9 +172,9 @@ unsigned TsV_GetVisibilityFromForm (void)
|
|||
/* Get next visibility item selected */
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UnsignedStr,Cns_MAX_DECIMAL_DIGITS_UINT);
|
||||
if (sscanf (UnsignedStr,"%u",&UnsignedNum) == 1)
|
||||
if (UnsignedNum < TsV_NUM_ITEMS_VISIBILITY)
|
||||
if (UnsignedNum < TstVis_NUM_ITEMS_VISIBILITY)
|
||||
{
|
||||
VisibilityItem = (TsV_Visibility_t) UnsignedNum;
|
||||
VisibilityItem = (TstVis_Visibility_t) UnsignedNum;
|
||||
Visibility |= (1 << VisibilityItem);
|
||||
}
|
||||
}
|
||||
|
@ -186,16 +186,16 @@ unsigned TsV_GetVisibilityFromForm (void)
|
|||
/************************** Get visibility from string *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned TsV_GetVisibilityFromStr (const char *Str)
|
||||
unsigned TstVis_GetVisibilityFromStr (const char *Str)
|
||||
{
|
||||
unsigned UnsignedNum;
|
||||
unsigned Visibility = TsV_MIN_VISIBILITY; // In nothing is read, return minimum visibility
|
||||
unsigned Visibility = TstVis_MIN_VISIBILITY; // In nothing is read, return minimum visibility
|
||||
|
||||
/***** Get visibility from string *****/
|
||||
if (Str)
|
||||
if (Str[0])
|
||||
if (sscanf (Str,"%u",&UnsignedNum) == 1)
|
||||
Visibility = UnsignedNum & TsV_MAX_VISIBILITY;
|
||||
Visibility = UnsignedNum & TstVis_MAX_VISIBILITY;
|
||||
|
||||
return Visibility;
|
||||
}
|
||||
|
@ -204,27 +204,27 @@ unsigned TsV_GetVisibilityFromStr (const char *Str)
|
|||
/***************************** Get visibility items **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool TsV_IsVisibleQstAndAnsTxt (unsigned Visibility)
|
||||
bool TstVis_IsVisibleQstAndAnsTxt (unsigned Visibility)
|
||||
{
|
||||
return (Visibility & (1 << TsV_VISIBLE_QST_ANS_TXT)) != 0;
|
||||
return (Visibility & (1 << TstVis_VISIBLE_QST_ANS_TXT)) != 0;
|
||||
}
|
||||
|
||||
bool TsV_IsVisibleFeedbackTxt (unsigned Visibility)
|
||||
bool TstVis_IsVisibleFeedbackTxt (unsigned Visibility)
|
||||
{
|
||||
return (Visibility & (1 << TsV_VISIBLE_FEEDBACK_TXT)) != 0;
|
||||
return (Visibility & (1 << TstVis_VISIBLE_FEEDBACK_TXT)) != 0;
|
||||
}
|
||||
|
||||
bool TsV_IsVisibleCorrectAns (unsigned Visibility)
|
||||
bool TstVis_IsVisibleCorrectAns (unsigned Visibility)
|
||||
{
|
||||
return (Visibility & (1 << TsV_VISIBLE_CORRECT_ANSWER)) != 0;
|
||||
return (Visibility & (1 << TstVis_VISIBLE_CORRECT_ANSWER)) != 0;
|
||||
}
|
||||
|
||||
bool TsV_IsVisibleEachQstScore (unsigned Visibility)
|
||||
bool TstVis_IsVisibleEachQstScore (unsigned Visibility)
|
||||
{
|
||||
return (Visibility & (1 << TsV_VISIBLE_EACH_QST_SCORE)) != 0;
|
||||
return (Visibility & (1 << TstVis_VISIBLE_EACH_QST_SCORE)) != 0;
|
||||
}
|
||||
|
||||
bool TsV_IsVisibleTotalScore (unsigned Visibility)
|
||||
bool TstVis_IsVisibleTotalScore (unsigned Visibility)
|
||||
{
|
||||
return (Visibility & (1 << TsV_VISIBLE_TOTAL_SCORE)) != 0;
|
||||
return (Visibility & (1 << TstVis_VISIBLE_TOTAL_SCORE)) != 0;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// swad_test_visibility.h: visibility of test results
|
||||
|
||||
#ifndef _SWAD_TSV
|
||||
#define _SWAD_TSV
|
||||
#ifndef _SWAD_TST_VIS
|
||||
#define _SWAD_TST_VIS
|
||||
/*
|
||||
SWAD (Shared Workspace At a Distance in Spanish),
|
||||
is a web platform developed at the University of Granada (Spain),
|
||||
|
@ -37,32 +37,32 @@
|
|||
/******************************* Public types ********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define TsV_NUM_ITEMS_VISIBILITY 5
|
||||
#define TstVis_NUM_ITEMS_VISIBILITY 5
|
||||
typedef enum
|
||||
{
|
||||
TsV_VISIBLE_QST_ANS_TXT = 0, // Questions and answers text
|
||||
TsV_VISIBLE_FEEDBACK_TXT = 1, // Feedback text
|
||||
TsV_VISIBLE_CORRECT_ANSWER = 2, // Correct answers
|
||||
TsV_VISIBLE_EACH_QST_SCORE = 3, // Score of each question
|
||||
TsV_VISIBLE_TOTAL_SCORE = 4, // Total score
|
||||
} TsV_Visibility_t;
|
||||
#define TsV_MIN_VISIBILITY 0 // Nothing visible
|
||||
#define TsV_MAX_VISIBILITY ((1 << TsV_NUM_ITEMS_VISIBILITY) - 1) // All visible
|
||||
#define TsV_VISIBILITY_DEFAULT TsV_MAX_VISIBILITY
|
||||
TstVis_VISIBLE_QST_ANS_TXT = 0, // Questions and answers text
|
||||
TstVis_VISIBLE_FEEDBACK_TXT = 1, // Feedback text
|
||||
TstVis_VISIBLE_CORRECT_ANSWER = 2, // Correct answers
|
||||
TstVis_VISIBLE_EACH_QST_SCORE = 3, // Score of each question
|
||||
TstVis_VISIBLE_TOTAL_SCORE = 4, // Total score
|
||||
} TstVis_Visibility_t;
|
||||
#define TstVis_MIN_VISIBILITY 0 // Nothing visible
|
||||
#define TstVis_MAX_VISIBILITY ((1 << TstVis_NUM_ITEMS_VISIBILITY) - 1) // All visible
|
||||
#define TstVis_VISIBILITY_DEFAULT TstVis_MAX_VISIBILITY
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TsV_ShowVisibilityIcons (unsigned SelectedVisibility,bool Hidden);
|
||||
void TsV_PutVisibilityCheckboxes (unsigned SelectedVisibility);
|
||||
unsigned TsV_GetVisibilityFromForm (void);
|
||||
unsigned TsV_GetVisibilityFromStr (const char *Str);
|
||||
void TstVis_ShowVisibilityIcons (unsigned SelectedVisibility,bool Hidden);
|
||||
void TstVis_PutVisibilityCheckboxes (unsigned SelectedVisibility);
|
||||
unsigned TstVis_GetVisibilityFromForm (void);
|
||||
unsigned TstVis_GetVisibilityFromStr (const char *Str);
|
||||
|
||||
bool TsV_IsVisibleQstAndAnsTxt (unsigned Visibility);
|
||||
bool TsV_IsVisibleFeedbackTxt (unsigned Visibility);
|
||||
bool TsV_IsVisibleCorrectAns (unsigned Visibility);
|
||||
bool TsV_IsVisibleEachQstScore (unsigned Visibility);
|
||||
bool TsV_IsVisibleTotalScore (unsigned Visibility);
|
||||
bool TstVis_IsVisibleQstAndAnsTxt (unsigned Visibility);
|
||||
bool TstVis_IsVisibleFeedbackTxt (unsigned Visibility);
|
||||
bool TstVis_IsVisibleCorrectAns (unsigned Visibility);
|
||||
bool TstVis_IsVisibleEachQstScore (unsigned Visibility);
|
||||
bool TstVis_IsVisibleTotalScore (unsigned Visibility);
|
||||
|
||||
#endif
|
||||
|
|
12
swad_text.c
12
swad_text.c
|
@ -51846,9 +51846,9 @@ const char *Txt_TST_STR_ORDER_SHORT[Tst_NUM_TYPES_ORDER_QST] =
|
|||
#endif
|
||||
};
|
||||
|
||||
const char *Txt_TST_STR_VISIBILITY[TsV_NUM_ITEMS_VISIBILITY] =
|
||||
const char *Txt_TST_STR_VISIBILITY[TstVis_NUM_ITEMS_VISIBILITY] =
|
||||
{
|
||||
[TsV_VISIBLE_QST_ANS_TXT] =
|
||||
[TstVis_VISIBLE_QST_ANS_TXT] =
|
||||
#if L==1 // ca
|
||||
"Text de preguntes i respostes"
|
||||
#elif L==2 // de
|
||||
|
@ -51869,7 +51869,7 @@ const char *Txt_TST_STR_VISIBILITY[TsV_NUM_ITEMS_VISIBILITY] =
|
|||
"Texto de perguntas e respostas"
|
||||
#endif
|
||||
,
|
||||
[TsV_VISIBLE_FEEDBACK_TXT] =
|
||||
[TstVis_VISIBLE_FEEDBACK_TXT] =
|
||||
#if L==1 // ca
|
||||
"Text de realimentació"
|
||||
#elif L==2 // de
|
||||
|
@ -51890,7 +51890,7 @@ const char *Txt_TST_STR_VISIBILITY[TsV_NUM_ITEMS_VISIBILITY] =
|
|||
"Texto de feedback"
|
||||
#endif
|
||||
,
|
||||
[TsV_VISIBLE_CORRECT_ANSWER] =
|
||||
[TstVis_VISIBLE_CORRECT_ANSWER] =
|
||||
#if L==1 // ca
|
||||
"Respostes correctes"
|
||||
#elif L==2 // de
|
||||
|
@ -51911,7 +51911,7 @@ const char *Txt_TST_STR_VISIBILITY[TsV_NUM_ITEMS_VISIBILITY] =
|
|||
"Respostas corretas"
|
||||
#endif
|
||||
,
|
||||
[TsV_VISIBLE_EACH_QST_SCORE] =
|
||||
[TstVis_VISIBLE_EACH_QST_SCORE] =
|
||||
#if L==1 // ca
|
||||
"Puntuació de cada pregunta"
|
||||
#elif L==2 // de
|
||||
|
@ -51932,7 +51932,7 @@ const char *Txt_TST_STR_VISIBILITY[TsV_NUM_ITEMS_VISIBILITY] =
|
|||
"Pontuação de cada pergunta"
|
||||
#endif
|
||||
,
|
||||
[TsV_VISIBLE_TOTAL_SCORE] =
|
||||
[TstVis_VISIBLE_TOTAL_SCORE] =
|
||||
#if L==1 // ca
|
||||
"Puntuació total"
|
||||
#elif L==2 // de
|
||||
|
|
Loading…
Reference in New Issue