mirror of
https://github.com/acanas/swad-core.git
synced 2024-09-22 00:00:40 +02:00
Version19.151.1
This commit is contained in:
parent
71aa5870b4
commit
dccf76d355
|
@ -497,7 +497,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
||||||
En OpenSWAD:
|
En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 19.151 (2020-03-21)"
|
#define Log_PLATFORM_VERSION "SWAD 19.151.1 (2020-03-21)"
|
||||||
#define CSS_FILE "swad19.146.css"
|
#define CSS_FILE "swad19.146.css"
|
||||||
#define JS_FILE "swad19.91.1.js"
|
#define JS_FILE "swad19.91.1.js"
|
||||||
/*
|
/*
|
||||||
|
@ -524,6 +524,7 @@ Param
|
||||||
// TODO: Oresti Baños: cambiar ojos por candados en descriptores para prohibir/permitir y dejar los ojos para poder elegir descriptores
|
// TODO: 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: Si el alumno ha marcado "Permitir que los profesores...", entonces pedir confirmación al pulsar el botón azul, para evitar que se envíe por error antes de tiempo
|
||||||
|
|
||||||
|
Version 19.151.1: Mar 21, 2020 Code refactoring in tests. (283360 lines)
|
||||||
Version 19.151: Mar 21, 2020 Code refactoring in tests.
|
Version 19.151: Mar 21, 2020 Code refactoring in tests.
|
||||||
New module swad_test_config for test configuration. (283349 lines)
|
New module swad_test_config for test configuration. (283349 lines)
|
||||||
Version 19.150: Mar 19, 2020 Code refactoring in tests. (283031 lines)
|
Version 19.150: Mar 19, 2020 Code refactoring in tests. (283031 lines)
|
||||||
|
|
|
@ -361,7 +361,6 @@ void Gbl_InitializeGlobals (void)
|
||||||
// Tst_SetConfigPluggable (TstCfg_PLUGGABLE_UNKNOWN);
|
// Tst_SetConfigPluggable (TstCfg_PLUGGABLE_UNKNOWN);
|
||||||
// Tst_SetConfigVisibility (TsV_VISIBILITY_DEFAULT);
|
// Tst_SetConfigVisibility (TsV_VISIBILITY_DEFAULT);
|
||||||
Gbl.Test.NumQsts = TstCfg_DEFAULT_DEF_QUESTIONS;
|
Gbl.Test.NumQsts = TstCfg_DEFAULT_DEF_QUESTIONS;
|
||||||
Gbl.Test.AllowTeachers = true; // Test result will be visible by teachers?
|
|
||||||
Gbl.Test.AllAnsTypes = false;
|
Gbl.Test.AllAnsTypes = false;
|
||||||
Gbl.Test.ListAnsTypes[0] = '\0';
|
Gbl.Test.ListAnsTypes[0] = '\0';
|
||||||
|
|
||||||
|
|
|
@ -655,7 +655,6 @@ struct Globals
|
||||||
long QstCodes[TstCfg_MAX_QUESTIONS_PER_TEST]; // Codes of the sent/received questions in a test
|
long QstCodes[TstCfg_MAX_QUESTIONS_PER_TEST]; // Codes of the sent/received questions in a test
|
||||||
char StrIndexesOneQst[TstCfg_MAX_QUESTIONS_PER_TEST][Tst_MAX_BYTES_INDEXES_ONE_QST + 1]; // 0 1 2 3, 3 0 2 1, etc.
|
char StrIndexesOneQst[TstCfg_MAX_QUESTIONS_PER_TEST][Tst_MAX_BYTES_INDEXES_ONE_QST + 1]; // 0 1 2 3, 3 0 2 1, etc.
|
||||||
char StrAnswersOneQst[TstCfg_MAX_QUESTIONS_PER_TEST][Tst_MAX_BYTES_ANSWERS_ONE_QST + 1]; // Answers selected by user
|
char StrAnswersOneQst[TstCfg_MAX_QUESTIONS_PER_TEST][Tst_MAX_BYTES_ANSWERS_ONE_QST + 1]; // Answers selected by user
|
||||||
bool AllowTeachers; // Can teachers of this course see the test result?
|
|
||||||
bool AllAnsTypes;
|
bool AllAnsTypes;
|
||||||
char ListAnsTypes[Tst_MAX_BYTES_LIST_ANSWER_TYPES + 1];
|
char ListAnsTypes[Tst_MAX_BYTES_LIST_ANSWER_TYPES + 1];
|
||||||
Tst_QuestionsOrder_t SelectedOrder;
|
Tst_QuestionsOrder_t SelectedOrder;
|
||||||
|
|
32
swad_test.c
32
swad_test.c
|
@ -481,9 +481,8 @@ void Tst_ShowNewTest (void)
|
||||||
HTM_DIV_Begin ("class=\"CM\"");
|
HTM_DIV_Begin ("class=\"CM\"");
|
||||||
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
||||||
HTM_INPUT_CHECKBOX ("AllowTchs",HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_INPUT_CHECKBOX ("AllowTchs",HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"value=\"Y\"%s",
|
"value=\"Y\""
|
||||||
Gbl.Test.AllowTeachers ? " checked=\"checked\"" :
|
" checked=\"checked\""); // By default, teachers can see test result
|
||||||
"");
|
|
||||||
HTM_TxtF (" %s",Txt_Allow_teachers_to_consult_this_test);
|
HTM_TxtF (" %s",Txt_Allow_teachers_to_consult_this_test);
|
||||||
HTM_LABEL_End ();
|
HTM_LABEL_End ();
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
|
@ -528,6 +527,7 @@ void Tst_AssessTest (void)
|
||||||
extern const char *Txt_The_test_X_has_already_been_assessed_previously;
|
extern const char *Txt_The_test_X_has_already_been_assessed_previously;
|
||||||
extern const char *Txt_There_was_an_error_in_assessing_the_test_X;
|
extern const char *Txt_There_was_an_error_in_assessing_the_test_X;
|
||||||
unsigned NumTst;
|
unsigned NumTst;
|
||||||
|
bool AllowTeachers; // Can teachers of this course see the test result?
|
||||||
long TstCod = -1L; // Initialized to avoid warning
|
long TstCod = -1L; // Initialized to avoid warning
|
||||||
unsigned NumQstsNotBlank;
|
unsigned NumQstsNotBlank;
|
||||||
double TotalScore;
|
double TotalScore;
|
||||||
|
@ -547,13 +547,13 @@ void Tst_AssessTest (void)
|
||||||
Tst_GetParamNumQst ();
|
Tst_GetParamNumQst ();
|
||||||
|
|
||||||
/***** Get if test will be visible by teachers *****/
|
/***** Get if test will be visible by teachers *****/
|
||||||
Gbl.Test.AllowTeachers = Par_GetParToBool ("AllowTchs");
|
AllowTeachers = Par_GetParToBool ("AllowTchs");
|
||||||
|
|
||||||
/***** Get questions and answers from form to assess a test *****/
|
/***** Get questions and answers from form to assess a test *****/
|
||||||
Tst_GetQuestionsAndAnswersFromForm ();
|
Tst_GetQuestionsAndAnswersFromForm ();
|
||||||
|
|
||||||
/***** Create new test in database to store the result *****/
|
/***** Create new test in database to store the result *****/
|
||||||
TstCod = TsR_CreateTestResultInDB ();
|
TstCod = TsR_CreateTestResultInDB (AllowTeachers);
|
||||||
|
|
||||||
/***** Begin box *****/
|
/***** Begin box *****/
|
||||||
Box_BoxBegin (NULL,Txt_Test_result,NULL,
|
Box_BoxBegin (NULL,Txt_Test_result,NULL,
|
||||||
|
@ -625,21 +625,21 @@ static void Tst_GetQuestionsAndAnswersFromForm (void)
|
||||||
{
|
{
|
||||||
/* Get question code */
|
/* Get question code */
|
||||||
snprintf (StrQstIndOrAns,sizeof (StrQstIndOrAns),
|
snprintf (StrQstIndOrAns,sizeof (StrQstIndOrAns),
|
||||||
"Qst%06u",
|
"Qst%03u",
|
||||||
NumQst);
|
NumQst);
|
||||||
if ((Gbl.Test.QstCodes[NumQst] = Par_GetParToLong (StrQstIndOrAns)) <= 0)
|
if ((Gbl.Test.QstCodes[NumQst] = Par_GetParToLong (StrQstIndOrAns)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of question is missing.");
|
Lay_ShowErrorAndExit ("Code of question is missing.");
|
||||||
|
|
||||||
/* Get indexes for this question */
|
/* Get indexes for this question */
|
||||||
snprintf (StrQstIndOrAns,sizeof (StrQstIndOrAns),
|
snprintf (StrQstIndOrAns,sizeof (StrQstIndOrAns),
|
||||||
"Ind%06u",
|
"Ind%03u",
|
||||||
NumQst);
|
NumQst);
|
||||||
Par_GetParMultiToText (StrQstIndOrAns,Gbl.Test.StrIndexesOneQst[NumQst],
|
Par_GetParMultiToText (StrQstIndOrAns,Gbl.Test.StrIndexesOneQst[NumQst],
|
||||||
Tst_MAX_BYTES_INDEXES_ONE_QST); /* If choice ==> "0", "1", "2",... */
|
Tst_MAX_BYTES_INDEXES_ONE_QST); /* If choice ==> "0", "1", "2",... */
|
||||||
|
|
||||||
/* Get answers selected by user for this question */
|
/* Get answers selected by user for this question */
|
||||||
snprintf (StrQstIndOrAns,sizeof (StrQstIndOrAns),
|
snprintf (StrQstIndOrAns,sizeof (StrQstIndOrAns),
|
||||||
"Ans%06u",
|
"Ans%03u",
|
||||||
NumQst);
|
NumQst);
|
||||||
Par_GetParMultiToText (StrQstIndOrAns,Gbl.Test.StrAnswersOneQst[NumQst],
|
Par_GetParMultiToText (StrQstIndOrAns,Gbl.Test.StrAnswersOneQst[NumQst],
|
||||||
Tst_MAX_BYTES_ANSWERS_ONE_QST); /* If answer type == T/F ==> " ", "T", "F"; if choice ==> "0", "2",... */
|
Tst_MAX_BYTES_ANSWERS_ONE_QST); /* If answer type == T/F ==> " ", "T", "F"; if choice ==> "0", "2",... */
|
||||||
|
@ -3545,7 +3545,7 @@ static void Tst_WriteTFAnsViewTest (unsigned NumQst)
|
||||||
|
|
||||||
/***** Write selector for the answer *****/
|
/***** Write selector for the answer *****/
|
||||||
HTM_SELECT_Begin (false,
|
HTM_SELECT_Begin (false,
|
||||||
"name=\"Ans%06u\"",NumQst);
|
"name=\"Ans%03u\"",NumQst);
|
||||||
HTM_OPTION (HTM_Type_STRING,"" ,true ,false," ");
|
HTM_OPTION (HTM_Type_STRING,"" ,true ,false," ");
|
||||||
HTM_OPTION (HTM_Type_STRING,"T",false,false,"%s",Txt_TF_QST[0]);
|
HTM_OPTION (HTM_Type_STRING,"T",false,false,"%s",Txt_TF_QST[0]);
|
||||||
HTM_OPTION (HTM_Type_STRING,"F",false,false,"%s",Txt_TF_QST[1]);
|
HTM_OPTION (HTM_Type_STRING,"F",false,false,"%s",Txt_TF_QST[1]);
|
||||||
|
@ -3746,16 +3746,16 @@ static void Tst_WriteChoiceAnsViewTest (unsigned NumQst,long QstCod,
|
||||||
/***** Write selectors and letter of this option *****/
|
/***** Write selectors and letter of this option *****/
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
snprintf (ParamName,sizeof (ParamName),
|
snprintf (ParamName,sizeof (ParamName),
|
||||||
"Ind%06u",
|
"Ind%03u",
|
||||||
NumQst);
|
NumQst);
|
||||||
Par_PutHiddenParamUnsigned (NULL,ParamName,Index);
|
Par_PutHiddenParamUnsigned (NULL,ParamName,Index);
|
||||||
snprintf (StrAns,sizeof (StrAns),
|
snprintf (StrAns,sizeof (StrAns),
|
||||||
"Ans%06u",
|
"Ans%03u",
|
||||||
NumQst);
|
NumQst);
|
||||||
if (Question.Answer.Type == Tst_ANS_UNIQUE_CHOICE)
|
if (Question.Answer.Type == Tst_ANS_UNIQUE_CHOICE)
|
||||||
HTM_INPUT_RADIO (StrAns,false,
|
HTM_INPUT_RADIO (StrAns,false,
|
||||||
"id=\"Ans%06u_%u\" value=\"%u\""
|
"id=\"Ans%06u_%u\" value=\"%u\""
|
||||||
" onclick=\"selectUnselectRadio(this,this.form.Ans%06u,%u);\"",
|
" onclick=\"selectUnselectRadio(this,this.form.Ans%03u,%u);\"",
|
||||||
NumQst,NumOpt,
|
NumQst,NumOpt,
|
||||||
Index,
|
Index,
|
||||||
NumQst,Question.Answer.NumOptions);
|
NumQst,Question.Answer.NumOptions);
|
||||||
|
@ -4287,7 +4287,7 @@ static void Tst_WriteTextAnsViewTest (unsigned NumQst)
|
||||||
|
|
||||||
/***** Write input field for the answer *****/
|
/***** Write input field for the answer *****/
|
||||||
snprintf (StrAns,sizeof (StrAns),
|
snprintf (StrAns,sizeof (StrAns),
|
||||||
"Ans%06u",
|
"Ans%03u",
|
||||||
NumQst);
|
NumQst);
|
||||||
HTM_INPUT_TEXT (StrAns,Tst_MAX_BYTES_ANSWERS_ONE_QST,"",false,
|
HTM_INPUT_TEXT (StrAns,Tst_MAX_BYTES_ANSWERS_ONE_QST,"",false,
|
||||||
"size=\"40\"");
|
"size=\"40\"");
|
||||||
|
@ -4502,7 +4502,7 @@ static void Tst_WriteIntAnsViewTest (unsigned NumQst)
|
||||||
|
|
||||||
/***** Write input field for the answer *****/
|
/***** Write input field for the answer *****/
|
||||||
snprintf (StrAns,sizeof (StrAns),
|
snprintf (StrAns,sizeof (StrAns),
|
||||||
"Ans%06u",
|
"Ans%03u",
|
||||||
NumQst);
|
NumQst);
|
||||||
HTM_INPUT_TEXT (StrAns,11,"",false,
|
HTM_INPUT_TEXT (StrAns,11,"",false,
|
||||||
"size=\"11\"");
|
"size=\"11\"");
|
||||||
|
@ -4632,7 +4632,7 @@ static void Tst_WriteFloatAnsViewTest (unsigned NumQst)
|
||||||
|
|
||||||
/***** Write input field for the answer *****/
|
/***** Write input field for the answer *****/
|
||||||
snprintf (StrAns,sizeof (StrAns),
|
snprintf (StrAns,sizeof (StrAns),
|
||||||
"Ans%06u",
|
"Ans%03u",
|
||||||
NumQst);
|
NumQst);
|
||||||
HTM_INPUT_TEXT (StrAns,Tst_MAX_BYTES_FLOAT_ANSWER,"",false,
|
HTM_INPUT_TEXT (StrAns,Tst_MAX_BYTES_FLOAT_ANSWER,"",false,
|
||||||
"size=\"11\"");
|
"size=\"11\"");
|
||||||
|
@ -4820,7 +4820,7 @@ static void Tst_WriteParamQstCod (unsigned NumQst,long QstCod)
|
||||||
char ParamName[3 + 6 + 1];
|
char ParamName[3 + 6 + 1];
|
||||||
|
|
||||||
snprintf (ParamName,sizeof (ParamName),
|
snprintf (ParamName,sizeof (ParamName),
|
||||||
"Qst%06u",
|
"Qst%03u",
|
||||||
NumQst);
|
NumQst);
|
||||||
Par_PutHiddenParamLong (NULL,ParamName,QstCod);
|
Par_PutHiddenParamLong (NULL,ParamName,QstCod);
|
||||||
}
|
}
|
||||||
|
|
11
swad_test.h
11
swad_test.h
|
@ -42,8 +42,8 @@
|
||||||
#define Tst_MAX_BYTES_TAG ((Tst_MAX_CHARS_TAG + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
#define Tst_MAX_BYTES_TAG ((Tst_MAX_CHARS_TAG + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
||||||
|
|
||||||
#define Tst_MAX_OPTIONS_PER_QUESTION 10
|
#define Tst_MAX_OPTIONS_PER_QUESTION 10
|
||||||
#define Tst_MAX_BYTES_INDEXES_ONE_QST (Tst_MAX_OPTIONS_PER_QUESTION * (10 + 1))
|
#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 * (10 + 1))
|
#define Tst_MAX_BYTES_ANSWERS_ONE_QST (Tst_MAX_OPTIONS_PER_QUESTION * (3 + 1))
|
||||||
|
|
||||||
#define Tst_MAX_CHARS_ANSWER_OR_FEEDBACK (1024 - 1) // 1023
|
#define Tst_MAX_CHARS_ANSWER_OR_FEEDBACK (1024 - 1) // 1023
|
||||||
#define Tst_MAX_BYTES_ANSWER_OR_FEEDBACK ((Tst_MAX_CHARS_ANSWER_OR_FEEDBACK + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 16383
|
#define Tst_MAX_BYTES_ANSWER_OR_FEEDBACK ((Tst_MAX_CHARS_ANSWER_OR_FEEDBACK + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 16383
|
||||||
|
@ -90,9 +90,10 @@ struct Tst_Test
|
||||||
struct Tst_Tags Tags;
|
struct Tst_Tags Tags;
|
||||||
unsigned NumQsts;
|
unsigned NumQsts;
|
||||||
long QstCodes[TstCfg_MAX_QUESTIONS_PER_TEST]; // Codes of the sent/received questions in a test
|
long QstCodes[TstCfg_MAX_QUESTIONS_PER_TEST]; // Codes of the sent/received questions in a test
|
||||||
char StrIndexesOneQst[TstCfg_MAX_QUESTIONS_PER_TEST][Tst_MAX_BYTES_INDEXES_ONE_QST + 1]; // 0 1 2 3, 3 0 2 1, etc.
|
char StrIndexesOneQst[TstCfg_MAX_QUESTIONS_PER_TEST]
|
||||||
char StrAnswersOneQst[TstCfg_MAX_QUESTIONS_PER_TEST][Tst_MAX_BYTES_ANSWERS_ONE_QST + 1]; // Answers selected by user
|
[Tst_MAX_BYTES_INDEXES_ONE_QST + 1]; // 0 1 2 3, 3 0 2 1, etc.
|
||||||
bool AllowTeachers; // Can teachers of this course see the test result?
|
char StrAnswersOneQst[TstCfg_MAX_QUESTIONS_PER_TEST]
|
||||||
|
[Tst_MAX_BYTES_ANSWERS_ONE_QST + 1]; // Answers selected by user
|
||||||
bool AllAnsTypes;
|
bool AllAnsTypes;
|
||||||
char ListAnsTypes[Tst_MAX_BYTES_LIST_ANSWER_TYPES + 1];
|
char ListAnsTypes[Tst_MAX_BYTES_LIST_ANSWER_TYPES + 1];
|
||||||
Tst_QuestionsOrder_t SelectedOrder;
|
Tst_QuestionsOrder_t SelectedOrder;
|
||||||
|
|
|
@ -86,8 +86,11 @@ static void TsR_ShowTestResultsSummaryRow (bool ItsMe,
|
||||||
unsigned NumTotalQstsNotBlank,
|
unsigned NumTotalQstsNotBlank,
|
||||||
double TotalScoreOfAllTests);
|
double TotalScoreOfAllTests);
|
||||||
static void TsR_ShowTstTagsPresentInATestResult (long TstCod);
|
static void TsR_ShowTstTagsPresentInATestResult (long TstCod);
|
||||||
static void TsR_GetTestResultDataByTstCod (long TstCod,time_t *TstTimeUTC,
|
static void TsR_GetTestResultDataByTstCod (long TstCod,
|
||||||
unsigned *NumQstsNotBlank,double *Score);
|
bool *AllowTeachers,
|
||||||
|
time_t *TstTimeUTC,
|
||||||
|
unsigned *NumQstsNotBlank,
|
||||||
|
double *Score);
|
||||||
static void TsR_GetTestResultQuestionsFromDB (long TstCod);
|
static void TsR_GetTestResultQuestionsFromDB (long TstCod);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -169,7 +172,7 @@ void TsR_ShowMyTstResults (void)
|
||||||
/********************* Store test result in database *************************/
|
/********************* Store test result in database *************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
long TsR_CreateTestResultInDB (void)
|
long TsR_CreateTestResultInDB (bool AllowTeachers)
|
||||||
{
|
{
|
||||||
/***** Insert new test result into table *****/
|
/***** Insert new test result into table *****/
|
||||||
return
|
return
|
||||||
|
@ -180,7 +183,7 @@ long TsR_CreateTestResultInDB (void)
|
||||||
" (%ld,%ld,'%c',NOW(),%u)",
|
" (%ld,%ld,'%c',NOW(),%u)",
|
||||||
Gbl.Hierarchy.Crs.CrsCod,
|
Gbl.Hierarchy.Crs.CrsCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Gbl.Test.AllowTeachers ? 'Y' :
|
AllowTeachers ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
Gbl.Test.NumQsts);
|
Gbl.Test.NumQsts);
|
||||||
}
|
}
|
||||||
|
@ -303,6 +306,7 @@ static void TsR_ShowTstResults (struct UsrData *UsrDat)
|
||||||
double ScoreInThisTest;
|
double ScoreInThisTest;
|
||||||
double TotalScoreOfAllTests = 0.0;
|
double TotalScoreOfAllTests = 0.0;
|
||||||
unsigned NumExamsVisibleByTchs = 0;
|
unsigned NumExamsVisibleByTchs = 0;
|
||||||
|
bool AllowTeachers; // Can teachers of this course see the test result?
|
||||||
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
bool ICanViewTest;
|
bool ICanViewTest;
|
||||||
bool ICanViewScore;
|
bool ICanViewScore;
|
||||||
|
@ -346,8 +350,8 @@ static void TsR_ShowTstResults (struct UsrData *UsrDat)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of test result.");
|
Lay_ShowErrorAndExit ("Wrong code of test result.");
|
||||||
|
|
||||||
/* Get if teachers are allowed to see this test result (row[1]) */
|
/* Get if teachers are allowed to see this test result (row[1]) */
|
||||||
Gbl.Test.AllowTeachers = (row[1][0] == 'Y');
|
AllowTeachers = (row[1][0] == 'Y');
|
||||||
ClassDat = Gbl.Test.AllowTeachers ? "DAT" :
|
ClassDat = AllowTeachers ? "DAT" :
|
||||||
"DAT_LIGHT";
|
"DAT_LIGHT";
|
||||||
|
|
||||||
switch (Gbl.Usrs.Me.Role.Logged)
|
switch (Gbl.Usrs.Me.Role.Logged)
|
||||||
|
@ -364,7 +368,7 @@ static void TsR_ShowTstResults (struct UsrData *UsrDat)
|
||||||
case Rol_INS_ADM:
|
case Rol_INS_ADM:
|
||||||
ICanViewTest =
|
ICanViewTest =
|
||||||
ICanViewScore = ItsMe ||
|
ICanViewScore = ItsMe ||
|
||||||
Gbl.Test.AllowTeachers;
|
AllowTeachers;
|
||||||
break;
|
break;
|
||||||
case Rol_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
ICanViewTest =
|
ICanViewTest =
|
||||||
|
@ -395,13 +399,13 @@ static void TsR_ShowTstResults (struct UsrData *UsrDat)
|
||||||
/* Get number of questions (row[3]) */
|
/* Get number of questions (row[3]) */
|
||||||
if (sscanf (row[3],"%u",&NumQstsInThisTest) != 1)
|
if (sscanf (row[3],"%u",&NumQstsInThisTest) != 1)
|
||||||
NumQstsInThisTest = 0;
|
NumQstsInThisTest = 0;
|
||||||
if (Gbl.Test.AllowTeachers)
|
if (AllowTeachers)
|
||||||
NumTotalQsts += NumQstsInThisTest;
|
NumTotalQsts += NumQstsInThisTest;
|
||||||
|
|
||||||
/* Get number of questions not blank (row[4]) */
|
/* Get number of questions not blank (row[4]) */
|
||||||
if (sscanf (row[4],"%u",&NumQstsNotBlankInThisTest) != 1)
|
if (sscanf (row[4],"%u",&NumQstsNotBlankInThisTest) != 1)
|
||||||
NumQstsNotBlankInThisTest = 0;
|
NumQstsNotBlankInThisTest = 0;
|
||||||
if (Gbl.Test.AllowTeachers)
|
if (AllowTeachers)
|
||||||
NumTotalQstsNotBlank += NumQstsNotBlankInThisTest;
|
NumTotalQstsNotBlank += NumQstsNotBlankInThisTest;
|
||||||
|
|
||||||
/* Get score (row[5]) */
|
/* Get score (row[5]) */
|
||||||
|
@ -409,7 +413,7 @@ static void TsR_ShowTstResults (struct UsrData *UsrDat)
|
||||||
if (sscanf (row[5],"%lf",&ScoreInThisTest) != 1)
|
if (sscanf (row[5],"%lf",&ScoreInThisTest) != 1)
|
||||||
ScoreInThisTest = 0.0;
|
ScoreInThisTest = 0.0;
|
||||||
Str_SetDecimalPointToLocal (); // Return to local system
|
Str_SetDecimalPointToLocal (); // Return to local system
|
||||||
if (Gbl.Test.AllowTeachers)
|
if (AllowTeachers)
|
||||||
TotalScoreOfAllTests += ScoreInThisTest;
|
TotalScoreOfAllTests += ScoreInThisTest;
|
||||||
|
|
||||||
/* Write number of questions */
|
/* Write number of questions */
|
||||||
|
@ -457,7 +461,7 @@ static void TsR_ShowTstResults (struct UsrData *UsrDat)
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
if (Gbl.Test.AllowTeachers)
|
if (AllowTeachers)
|
||||||
NumExamsVisibleByTchs++;
|
NumExamsVisibleByTchs++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,6 +601,7 @@ void TsR_ShowOneTstResult (void)
|
||||||
extern const char *Txt_Grade;
|
extern const char *Txt_Grade;
|
||||||
extern const char *Txt_Tags;
|
extern const char *Txt_Tags;
|
||||||
long TstCod;
|
long TstCod;
|
||||||
|
bool AllowTeachers = false; // Initialized to avoid warning
|
||||||
time_t TstTimeUTC = 0; // Test result UTC date-time, initialized to avoid warning
|
time_t TstTimeUTC = 0; // Test result UTC date-time, initialized to avoid warning
|
||||||
unsigned NumQstsNotBlank;
|
unsigned NumQstsNotBlank;
|
||||||
double TotalScore;
|
double TotalScore;
|
||||||
|
@ -611,8 +616,11 @@ void TsR_ShowOneTstResult (void)
|
||||||
Lay_ShowErrorAndExit ("Code of test is missing.");
|
Lay_ShowErrorAndExit ("Code of test is missing.");
|
||||||
|
|
||||||
/***** Get test result data *****/
|
/***** Get test result data *****/
|
||||||
TsR_GetTestResultDataByTstCod (TstCod,&TstTimeUTC,
|
TsR_GetTestResultDataByTstCod (TstCod,
|
||||||
&NumQstsNotBlank,&TotalScore);
|
&AllowTeachers,
|
||||||
|
&TstTimeUTC,
|
||||||
|
&NumQstsNotBlank,
|
||||||
|
&TotalScore);
|
||||||
TstCfg_SetConfigVisibility (TsV_MAX_VISIBILITY);
|
TstCfg_SetConfigVisibility (TsV_MAX_VISIBILITY);
|
||||||
|
|
||||||
/***** Check if I can view this test result *****/
|
/***** Check if I can view this test result *****/
|
||||||
|
@ -642,7 +650,7 @@ void TsR_ShowOneTstResult (void)
|
||||||
case ActSeeOneTstResOth:
|
case ActSeeOneTstResOth:
|
||||||
ICanViewTest =
|
ICanViewTest =
|
||||||
ICanViewScore = ItsMe ||
|
ICanViewScore = ItsMe ||
|
||||||
Gbl.Test.AllowTeachers;
|
AllowTeachers;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ICanViewTest =
|
ICanViewTest =
|
||||||
|
@ -932,8 +940,11 @@ void TsR_ShowTestResult (struct UsrData *UsrDat,
|
||||||
/********* Get data of a test result using its test result code **************/
|
/********* Get data of a test result using its test result code **************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void TsR_GetTestResultDataByTstCod (long TstCod,time_t *TstTimeUTC,
|
static void TsR_GetTestResultDataByTstCod (long TstCod,
|
||||||
unsigned *NumQstsNotBlank,double *Score)
|
bool *AllowTeachers,
|
||||||
|
time_t *TstTimeUTC,
|
||||||
|
unsigned *NumQstsNotBlank,
|
||||||
|
double *Score)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
|
@ -958,7 +969,7 @@ static void TsR_GetTestResultDataByTstCod (long TstCod,time_t *TstTimeUTC,
|
||||||
Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
|
|
||||||
/* Get if teachers are allowed to see this test result (row[1]) */
|
/* Get if teachers are allowed to see this test result (row[1]) */
|
||||||
Gbl.Test.AllowTeachers = (row[1][0] == 'Y');
|
*AllowTeachers = (row[1][0] == 'Y');
|
||||||
|
|
||||||
/* Get date-time (row[2] holds UTC date-time) */
|
/* Get date-time (row[2] holds UTC date-time) */
|
||||||
*TstTimeUTC = Dat_GetUNIXTimeFromStr (row[2]);
|
*TstTimeUTC = Dat_GetUNIXTimeFromStr (row[2]);
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
void TsR_SelUsrsToViewUsrsTstResults (void);
|
void TsR_SelUsrsToViewUsrsTstResults (void);
|
||||||
void TsR_SelDatesToSeeMyTstResults (void);
|
void TsR_SelDatesToSeeMyTstResults (void);
|
||||||
void TsR_ShowMyTstResults (void);
|
void TsR_ShowMyTstResults (void);
|
||||||
long TsR_CreateTestResultInDB (void);
|
long TsR_CreateTestResultInDB (bool AllowTeachers);
|
||||||
void TsR_StoreScoreOfTestResultInDB (long TstCod,
|
void TsR_StoreScoreOfTestResultInDB (long TstCod,
|
||||||
unsigned NumQstsNotBlank,double Score);
|
unsigned NumQstsNotBlank,double Score);
|
||||||
void TsR_GetUsrsAndShowTstResults (void);
|
void TsR_GetUsrsAndShowTstResults (void);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user