mirror of https://github.com/acanas/swad-core.git
Version19.236.3
This commit is contained in:
parent
1970de36f4
commit
586d77eb71
|
@ -1082,7 +1082,7 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
|
|||
UsrDat->FullName);
|
||||
|
||||
/***** Remove test results made by user in all courses *****/
|
||||
TstPrn_RemoveExamsMadeByUsrInAllCrss (UsrDat->UsrCod);
|
||||
TstPrn_RemovePrintsMadeByUsrInAllCrss (UsrDat->UsrCod);
|
||||
|
||||
/***** Remove user's notifications *****/
|
||||
Ntf_RemoveUsrNtfs (UsrDat->UsrCod);
|
||||
|
|
|
@ -683,12 +683,12 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
[ActCfgTst ] = { 451,-1,TabUnk,ActReqTst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_ShowFormConfig ,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 ,TstPrn_SelDatesToSeeMyExams ,NULL},
|
||||
[ActSeeMyTstRes ] = {1084,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstPrn_ShowMyExams ,NULL},
|
||||
[ActSeeOneTstResMe ] = {1085,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstPrn_ShowOneExam ,NULL},
|
||||
[ActReqSeeUsrTstRes ] = {1080,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,TstPrn_SelUsrsToViewUsrsExams ,NULL},
|
||||
[ActSeeUsrTstRes ] = {1081,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstPrn_GetUsrsAndShowExams ,NULL},
|
||||
[ActSeeOneTstResOth ] = {1082,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstPrn_ShowOneExam ,NULL},
|
||||
[ActReqSeeMyTstRes ] = {1083,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,TstPrn_SelDatesToSeeMyPrints ,NULL},
|
||||
[ActSeeMyTstRes ] = {1084,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstPrn_ShowMyPrints ,NULL},
|
||||
[ActSeeOneTstResMe ] = {1085,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstPrn_ShowOnePrint ,NULL},
|
||||
[ActReqSeeUsrTstRes ] = {1080,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,TstPrn_SelUsrsToViewUsrsPrints ,NULL},
|
||||
[ActSeeUsrTstRes ] = {1081,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstPrn_GetUsrsAndShowPrints ,NULL},
|
||||
[ActSeeOneTstResOth ] = {1082,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstPrn_ShowOnePrint ,NULL},
|
||||
|
||||
[ActSeeExa ] = {1849,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_SeeOneExam ,NULL},
|
||||
|
||||
|
|
|
@ -557,10 +557,12 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
|||
En OpenSWAD:
|
||||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 19.236.1 (2020-05-18)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 19.236.3 (2020-05-18)"
|
||||
#define CSS_FILE "swad19.230.1.css"
|
||||
#define JS_FILE "swad19.230.3.js"
|
||||
/*
|
||||
Version 19.236.3: May 18, 2020 Number of players in a match now is calculated as number of users who have result, even in blank. (301243 lines)
|
||||
Version 19.236.2: May 18, 2020 Fixed bug in matches, reported by Javier Fernández Baldomero. (301241 lines)
|
||||
Version 19.236.1: May 18, 2020 Fixed bugs in exam results. (301205 lines)
|
||||
Version 19.236: May 18, 2020 Code refactoring in exams.
|
||||
Fixed bugs in exams. (301200 lines)
|
||||
|
|
|
@ -1989,7 +1989,7 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
|
|||
Svy_RemoveSurveys (Hie_CRS,CrsCod);
|
||||
|
||||
/***** Remove all test exams made in the course *****/
|
||||
TstPrn_RemoveCrsExams (CrsCod);
|
||||
TstPrn_RemoveCrsPrints (CrsCod);
|
||||
|
||||
/***** Remove all tests questions in the course *****/
|
||||
Tst_RemoveCrsTests (CrsCod);
|
||||
|
|
|
@ -4128,7 +4128,7 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,
|
|||
Brw_RemoveSomeInfoAboutCrsUsrFilesFromDB (UsrDat->UsrCod,Crs->CrsCod);
|
||||
|
||||
/***** Remove test results made by user in course *****/
|
||||
TstPrn_RemoveExamsMadeByUsrInCrs (UsrDat->UsrCod,Crs->CrsCod);
|
||||
TstPrn_RemovePrintsMadeByUsrInCrs (UsrDat->UsrCod,Crs->CrsCod);
|
||||
|
||||
/***** Set all the notifications for this user in this course as removed,
|
||||
except notifications about new messages *****/
|
||||
|
|
|
@ -1556,8 +1556,8 @@ static void ExaSet_ListQuestionForEdition (const struct Tst_Question *Question,
|
|||
|
||||
/* Show media */
|
||||
Med_ShowMedia (&Question->Media,
|
||||
"TEST_MED_EDIT_LIST_STEM_CONTAINER",
|
||||
"TEST_MED_EDIT_LIST_STEM");
|
||||
"TEST_MED_EDIT_LIST_CONT",
|
||||
"TEST_MED_EDIT_LIST");
|
||||
|
||||
/* Show feedback */
|
||||
Tst_WriteQstFeedback (Question->Feedback,"TEST_EDI_LIGHT");
|
||||
|
|
178
swad_match.c
178
swad_match.c
|
@ -227,11 +227,11 @@ static void Mch_SetMatchAsNotBeingPlayed (long MchCod);
|
|||
static bool Mch_GetIfMatchIsBeingPlayed (long MchCod);
|
||||
static void Mch_GetNumPlayers (struct Mch_Match *Match);
|
||||
|
||||
static void Mch_UpdateMyAnswerToMatchQuestion (const struct Mch_Match *Match,
|
||||
const struct Mch_UsrAnswer *UsrAnswer);
|
||||
static void Mch_RemoveMyAnswerToMatchQuestion (const struct Mch_Match *Match);
|
||||
|
||||
static void Mch_ComputeScore (struct TstPrn_Print *Print);
|
||||
|
||||
static unsigned Mch_GetNumUsrsWhoHaveAnswerMch (long MchCod);
|
||||
static unsigned Mch_GetNumUsrsWhoHavePlayedMch (long MchCod);
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************** Set/Get match code of the match being played ****************/
|
||||
|
@ -511,7 +511,7 @@ static void Mch_ListOneOrMoreMatches (struct Gam_Games *Games,
|
|||
/* Title and groups */
|
||||
Mch_ListOneOrMoreMatchesTitleGrps (&Match);
|
||||
|
||||
/* Number of players who have answered any question in the match */
|
||||
/* Number of players who have played the match */
|
||||
Mch_ListOneOrMoreMatchesNumPlayers (&Match);
|
||||
|
||||
/* Match status */
|
||||
|
@ -762,7 +762,7 @@ static void Mch_ListOneOrMoreMatchesNumPlayers (const struct Mch_Match *Match)
|
|||
{
|
||||
/***** Number of players who have answered any question in the match ******/
|
||||
HTM_TD_Begin ("class=\"DAT RT COLOR%u\"",Gbl.RowEvenOdd);
|
||||
HTM_Unsigned (Mch_GetNumUsrsWhoHaveAnswerMch (Match->MchCod));
|
||||
HTM_Unsigned (Mch_GetNumUsrsWhoHavePlayedMch (Match->MchCod));
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
|
@ -3012,8 +3012,8 @@ static void Mch_ShowQuestionAndAnswersTch (const struct Mch_Match *Match)
|
|||
|
||||
/* Show media */
|
||||
Med_ShowMedia (&Question.Media,
|
||||
"TEST_MED_EDIT_LIST_STEM_CONTAINER",
|
||||
"TEST_MED_EDIT_LIST_STEM");
|
||||
"TEST_MED_EDIT_LIST_CONT",
|
||||
"TEST_MED_EDIT_LIST");
|
||||
|
||||
/***** Write answers? *****/
|
||||
switch (Match->Status.Showing)
|
||||
|
@ -3710,9 +3710,14 @@ void Mch_RemoveMyQuestionAnswer (void)
|
|||
if (Match.Status.Playing && // Match is being played
|
||||
Match.Status.Showing == Mch_ANSWERS && // Teacher's screen is showing answers
|
||||
QstInd == Match.Status.QstInd) // Removing answer to the current question being played
|
||||
/***** Remove answer to this question *****/
|
||||
{
|
||||
/***** Remove my answer to this question *****/
|
||||
Mch_RemoveMyAnswerToMatchQuestion (&Match);
|
||||
|
||||
/***** Compute score and update my match result *****/
|
||||
MchRes_ComputeScoreAndUpdateMyMatchResult (Match.MchCod);
|
||||
}
|
||||
|
||||
/***** Show current match status *****/
|
||||
HTM_DIV_Begin ("id=\"match\" class=\"MCH_CONT\"");
|
||||
Mch_ShowMatchStatusForStd (&Match,Mch_CHANGE_STATUS_BY_STUDENT);
|
||||
|
@ -3888,7 +3893,6 @@ void Mch_ReceiveQuestionAnswer (void)
|
|||
unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION];
|
||||
struct Mch_UsrAnswer PreviousUsrAnswer;
|
||||
struct Mch_UsrAnswer UsrAnswer;
|
||||
struct TstPrn_Print Print;
|
||||
|
||||
/***** Reset match *****/
|
||||
Mch_ResetMatch (&Match);
|
||||
|
@ -3902,7 +3906,8 @@ void Mch_ReceiveQuestionAnswer (void)
|
|||
|
||||
/***** Check that teacher's screen is showing answers
|
||||
and question index is the current one being played *****/
|
||||
if (Match.Status.Showing == Mch_ANSWERS && // Teacher's screen is showing answers
|
||||
if (Match.Status.Playing && // Match is being played
|
||||
Match.Status.Showing == Mch_ANSWERS && // Teacher's screen is showing answers
|
||||
QstInd == Match.Status.QstInd) // Receiving an answer to the current question being played
|
||||
{
|
||||
/***** Get indexes for this question from database *****/
|
||||
|
@ -3911,7 +3916,7 @@ void Mch_ReceiveQuestionAnswer (void)
|
|||
/***** Get answer index *****/
|
||||
/*
|
||||
Indexes[4] = {0,3,1,2}
|
||||
+-------+--------+----------+---------+
|
||||
+--------+--------+----------+---------+
|
||||
| Button | Option | Answer | Correct |
|
||||
| letter | number | index | |
|
||||
| screen | screen | database | |
|
||||
|
@ -3936,55 +3941,13 @@ void Mch_ReceiveQuestionAnswer (void)
|
|||
if (UsrAnswer.NumOpt >= 0 &&
|
||||
UsrAnswer.AnsInd >= 0 &&
|
||||
UsrAnswer.AnsInd != PreviousUsrAnswer.AnsInd)
|
||||
DB_QueryREPLACE ("can not register your answer to the match question",
|
||||
"REPLACE mch_answers"
|
||||
" (MchCod,UsrCod,QstInd,NumOpt,AnsInd)"
|
||||
" VALUES"
|
||||
" (%ld,%ld,%u,%d,%d)",
|
||||
Match.MchCod,Gbl.Usrs.Me.UsrDat.UsrCod,Match.Status.QstInd,
|
||||
UsrAnswer.NumOpt,
|
||||
UsrAnswer.AnsInd);
|
||||
{
|
||||
/***** Update my answer to this question *****/
|
||||
Mch_UpdateMyAnswerToMatchQuestion (&Match,&UsrAnswer);
|
||||
|
||||
/***** Update student's match result *****/
|
||||
MchRes_GetMatchResultQuestionsFromDB (Match.MchCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
&Print);
|
||||
Mch_ComputeScore (&Print);
|
||||
|
||||
Str_SetDecimalPointToUS (); // To print the floating point as a dot
|
||||
if (DB_QueryCOUNT ("can not get if match result exists",
|
||||
"SELECT COUNT(*) FROM mch_results"
|
||||
" WHERE MchCod=%ld AND UsrCod=%ld",
|
||||
Match.MchCod,Gbl.Usrs.Me.UsrDat.UsrCod)) // Match print exists
|
||||
/* Update result */
|
||||
DB_QueryUPDATE ("can not update match result",
|
||||
"UPDATE mch_results"
|
||||
" SET EndTime=NOW(),"
|
||||
"NumQsts=%u,"
|
||||
"NumQstsNotBlank=%u,"
|
||||
"Score='%.15lg'"
|
||||
" WHERE MchCod=%ld AND UsrCod=%ld",
|
||||
Print.NumQsts,
|
||||
Print.NumQstsNotBlank,
|
||||
Print.Score,
|
||||
Match.MchCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
else // Match print doesn't exist
|
||||
/* Create result */
|
||||
DB_QueryINSERT ("can not create match result",
|
||||
"INSERT mch_results "
|
||||
"(MchCod,UsrCod,StartTime,EndTime,NumQsts,NumQstsNotBlank,Score)"
|
||||
" VALUES "
|
||||
"(%ld," // MchCod
|
||||
"%ld," // UsrCod
|
||||
"NOW()," // StartTime
|
||||
"NOW()," // EndTime
|
||||
"%u," // NumQsts
|
||||
"%u," // NumQstsNotBlank
|
||||
"'%.15lg')", // Score
|
||||
Match.MchCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Print.NumQsts,
|
||||
Print.NumQstsNotBlank,
|
||||
Print.Score);
|
||||
Str_SetDecimalPointToLocal (); // Return to local system
|
||||
/***** Compute score and update my match result *****/
|
||||
MchRes_ComputeScoreAndUpdateMyMatchResult (Match.MchCod);
|
||||
}
|
||||
}
|
||||
|
||||
/***** Show current match status *****/
|
||||
|
@ -3994,7 +3957,24 @@ void Mch_ReceiveQuestionAnswer (void)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Remove answer to match question ***********************/
|
||||
/******************** Update my answer to match question *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Mch_UpdateMyAnswerToMatchQuestion (const struct Mch_Match *Match,
|
||||
const struct Mch_UsrAnswer *UsrAnswer)
|
||||
{
|
||||
DB_QueryREPLACE ("can not register your answer to the match question",
|
||||
"REPLACE mch_answers"
|
||||
" (MchCod,UsrCod,QstInd,NumOpt,AnsInd)"
|
||||
" VALUES"
|
||||
" (%ld,%ld,%u,%d,%d)",
|
||||
Match->MchCod,Gbl.Usrs.Me.UsrDat.UsrCod,Match->Status.QstInd,
|
||||
UsrAnswer->NumOpt,
|
||||
UsrAnswer->AnsInd);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Remove my answer to match question **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Mch_RemoveMyAnswerToMatchQuestion (const struct Mch_Match *Match)
|
||||
|
@ -4005,11 +3985,74 @@ static void Mch_RemoveMyAnswerToMatchQuestion (const struct Mch_Match *Match)
|
|||
Match->MchCod,Gbl.Usrs.Me.UsrDat.UsrCod,Match->Status.QstInd);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************** Get the questions of a match from database ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Mch_GetMatchQuestionsFromDB (long MchCod,long UsrCod,
|
||||
struct TstPrn_Print *Print)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned NumQst;
|
||||
long LongNum;
|
||||
unsigned QstInd;
|
||||
struct Mch_UsrAnswer UsrAnswer;
|
||||
|
||||
/***** Get questions and answers of a match result *****/
|
||||
Print->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, Print->NumQstsNotBlank = 0;
|
||||
NumQst < Print->NumQsts;
|
||||
NumQst++)
|
||||
{
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get question code (row[0]) */
|
||||
if ((Print->PrintedQuestions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
||||
|
||||
/* Get question index (row[1]) */
|
||||
if ((LongNum = Str_ConvertStrCodToLongCod (row[1])) < 0)
|
||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
||||
QstInd = (unsigned) LongNum;
|
||||
|
||||
/* Get indexes for this question (row[2]) */
|
||||
Str_Copy (Print->PrintedQuestions[NumQst].StrIndexes,row[2],
|
||||
Tst_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 (Print->PrintedQuestions[NumQst].StrAnswers,Tst_MAX_BYTES_ANSWERS_ONE_QST + 1,
|
||||
"%d",UsrAnswer.AnsInd);
|
||||
Print->NumQstsNotBlank++;
|
||||
}
|
||||
else // UsrAnswer.AnsInd < 0 ==> no answer selected
|
||||
Print->PrintedQuestions[NumQst].StrAnswers[0] = '\0'; // Empty answer
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Compute match score for a student **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Mch_ComputeScore (struct TstPrn_Print *Print)
|
||||
void Mch_ComputeScore (struct TstPrn_Print *Print)
|
||||
{
|
||||
unsigned NumQst;
|
||||
struct Tst_Question Question;
|
||||
|
@ -4065,16 +4108,17 @@ unsigned Mch_GetNumUsrsWhoHaveChosenAns (long MchCod,unsigned QstInd,unsigned An
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****** Get number of users who have answered any question in a match ********/
|
||||
/************ Get number of users who have played a given match **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static unsigned Mch_GetNumUsrsWhoHaveAnswerMch (long MchCod)
|
||||
static unsigned Mch_GetNumUsrsWhoHavePlayedMch (long MchCod)
|
||||
{
|
||||
/***** Get number of users who have answered
|
||||
any question in match from database *****/
|
||||
/***** Get number of users who have played the match
|
||||
(users who have a result for this match, even blank result)
|
||||
from database *****/
|
||||
return
|
||||
(unsigned) DB_QueryCOUNT ("can not get number of users who have answered a match",
|
||||
"SELECT COUNT(DISTINCT UsrCod) FROM mch_answers"
|
||||
(unsigned) DB_QueryCOUNT ("can not get number of users who have played a match",
|
||||
"SELECT COUNT(*) FROM mch_results"
|
||||
" WHERE MchCod=%ld",
|
||||
MchCod);
|
||||
}
|
||||
|
|
|
@ -144,6 +144,11 @@ void Mch_GetQstAnsFromDB (long MchCod,long UsrCod,unsigned QstInd,
|
|||
struct Mch_UsrAnswer *UsrAnswer);
|
||||
void Mch_ReceiveQuestionAnswer (void);
|
||||
|
||||
void Mch_GetMatchQuestionsFromDB (long MchCod,long UsrCod,
|
||||
struct TstPrn_Print *Print);
|
||||
|
||||
void Mch_ComputeScore (struct TstPrn_Print *Print);
|
||||
|
||||
unsigned Mch_GetNumUsrsWhoAnsweredQst (long MchCod,unsigned QstInd);
|
||||
unsigned Mch_GetNumUsrsWhoHaveChosenAns (long MchCod,unsigned QstInd,unsigned AnsInd);
|
||||
void Mch_DrawBarNumUsrs (unsigned NumRespondersAns,unsigned NumRespondersQst,bool Correct);
|
||||
|
|
|
@ -71,6 +71,8 @@ extern struct Globals Gbl;
|
|||
/***************************** Private prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void MchRes_UpdateMyMatchResult (long MchCod,const struct TstPrn_Print *Print);
|
||||
|
||||
static void MchRes_PutFormToSelUsrsToViewMchResults (void *Games);
|
||||
|
||||
static void MchRes_ListMyMchResultsInCrs (struct Gam_Games *Games);
|
||||
|
@ -106,6 +108,66 @@ static void MchRes_GetMatchResultDataByMchCod (long MchCod,long UsrCod,
|
|||
static bool MchRes_CheckIfICanSeeMatchResult (struct Mch_Match *Match,long UsrCod);
|
||||
static bool MchRes_CheckIfICanViewScore (bool ICanViewResult,unsigned Visibility);
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********** Compute score and create/update my result in a match ************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void MchRes_ComputeScoreAndUpdateMyMatchResult (long MchCod)
|
||||
{
|
||||
struct TstPrn_Print Print;
|
||||
|
||||
/***** Compute my match result *****/
|
||||
TstPrn_ResetPrint (&Print);
|
||||
Mch_GetMatchQuestionsFromDB (MchCod,Gbl.Usrs.Me.UsrDat.UsrCod,&Print);
|
||||
Mch_ComputeScore (&Print);
|
||||
|
||||
/***** Update my match result in database *****/
|
||||
MchRes_UpdateMyMatchResult (MchCod,&Print);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Create/update my result in a match *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void MchRes_UpdateMyMatchResult (long MchCod,const struct TstPrn_Print *Print)
|
||||
{
|
||||
Str_SetDecimalPointToUS (); // To print the floating point as a dot
|
||||
if (DB_QueryCOUNT ("can not get if match result exists",
|
||||
"SELECT COUNT(*) FROM mch_results"
|
||||
" WHERE MchCod=%ld AND UsrCod=%ld",
|
||||
MchCod,Gbl.Usrs.Me.UsrDat.UsrCod)) // Match print exists
|
||||
/* Update result */
|
||||
DB_QueryUPDATE ("can not update match result",
|
||||
"UPDATE mch_results"
|
||||
" SET EndTime=NOW(),"
|
||||
"NumQsts=%u,"
|
||||
"NumQstsNotBlank=%u,"
|
||||
"Score='%.15lg'"
|
||||
" WHERE MchCod=%ld AND UsrCod=%ld",
|
||||
Print->NumQsts,
|
||||
Print->NumQstsNotBlank,
|
||||
Print->Score,
|
||||
MchCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
else // Match print doesn't exist
|
||||
/* Create result */
|
||||
DB_QueryINSERT ("can not create match result",
|
||||
"INSERT mch_results "
|
||||
"(MchCod,UsrCod,StartTime,EndTime,NumQsts,NumQstsNotBlank,Score)"
|
||||
" VALUES "
|
||||
"(%ld," // MchCod
|
||||
"%ld," // UsrCod
|
||||
"NOW()," // StartTime
|
||||
"NOW()," // EndTime
|
||||
"%u," // NumQsts
|
||||
"%u," // NumQstsNotBlank
|
||||
"'%.15lg')", // Score
|
||||
MchCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Print->NumQsts,
|
||||
Print->NumQstsNotBlank,
|
||||
Print->Score);
|
||||
Str_SetDecimalPointToLocal (); // Return to local system
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************************** Show my matches results *************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -1144,8 +1206,7 @@ void MchRes_ShowOneMchResult (void)
|
|||
if (ICanViewResult) // I am allowed to view this match result
|
||||
{
|
||||
/***** Get questions and user's answers of the match result from database *****/
|
||||
MchRes_GetMatchResultQuestionsFromDB (Match.MchCod,UsrDat->UsrCod,
|
||||
&Print);
|
||||
Mch_GetMatchQuestionsFromDB (Match.MchCod,UsrDat->UsrCod,&Print);
|
||||
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin (NULL,Match.Title,
|
||||
|
@ -1274,7 +1335,7 @@ void MchRes_ShowOneMchResult (void)
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Write answers and solutions *****/
|
||||
TstPrn_ShowExamAnswers (UsrDat,&Print,Game.Visibility);
|
||||
TstPrn_ShowPrintAnswers (UsrDat,&Print,Game.Visibility);
|
||||
|
||||
/***** End table *****/
|
||||
HTM_TABLE_End ();
|
||||
|
@ -1299,69 +1360,6 @@ void MchRes_ShowOneMchResult (void)
|
|||
Lay_NoPermissionExit ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************ Get the questions of a match result from database **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void MchRes_GetMatchResultQuestionsFromDB (long MchCod,long UsrCod,
|
||||
struct TstPrn_Print *Print)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned NumQst;
|
||||
long LongNum;
|
||||
unsigned QstInd;
|
||||
struct Mch_UsrAnswer UsrAnswer;
|
||||
|
||||
/***** Get questions and answers of a match result *****/
|
||||
Print->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, Print->NumQstsNotBlank = 0;
|
||||
NumQst < Print->NumQsts;
|
||||
NumQst++)
|
||||
{
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get question code (row[0]) */
|
||||
if ((Print->PrintedQuestions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
||||
|
||||
/* Get question index (row[1]) */
|
||||
if ((LongNum = Str_ConvertStrCodToLongCod (row[1])) < 0)
|
||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
||||
QstInd = (unsigned) LongNum;
|
||||
|
||||
/* Get indexes for this question (row[2]) */
|
||||
Str_Copy (Print->PrintedQuestions[NumQst].StrIndexes,row[2],
|
||||
Tst_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 (Print->PrintedQuestions[NumQst].StrAnswers,Tst_MAX_BYTES_ANSWERS_ONE_QST + 1,
|
||||
"%d",UsrAnswer.AnsInd);
|
||||
Print->NumQstsNotBlank++;
|
||||
}
|
||||
else // UsrAnswer.AnsInd < 0 ==> no answer selected
|
||||
Print->PrintedQuestions[NumQst].StrAnswers[0] = '\0'; // Empty answer
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Get data of a match result using its match code ***************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void MchRes_ComputeScoreAndUpdateMyMatchResult (long MchCod);
|
||||
|
||||
void MchRes_ShowMyMchResultsInCrs (void);
|
||||
void MchRes_ShowMyMchResultsInGam (void);
|
||||
void MchRes_ShowMyMchResultsInMch (void);
|
||||
|
@ -50,7 +52,5 @@ void MchRes_ShowAllMchResultsInGam (void);
|
|||
void MchRes_ShowAllMchResultsInMch (void);
|
||||
|
||||
void MchRes_ShowOneMchResult (void);
|
||||
void MchRes_GetMatchResultQuestionsFromDB (long MchCod,long UsrCod,
|
||||
struct TstPrn_Print *Print);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -580,7 +580,7 @@ void Tst_AssessTest (void)
|
|||
}
|
||||
|
||||
/***** Write answers and solutions *****/
|
||||
TstPrn_ShowExamAfterAssess (&Print);
|
||||
TstPrn_ShowPrintAfterAssess (&Print);
|
||||
|
||||
/***** Write total score and grade *****/
|
||||
if (TstVis_IsVisibleTotalScore (TstCfg_GetConfigVisibility ()))
|
||||
|
@ -923,8 +923,8 @@ void Tst_ListQuestionForEdition (const struct Tst_Question *Question,
|
|||
|
||||
/* Show media */
|
||||
Med_ShowMedia (&Question->Media,
|
||||
"TEST_MED_EDIT_LIST_STEM_CONTAINER",
|
||||
"TEST_MED_EDIT_LIST_STEM");
|
||||
"TEST_MED_EDIT_LIST_CONT",
|
||||
"TEST_MED_EDIT_LIST");
|
||||
|
||||
/* Show feedback */
|
||||
Tst_WriteQstFeedback (Question->Feedback,"TEST_EDI_LIGHT");
|
||||
|
|
|
@ -102,26 +102,26 @@ static void TstPrn_GetCorrectTxtAnswerFromDB (struct Tst_Question *Question);
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static void TstPrn_WriteIntAnsExam (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility);
|
||||
static void TstPrn_WriteFltAnsExam (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility);
|
||||
static void TstPrn_WriteTF_AnsExam (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility);
|
||||
static void TstPrn_WriteChoAnsExam (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility);
|
||||
static void TstPrn_WriteTxtAnsExam (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility);
|
||||
static void TstPrn_WriteIntAnsPrint (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility);
|
||||
static void TstPrn_WriteFltAnsPrint (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility);
|
||||
static void TstPrn_WriteTF_AnsPrint (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility);
|
||||
static void TstPrn_WriteChoAnsPrint (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility);
|
||||
static void TstPrn_WriteTxtAnsPrint (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
@ -130,17 +130,17 @@ static void TstPrn_WriteHeadUserCorrect (struct UsrData *UsrDat);
|
|||
static void TstPrn_StoreOneQstOfPrintInDB (const struct TstPrn_Print *Print,
|
||||
unsigned NumQst);
|
||||
|
||||
static void TstPrn_PutFormToSelectUsrsToViewUsrsExams (__attribute__((unused)) void *Args);
|
||||
static void TstPrn_PutFormToSelectUsrsToViewUsrsPrints (__attribute__((unused)) void *Args);
|
||||
|
||||
static void TstPrn_ShowUsrsExams (__attribute__((unused)) void *Args);
|
||||
static void TstPrn_ShowHeaderExams (void);
|
||||
static void TstPrn_ShowExams (struct UsrData *UsrDat);
|
||||
static void TstPrn_ShowExamsSummaryRow (bool ItsMe,
|
||||
unsigned NumExams,
|
||||
unsigned NumTotalQsts,
|
||||
unsigned NumTotalQstsNotBlank,
|
||||
double TotalScoreOfAllTests);
|
||||
static void TstPrn_ShowTagsPresentInAnExam (long ResCod);
|
||||
static void TstPrn_ShowUsrsPrints (__attribute__((unused)) void *Args);
|
||||
static void TstPrn_ShowHeaderPrints (void);
|
||||
static void TstPrn_ShowUsrPrints (struct UsrData *UsrDat);
|
||||
static void TstPrn_ShowPrintsSummaryRow (bool ItsMe,
|
||||
unsigned NumPrints,
|
||||
unsigned NumTotalQsts,
|
||||
unsigned NumTotalQstsNotBlank,
|
||||
double TotalScoreOfAllTests);
|
||||
static void TstPrn_ShowTagsPresentInAPrint (long ResCod);
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************** Reset exam *********************************/
|
||||
|
@ -214,7 +214,7 @@ void TstPrn_UpdatePrintInDB (const struct TstPrn_Print *Print)
|
|||
/********************* Show test exam after assessing it *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TstPrn_ShowExamAfterAssess (struct TstPrn_Print *Print)
|
||||
void TstPrn_ShowPrintAfterAssess (struct TstPrn_Print *Print)
|
||||
{
|
||||
unsigned NumQst;
|
||||
struct Tst_Question Question;
|
||||
|
@ -899,12 +899,12 @@ void TstPrn_WriteAnswersExam (struct UsrData *UsrDat,
|
|||
const struct Tst_Question *Question,
|
||||
unsigned Visibility) =
|
||||
{
|
||||
[Tst_ANS_INT ] = TstPrn_WriteIntAnsExam,
|
||||
[Tst_ANS_FLOAT ] = TstPrn_WriteFltAnsExam,
|
||||
[Tst_ANS_TRUE_FALSE ] = TstPrn_WriteTF_AnsExam,
|
||||
[Tst_ANS_UNIQUE_CHOICE ] = TstPrn_WriteChoAnsExam,
|
||||
[Tst_ANS_MULTIPLE_CHOICE] = TstPrn_WriteChoAnsExam,
|
||||
[Tst_ANS_TEXT ] = TstPrn_WriteTxtAnsExam,
|
||||
[Tst_ANS_INT ] = TstPrn_WriteIntAnsPrint,
|
||||
[Tst_ANS_FLOAT ] = TstPrn_WriteFltAnsPrint,
|
||||
[Tst_ANS_TRUE_FALSE ] = TstPrn_WriteTF_AnsPrint,
|
||||
[Tst_ANS_UNIQUE_CHOICE ] = TstPrn_WriteChoAnsPrint,
|
||||
[Tst_ANS_MULTIPLE_CHOICE] = TstPrn_WriteChoAnsPrint,
|
||||
[Tst_ANS_TEXT ] = TstPrn_WriteTxtAnsPrint,
|
||||
};
|
||||
|
||||
/***** Get correct answer and compute answer score depending on type *****/
|
||||
|
@ -912,13 +912,13 @@ void TstPrn_WriteAnswersExam (struct UsrData *UsrDat,
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Write integer answer in a test exam *********************/
|
||||
/******************* Write integer answer in a test print ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void TstPrn_WriteIntAnsExam (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility)
|
||||
static void TstPrn_WriteIntAnsPrint (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility)
|
||||
{
|
||||
long IntAnswerUsr;
|
||||
|
||||
|
@ -971,13 +971,13 @@ static void TstPrn_WriteIntAnsExam (struct UsrData *UsrDat,
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Write float answer in an test exam *********************/
|
||||
/******************** Write float answer in an test print ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void TstPrn_WriteFltAnsExam (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility)
|
||||
static void TstPrn_WriteFltAnsPrint (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility)
|
||||
{
|
||||
double FloatAnsUsr = 0.0;
|
||||
|
||||
|
@ -1031,13 +1031,13 @@ static void TstPrn_WriteFltAnsExam (struct UsrData *UsrDat,
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Write false / true answer in a test exam ******************/
|
||||
/***************** Write false / true answer in a test print *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void TstPrn_WriteTF_AnsExam (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility)
|
||||
static void TstPrn_WriteTF_AnsPrint (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility)
|
||||
{
|
||||
char AnsTFUsr;
|
||||
|
||||
|
@ -1079,13 +1079,13 @@ static void TstPrn_WriteTF_AnsExam (struct UsrData *UsrDat,
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********** Write single or multiple choice answer in a test exam ************/
|
||||
/********** Write single or multiple choice answer in a test print ***********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void TstPrn_WriteChoAnsExam (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility)
|
||||
static void TstPrn_WriteChoAnsPrint (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility)
|
||||
{
|
||||
extern const char *Txt_TST_Answer_given_by_the_user;
|
||||
extern const char *Txt_TST_Answer_given_by_the_teachers;
|
||||
|
@ -1207,13 +1207,13 @@ static void TstPrn_WriteChoAnsExam (struct UsrData *UsrDat,
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Write text answer when assessing a test *******************/
|
||||
/************** Write text answer when assessing a test print ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void TstPrn_WriteTxtAnsExam (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility)
|
||||
static void TstPrn_WriteTxtAnsPrint (struct UsrData *UsrDat,
|
||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
const struct Tst_Question *Question,
|
||||
unsigned Visibility)
|
||||
{
|
||||
unsigned NumOpt;
|
||||
char TextAnsUsr[Tst_MAX_BYTES_ANSWERS_ONE_QST + 1];
|
||||
|
@ -1385,12 +1385,12 @@ static void TstPrn_StoreOneQstOfPrintInDB (const struct TstPrn_Print *Print,
|
|||
/************* Select users and dates to show their test exams ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TstPrn_SelUsrsToViewUsrsExams (void)
|
||||
void TstPrn_SelUsrsToViewUsrsPrints (void)
|
||||
{
|
||||
TstPrn_PutFormToSelectUsrsToViewUsrsExams (NULL);
|
||||
TstPrn_PutFormToSelectUsrsToViewUsrsPrints (NULL);
|
||||
}
|
||||
|
||||
static void TstPrn_PutFormToSelectUsrsToViewUsrsExams (__attribute__((unused)) void *Args)
|
||||
static void TstPrn_PutFormToSelectUsrsToViewUsrsPrints (__attribute__((unused)) void *Args)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Tests_results;
|
||||
extern const char *Txt_Results;
|
||||
|
@ -1409,7 +1409,7 @@ static void TstPrn_PutFormToSelectUsrsToViewUsrsExams (__attribute__((unused)) v
|
|||
/******************** Select dates to show my test exams *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TstPrn_SelDatesToSeeMyExams (void)
|
||||
void TstPrn_SelDatesToSeeMyPrints (void)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Tests_results;
|
||||
extern const char *Txt_Results;
|
||||
|
@ -1440,7 +1440,7 @@ void TstPrn_SelDatesToSeeMyExams (void)
|
|||
/***************************** Show my test exams ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TstPrn_ShowMyExams (void)
|
||||
void TstPrn_ShowMyPrints (void)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Tests_results;
|
||||
extern const char *Txt_Results;
|
||||
|
@ -1454,11 +1454,11 @@ void TstPrn_ShowMyExams (void)
|
|||
Hlp_ASSESSMENT_Tests_results,Box_NOT_CLOSABLE,2);
|
||||
|
||||
/***** Header of the table with the list of users *****/
|
||||
TstPrn_ShowHeaderExams ();
|
||||
TstPrn_ShowHeaderPrints ();
|
||||
|
||||
/***** List my test exams *****/
|
||||
TstCfg_GetConfigFromDB (); // To get feedback type
|
||||
TstPrn_ShowExams (&Gbl.Usrs.Me.UsrDat);
|
||||
TstPrn_ShowUsrPrints (&Gbl.Usrs.Me.UsrDat);
|
||||
|
||||
/***** End table and box *****/
|
||||
Box_BoxTableEnd ();
|
||||
|
@ -1468,18 +1468,18 @@ void TstPrn_ShowMyExams (void)
|
|||
/******************** Get users and show their test exams ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TstPrn_GetUsrsAndShowExams (void)
|
||||
void TstPrn_GetUsrsAndShowPrints (void)
|
||||
{
|
||||
Usr_GetSelectedUsrsAndGoToAct (&Gbl.Usrs.Selected,
|
||||
TstPrn_ShowUsrsExams,NULL,
|
||||
TstPrn_PutFormToSelectUsrsToViewUsrsExams,NULL);
|
||||
TstPrn_ShowUsrsPrints,NULL,
|
||||
TstPrn_PutFormToSelectUsrsToViewUsrsPrints,NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Show test exams for several users *********************/
|
||||
/********************* Show test prints for several users ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void TstPrn_ShowUsrsExams (__attribute__((unused)) void *Args)
|
||||
static void TstPrn_ShowUsrsPrints (__attribute__((unused)) void *Args)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Tests_results;
|
||||
extern const char *Txt_Results;
|
||||
|
@ -1494,7 +1494,7 @@ static void TstPrn_ShowUsrsExams (__attribute__((unused)) void *Args)
|
|||
Hlp_ASSESSMENT_Tests_results,Box_NOT_CLOSABLE,2);
|
||||
|
||||
/***** Header of the table with the list of users *****/
|
||||
TstPrn_ShowHeaderExams ();
|
||||
TstPrn_ShowHeaderPrints ();
|
||||
|
||||
/***** List the test exams of the selected users *****/
|
||||
Ptr = Gbl.Usrs.Selected.List[Rol_UNK];
|
||||
|
@ -1508,7 +1508,7 @@ static void TstPrn_ShowUsrsExams (__attribute__((unused)) void *Args)
|
|||
{
|
||||
/***** Show test exams *****/
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
||||
TstPrn_ShowExams (&Gbl.Usrs.Other.UsrDat);
|
||||
TstPrn_ShowUsrPrints (&Gbl.Usrs.Other.UsrDat);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1520,7 +1520,7 @@ static void TstPrn_ShowUsrsExams (__attribute__((unused)) void *Args)
|
|||
/************************ Show header of my test exams ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void TstPrn_ShowHeaderExams (void)
|
||||
static void TstPrn_ShowHeaderPrints (void)
|
||||
{
|
||||
extern const char *Txt_User[Usr_NUM_SEXS];
|
||||
extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME];
|
||||
|
@ -1546,16 +1546,16 @@ static void TstPrn_ShowHeaderExams (void)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************ Show the test exams of a user in the current course ************/
|
||||
/************ Show the test prints of a user in the current course ***********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void TstPrn_ShowExams (struct UsrData *UsrDat)
|
||||
static void TstPrn_ShowUsrPrints (struct UsrData *UsrDat)
|
||||
{
|
||||
extern const char *Txt_View_test;
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned NumExams;
|
||||
unsigned NumExam;
|
||||
unsigned NumPrints;
|
||||
unsigned NumPrint;
|
||||
static unsigned UniqueId = 0;
|
||||
Dat_StartEndTime_t StartEndTime;
|
||||
char *Id;
|
||||
|
@ -1563,7 +1563,7 @@ static void TstPrn_ShowExams (struct UsrData *UsrDat)
|
|||
unsigned NumTotalQsts = 0;
|
||||
unsigned NumTotalQstsNotBlank = 0;
|
||||
double TotalScoreOfAllTests = 0.0;
|
||||
unsigned NumExamsVisibleByTchs = 0;
|
||||
unsigned NumPrintsVisibleByTchs = 0;
|
||||
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||
struct
|
||||
{
|
||||
|
@ -1579,7 +1579,7 @@ static void TstPrn_ShowExams (struct UsrData *UsrDat)
|
|||
-----|______Exam_|_____|-----------------|_____|_Exam______|-----> time
|
||||
Start | End Start | End
|
||||
*/
|
||||
NumExams =
|
||||
NumPrints =
|
||||
(unsigned) DB_QuerySELECT (&mysql_res,"can not get test exams of a user",
|
||||
"SELECT ExaCod," // row[0]
|
||||
"UNIX_TIMESTAMP(StartTime)," // row[1]
|
||||
|
@ -1601,14 +1601,14 @@ static void TstPrn_ShowExams (struct UsrData *UsrDat)
|
|||
|
||||
/***** Show user's data *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
Usr_ShowTableCellWithUsrData (UsrDat,NumExams);
|
||||
Usr_ShowTableCellWithUsrData (UsrDat,NumPrints);
|
||||
|
||||
/***** Get and print test exams *****/
|
||||
if (NumExams)
|
||||
if (NumPrints)
|
||||
{
|
||||
for (NumExam = 0;
|
||||
NumExam < NumExams;
|
||||
NumExam++)
|
||||
for (NumPrint = 0;
|
||||
NumPrint < NumPrints;
|
||||
NumPrint++)
|
||||
{
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
|
@ -1655,7 +1655,7 @@ static void TstPrn_ShowExams (struct UsrData *UsrDat)
|
|||
break;
|
||||
}
|
||||
|
||||
if (NumExam)
|
||||
if (NumPrint)
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
/* Write date and time (row[1] and row[2] hold UTC date-times) */
|
||||
|
@ -1744,11 +1744,11 @@ static void TstPrn_ShowExams (struct UsrData *UsrDat)
|
|||
HTM_TR_End ();
|
||||
|
||||
if (Print.AllowTeachers)
|
||||
NumExamsVisibleByTchs++;
|
||||
NumPrintsVisibleByTchs++;
|
||||
}
|
||||
|
||||
/***** Write totals for this user *****/
|
||||
TstPrn_ShowExamsSummaryRow (ItsMe,NumExamsVisibleByTchs,
|
||||
TstPrn_ShowPrintsSummaryRow (ItsMe,NumPrintsVisibleByTchs,
|
||||
NumTotalQsts,NumTotalQstsNotBlank,
|
||||
TotalScoreOfAllTests);
|
||||
}
|
||||
|
@ -1787,8 +1787,8 @@ long TstPrn_GetParamPrnCod (void)
|
|||
/**************** Show row with summary of user's test exams *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void TstPrn_ShowExamsSummaryRow (bool ItsMe,
|
||||
unsigned NumExams,
|
||||
static void TstPrn_ShowPrintsSummaryRow (bool ItsMe,
|
||||
unsigned NumPrints,
|
||||
unsigned NumTotalQsts,
|
||||
unsigned NumTotalQstsNotBlank,
|
||||
double TotalScoreOfAllTests)
|
||||
|
@ -1808,7 +1808,7 @@ static void TstPrn_ShowExamsSummaryRow (bool ItsMe,
|
|||
case Rol_CTR_ADM:
|
||||
case Rol_INS_ADM:
|
||||
ICanViewTotalScore = ItsMe ||
|
||||
NumExams;
|
||||
NumPrints;
|
||||
break;
|
||||
case Rol_SYS_ADM:
|
||||
ICanViewTotalScore = true;
|
||||
|
@ -1824,18 +1824,18 @@ static void TstPrn_ShowExamsSummaryRow (bool ItsMe,
|
|||
/***** Row title *****/
|
||||
HTM_TD_Begin ("colspan=\"2\" class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd);
|
||||
HTM_TxtColonNBSP (Txt_Visible_tests);
|
||||
HTM_Unsigned (NumExams);
|
||||
HTM_Unsigned (NumPrints);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Write total number of questions *****/
|
||||
HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd);
|
||||
if (NumExams)
|
||||
if (NumPrints)
|
||||
HTM_Unsigned (NumTotalQsts);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Write total number of questions not blank *****/
|
||||
HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd);
|
||||
if (NumExams)
|
||||
if (NumPrints)
|
||||
HTM_Unsigned (NumTotalQstsNotBlank);
|
||||
HTM_TD_End ();
|
||||
|
||||
|
@ -1871,7 +1871,7 @@ static void TstPrn_ShowExamsSummaryRow (bool ItsMe,
|
|||
/******************** Show one test exam of another user *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TstPrn_ShowOneExam (void)
|
||||
void TstPrn_ShowOnePrint (void)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Tests_results;
|
||||
extern const char *Txt_Result;
|
||||
|
@ -2072,13 +2072,13 @@ void TstPrn_ShowOneExam (void)
|
|||
HTM_TD_End ();
|
||||
|
||||
HTM_TD_Begin ("class=\"DAT LT\"");
|
||||
TstPrn_ShowTagsPresentInAnExam (Print.PrnCod);
|
||||
TstPrn_ShowTagsPresentInAPrint (Print.PrnCod);
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Write answers and solutions *****/
|
||||
TstPrn_ShowExamAnswers (&Gbl.Usrs.Other.UsrDat,&Print,
|
||||
TstPrn_ShowPrintAnswers (&Gbl.Usrs.Other.UsrDat,&Print,
|
||||
TstCfg_GetConfigVisibility ());
|
||||
|
||||
/***** End table *****/
|
||||
|
@ -2108,7 +2108,7 @@ void TstPrn_ShowOneExam (void)
|
|||
/********************* Show test tags in this test exam **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void TstPrn_ShowTagsPresentInAnExam (long ResCod)
|
||||
static void TstPrn_ShowTagsPresentInAPrint (long ResCod)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
unsigned NumTags;
|
||||
|
@ -2137,7 +2137,7 @@ static void TstPrn_ShowTagsPresentInAnExam (long ResCod)
|
|||
/************** Show user's and correct answers of a test exam ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TstPrn_ShowExamAnswers (struct UsrData *UsrDat,
|
||||
void TstPrn_ShowPrintAnswers (struct UsrData *UsrDat,
|
||||
struct TstPrn_Print *Print,
|
||||
unsigned Visibility)
|
||||
{
|
||||
|
@ -2290,7 +2290,7 @@ void TstPrn_GetPrintQuestionsFromDB (struct TstPrn_Print *Print)
|
|||
/********************** Remove test exams made by a user *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TstPrn_RemoveExamsMadeByUsrInAllCrss (long UsrCod)
|
||||
void TstPrn_RemovePrintsMadeByUsrInAllCrss (long UsrCod)
|
||||
{
|
||||
/***** Remove test exams made by the specified user *****/
|
||||
DB_QueryDELETE ("can not remove test exams made by a user",
|
||||
|
@ -2310,7 +2310,7 @@ void TstPrn_RemoveExamsMadeByUsrInAllCrss (long UsrCod)
|
|||
/*************** Remove test exams made by a user in a course ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TstPrn_RemoveExamsMadeByUsrInCrs (long UsrCod,long CrsCod)
|
||||
void TstPrn_RemovePrintsMadeByUsrInCrs (long UsrCod,long CrsCod)
|
||||
{
|
||||
/***** Remove test exams made by the given user *****/
|
||||
DB_QueryDELETE ("can not remove test exams made by a user in a course",
|
||||
|
@ -2330,7 +2330,7 @@ void TstPrn_RemoveExamsMadeByUsrInCrs (long UsrCod,long CrsCod)
|
|||
/******************* Remove all test exams made in a course ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TstPrn_RemoveCrsExams (long CrsCod)
|
||||
void TstPrn_RemoveCrsPrints (long CrsCod)
|
||||
{
|
||||
/***** Remove questions of test exams made in the course *****/
|
||||
DB_QueryDELETE ("can not remove test exams made in a course",
|
||||
|
|
|
@ -70,10 +70,10 @@ void TstPrn_ResetPrint (struct TstPrn_Print *Print);
|
|||
void TstPrn_CreatePrintInDB (struct TstPrn_Print *Print);
|
||||
void TstPrn_UpdatePrintInDB (const struct TstPrn_Print *Print);
|
||||
|
||||
void TstPrn_ShowExamAfterAssess (struct TstPrn_Print *Print);
|
||||
void TstPrn_ShowPrintAfterAssess (struct TstPrn_Print *Print);
|
||||
|
||||
void TstPrn_ComputeScoresAndStoreQuestionsOfPrint (struct TstPrn_Print *Print,
|
||||
bool UpdateQstScore);
|
||||
bool UpdateQstScore);
|
||||
void TstPrn_ComputeAnswerScore (struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||
struct Tst_Question *Question);
|
||||
|
||||
|
@ -105,23 +105,23 @@ void TstPrn_WriteAnswersExam (struct UsrData *UsrDat,
|
|||
const struct Tst_Question *Question,
|
||||
unsigned Visibility);
|
||||
|
||||
void TstPrn_SelUsrsToViewUsrsExams (void);
|
||||
void TstPrn_SelDatesToSeeMyExams (void);
|
||||
void TstPrn_ShowMyExams (void);
|
||||
void TstPrn_GetUsrsAndShowExams (void);
|
||||
void TstPrn_SelUsrsToViewUsrsPrints (void);
|
||||
void TstPrn_SelDatesToSeeMyPrints (void);
|
||||
void TstPrn_ShowMyPrints (void);
|
||||
void TstPrn_GetUsrsAndShowPrints (void);
|
||||
|
||||
void TstPrn_PutParamPrnCod (long ExaCod);
|
||||
long TstPrn_GetParamPrnCod (void);
|
||||
|
||||
void TstPrn_ShowOneExam (void);
|
||||
void TstPrn_ShowExamAnswers (struct UsrData *UsrDat,
|
||||
struct TstPrn_Print *Print,
|
||||
unsigned Visibility);
|
||||
void TstPrn_ShowOnePrint (void);
|
||||
void TstPrn_ShowPrintAnswers (struct UsrData *UsrDat,
|
||||
struct TstPrn_Print *Print,
|
||||
unsigned Visibility);
|
||||
void TstPrn_GetPrintDataByPrnCod (struct TstPrn_Print *Print);
|
||||
|
||||
void TstPrn_GetPrintQuestionsFromDB (struct TstPrn_Print *Print);
|
||||
void TstPrn_RemoveExamsMadeByUsrInAllCrss (long UsrCod);
|
||||
void TstPrn_RemoveExamsMadeByUsrInCrs (long UsrCod,long CrsCod);
|
||||
void TstPrn_RemoveCrsExams (long CrsCod);
|
||||
void TstPrn_RemovePrintsMadeByUsrInAllCrss (long UsrCod);
|
||||
void TstPrn_RemovePrintsMadeByUsrInCrs (long UsrCod,long CrsCod);
|
||||
void TstPrn_RemoveCrsPrints (long CrsCod);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue