Version19.236.1

This commit is contained in:
acanas 2020-05-18 02:38:51 +02:00
parent 03b484e1d1
commit 1970de36f4
5 changed files with 165 additions and 159 deletions

View File

@ -728,14 +728,14 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
[ActSeeExaPrn ] = {1904,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaPrn_ShowExamPrint ,NULL}, [ActSeeExaPrn ] = {1904,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaPrn_ShowExamPrint ,NULL},
[ActAnsExaPrn ] = {1906,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_AJAX_RFRESH,NULL ,ExaPrn_ReceivePrintAnswer ,NULL}, [ActAnsExaPrn ] = {1906,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_AJAX_RFRESH,NULL ,ExaPrn_ReceivePrintAnswer ,NULL},
[ActSeeMyExaResCrs ] = {1867,-1,TabUnk,ActSeeAllExa ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowMyExaResultsInCrs ,NULL}, [ActSeeMyExaResCrs ] = {1867,-1,TabUnk,ActSeeAllExa ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowMyResultsInCrs ,NULL},
[ActSeeMyExaResExa ] = {1868,-1,TabUnk,ActSeeAllExa ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowMyExaResultsInExa ,NULL}, [ActSeeMyExaResExa ] = {1868,-1,TabUnk,ActSeeAllExa ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowMyResultsInExa ,NULL},
[ActSeeMyExaResSes ] = {1869,-1,TabUnk,ActSeeAllExa ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowMyExaResultsInSes ,NULL}, [ActSeeMyExaResSes ] = {1869,-1,TabUnk,ActSeeAllExa ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowMyResultsInSes ,NULL},
[ActSeeOneExaResMe ] = {1870,-1,TabUnk,ActSeeAllExa ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowOneExaResult ,NULL}, [ActSeeOneExaResMe ] = {1870,-1,TabUnk,ActSeeAllExa ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowOneExaResult ,NULL},
[ActReqSeeAllExaRes ] = {1871,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_SelUsrsToViewExaResults ,NULL}, [ActReqSeeAllExaRes ] = {1871,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_SelUsrsToViewResults ,NULL},
[ActSeeAllExaResCrs ] = {1872,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowAllExaResultsInCrs ,NULL}, [ActSeeAllExaResCrs ] = {1872,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowAllResultsInCrs ,NULL},
[ActSeeAllExaResExa ] = {1873,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowAllExaResultsInExa ,NULL}, [ActSeeAllExaResExa ] = {1873,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowAllResultsInExa ,NULL},
[ActSeeAllExaResSes ] = {1874,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowAllExaResultsInSes ,NULL}, [ActSeeAllExaResSes ] = {1874,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowAllResultsInSes ,NULL},
[ActSeeOneExaResOth ] = {1875,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowOneExaResult ,NULL}, [ActSeeOneExaResOth ] = {1875,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowOneExaResult ,NULL},
[ActChgVisExaRes ] = {1876,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSes_ToggleVisResultsSesUsr ,NULL}, [ActChgVisExaRes ] = {1876,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSes_ToggleVisResultsSesUsr ,NULL},

View File

@ -557,10 +557,11 @@ 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.236 (2020-05-18)" #define Log_PLATFORM_VERSION "SWAD 19.236.1 (2020-05-18)"
#define CSS_FILE "swad19.230.1.css" #define CSS_FILE "swad19.230.1.css"
#define JS_FILE "swad19.230.3.js" #define JS_FILE "swad19.230.3.js"
/* /*
Version 19.236.1: May 18, 2020 Fixed bugs in exam results. (301205 lines)
Version 19.236: May 18, 2020 Code refactoring in exams. Version 19.236: May 18, 2020 Code refactoring in exams.
Fixed bugs in exams. (301200 lines) Fixed bugs in exams. (301200 lines)
Version 19.235.3: May 17, 2020 Check if temporary public directory exists when got from cache. (301239 lines) Version 19.235.3: May 17, 2020 Check if temporary public directory exists when got from cache. (301239 lines)

View File

@ -76,35 +76,36 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void ExaRes_PutFormToSelUsrsToViewEvtResults (void *Exams);
static void ExaRes_ListMySesResultsInCrs (struct Exa_Exams *Exams); static void ExaRes_ListMyResultsInCrs (struct Exa_Exams *Exams);
static void ExaRes_ListMySesResultsInExa (struct Exa_Exams *Exams,long ExaCod); static void ExaRes_ListMyResultsInExa (struct Exa_Exams *Exams,long ExaCod);
static void ExaRes_ListMySesResultsInSes (struct Exa_Exams *Exams,long SesCod); static void ExaRes_ListMyResultsInSes (struct Exa_Exams *Exams,long SesCod);
static void ExaRes_ShowAllSesResultsInSelectedExams (void *Exams);
static void ExaRes_ListAllSesResultsInSelectedExams (struct Exa_Exams *Exams); static void ExaRes_PutFormToSelUsrsToViewResults (void *Exams);
static void ExaRes_ListAllSesResultsInExa (struct Exa_Exams *Exams,long ExaCod); static void ExaRes_ShowAllResultsInSelectedExams (void *Exams);
static void ExaRes_ListAllSesResultsInSes (struct Exa_Exams *Exams,long SesCod); static void ExaRes_ListAllResultsInSelectedExams (struct Exa_Exams *Exams);
static void ExaRes_ListAllResultsInExa (struct Exa_Exams *Exams,long ExaCod);
static void ExaRes_ListAllResultsInSes (struct Exa_Exams *Exams,long SesCod);
static void ExaRes_ShowResultsBegin (struct Exa_Exams *Exams, static void ExaRes_ShowResultsBegin (struct Exa_Exams *Exams,
const char *Title,bool ListExamsToSelect); const char *Title,bool ListExamsToSelect);
static void ExaRes_ShowResultsEnd (void); static void ExaRes_ShowResultsEnd (void);
static void ExaRes_ListExamsToSelect (struct Exa_Exams *Exams); static void ExaRes_ListExamsToSelect (struct Exa_Exams *Exams);
static void ExaRes_ShowHeaderEvtResults (Usr_MeOrOther_t MeOrOther); static void ExaRes_ShowHeaderResults (Usr_MeOrOther_t MeOrOther);
static void ExaRes_BuildExamsSelectedCommas (struct Exa_Exams *Exams, static void ExaRes_BuildExamsSelectedCommas (struct Exa_Exams *Exams,
char **ExamsSelectedCommas); char **ExamsSelectedCommas);
static void ExaRes_ShowSesResults (struct Exa_Exams *Exams, static void ExaRes_ShowResults (struct Exa_Exams *Exams,
Usr_MeOrOther_t MeOrOther, Usr_MeOrOther_t MeOrOther,
long SesCod, // <= 0 ==> any long SesCod, // <= 0 ==> any
long ExaCod, // <= 0 ==> any long ExaCod, // <= 0 ==> any
const char *ExamsSelectedCommas); const char *ExamsSelectedCommas);
static void ExaRes_ShowEvtResultsSummaryRow (unsigned NumResults, static void ExaRes_ShowResultsSummaryRow (unsigned NumResults,
unsigned NumTotalQsts, unsigned NumTotalQsts,
unsigned NumTotalQstsNotBlank, unsigned NumTotalQstsNotBlank,
double TotalScoreOfAllResults, double TotalScoreOfAllResults,
double TotalGrade); double TotalGrade);
static bool ExaRes_CheckIfICanSeePrintResult (struct ExaSes_Session *Session,long UsrCod); static bool ExaRes_CheckIfICanSeePrintResult (struct ExaSes_Session *Session,long UsrCod);
static bool ExaRes_CheckIfICanViewScore (bool ICanViewResult,unsigned Visibility); static bool ExaRes_CheckIfICanViewScore (bool ICanViewResult,unsigned Visibility);
@ -122,7 +123,7 @@ static void ExaRes_WriteQstAndAnsExam (struct UsrData *UsrDat,
/*************************** Show my sessions results **************************/ /*************************** Show my sessions results **************************/
/*****************************************************************************/ /*****************************************************************************/
void ExaRes_ShowMyExaResultsInCrs (void) void ExaRes_ShowMyResultsInCrs (void)
{ {
extern const char *Txt_Results; extern const char *Txt_Results;
struct Exa_Exams Exams; struct Exa_Exams Exams;
@ -136,7 +137,7 @@ void ExaRes_ShowMyExaResultsInCrs (void)
/***** List my sessions results in the current course *****/ /***** List my sessions results in the current course *****/
ExaRes_ShowResultsBegin (&Exams,Txt_Results,true); // List exams to select ExaRes_ShowResultsBegin (&Exams,Txt_Results,true); // List exams to select
ExaRes_ListMySesResultsInCrs (&Exams); ExaRes_ListMyResultsInCrs (&Exams);
ExaRes_ShowResultsEnd (); ExaRes_ShowResultsEnd ();
/***** Free list of exams *****/ /***** Free list of exams *****/
@ -144,25 +145,25 @@ void ExaRes_ShowMyExaResultsInCrs (void)
Exa_FreeListExams (&Exams); Exa_FreeListExams (&Exams);
} }
static void ExaRes_ListMySesResultsInCrs (struct Exa_Exams *Exams) static void ExaRes_ListMyResultsInCrs (struct Exa_Exams *Exams)
{ {
char *ExamsSelectedCommas = NULL; // Initialized to avoid warning char *ExamsSelectedCommas = NULL; // Initialized to avoid warning
/***** Table header *****/ /***** Table header *****/
ExaRes_ShowHeaderEvtResults (Usr_ME); ExaRes_ShowHeaderResults (Usr_ME);
/***** List my sessions results in the current course *****/ /***** List my sessions results in the current course *****/
TstCfg_GetConfigFromDB (); // Get feedback type TstCfg_GetConfigFromDB (); // Get feedback type
ExaRes_BuildExamsSelectedCommas (Exams,&ExamsSelectedCommas); ExaRes_BuildExamsSelectedCommas (Exams,&ExamsSelectedCommas);
ExaRes_ShowSesResults (Exams,Usr_ME,-1L,-1L,ExamsSelectedCommas); ExaRes_ShowResults (Exams,Usr_ME,-1L,-1L,ExamsSelectedCommas);
free (ExamsSelectedCommas); free (ExamsSelectedCommas);
} }
/*****************************************************************************/ /*****************************************************************************/
/***************** Show my sessions results in a given exam *******************/ /******************** Show my results in a given exam ************************/
/*****************************************************************************/ /*****************************************************************************/
void ExaRes_ShowMyExaResultsInExa (void) void ExaRes_ShowMyResultsInExa (void)
{ {
extern const char *Txt_Results_of_exam_X; extern const char *Txt_Results_of_exam_X;
struct Exa_Exams Exams; struct Exa_Exams Exams;
@ -193,28 +194,28 @@ void ExaRes_ShowMyExaResultsInExa (void)
Str_BuildStringStr (Txt_Results_of_exam_X,Exam.Title), Str_BuildStringStr (Txt_Results_of_exam_X,Exam.Title),
false); // Do not list exams to select false); // Do not list exams to select
Str_FreeString (); Str_FreeString ();
ExaRes_ListMySesResultsInExa (&Exams,Exam.ExaCod); ExaRes_ListMyResultsInExa (&Exams,Exam.ExaCod);
ExaRes_ShowResultsEnd (); ExaRes_ShowResultsEnd ();
/***** Exam end *****/ /***** Exam end *****/
Exa_ShowOnlyOneExamEnd (); Exa_ShowOnlyOneExamEnd ();
} }
static void ExaRes_ListMySesResultsInExa (struct Exa_Exams *Exams,long ExaCod) static void ExaRes_ListMyResultsInExa (struct Exa_Exams *Exams,long ExaCod)
{ {
/***** Table header *****/ /***** Table header *****/
ExaRes_ShowHeaderEvtResults (Usr_ME); ExaRes_ShowHeaderResults (Usr_ME);
/***** List my sessions results in exam *****/ /***** List my sessions results in exam *****/
TstCfg_GetConfigFromDB (); // Get feedback type TstCfg_GetConfigFromDB (); // Get feedback type
ExaRes_ShowSesResults (Exams,Usr_ME,-1L,ExaCod,NULL); ExaRes_ShowResults (Exams,Usr_ME,-1L,ExaCod,NULL);
} }
/*****************************************************************************/ /*****************************************************************************/
/****************** Show my exam results in a given session ******************/ /****************** Show my exam results in a given session ******************/
/*****************************************************************************/ /*****************************************************************************/
void ExaRes_ShowMyExaResultsInSes (void) void ExaRes_ShowMyResultsInSes (void)
{ {
extern const char *Txt_Results_of_session_X; extern const char *Txt_Results_of_session_X;
struct Exa_Exams Exams; struct Exa_Exams Exams;
@ -245,99 +246,28 @@ void ExaRes_ShowMyExaResultsInSes (void)
ExaRes_ShowResultsBegin (&Exams,Str_BuildStringStr (Txt_Results_of_session_X,Session.Title), ExaRes_ShowResultsBegin (&Exams,Str_BuildStringStr (Txt_Results_of_session_X,Session.Title),
false); // Do not list exams to select false); // Do not list exams to select
Str_FreeString (); Str_FreeString ();
ExaRes_ListMySesResultsInSes (&Exams,Session.SesCod); ExaRes_ListMyResultsInSes (&Exams,Session.SesCod);
ExaRes_ShowResultsEnd (); ExaRes_ShowResultsEnd ();
/***** Exam end *****/ /***** Exam end *****/
Exa_ShowOnlyOneExamEnd (); Exa_ShowOnlyOneExamEnd ();
} }
static void ExaRes_ListMySesResultsInSes (struct Exa_Exams *Exams,long SesCod) static void ExaRes_ListMyResultsInSes (struct Exa_Exams *Exams,long SesCod)
{ {
/***** Table header *****/ /***** Table header *****/
ExaRes_ShowHeaderEvtResults (Usr_ME); ExaRes_ShowHeaderResults (Usr_ME);
/***** List my sessions results in exam *****/ /***** List my sessions results in exam *****/
TstCfg_GetConfigFromDB (); // Get feedback type TstCfg_GetConfigFromDB (); // Get feedback type
ExaRes_ShowSesResults (Exams,Usr_ME,SesCod,-1L,NULL); ExaRes_ShowResults (Exams,Usr_ME,SesCod,-1L,NULL);
}
/*****************************************************************************/
/****************** Get users and show their sessions results *****************/
/*****************************************************************************/
void ExaRes_ShowAllExaResultsInCrs (void)
{
struct Exa_Exams Exams;
/***** Reset exams context *****/
Exa_ResetExams (&Exams);
/***** Get users and show their sessions results *****/
Usr_GetSelectedUsrsAndGoToAct (&Gbl.Usrs.Selected,
ExaRes_ShowAllSesResultsInSelectedExams,&Exams,
ExaRes_PutFormToSelUsrsToViewEvtResults,&Exams);
}
/*****************************************************************************/
/****************** Show sessions results for several users *******************/
/*****************************************************************************/
static void ExaRes_ShowAllSesResultsInSelectedExams (void *Exams)
{
extern const char *Txt_Results;
if (!Exams)
return;
/***** Get list of exams *****/
Exa_GetListExams ((struct Exa_Exams *) Exams,Exa_ORDER_BY_TITLE);
Exa_GetListSelectedExaCods ((struct Exa_Exams *) Exams);
/***** List the sessions results of the selected users *****/
ExaRes_ShowResultsBegin ((struct Exa_Exams *) Exams,
Txt_Results,
true); // List exams to select
ExaRes_ListAllSesResultsInSelectedExams ((struct Exa_Exams *) Exams);
ExaRes_ShowResultsEnd ();
/***** Free list of exams *****/
free (((struct Exa_Exams *) Exams)->ExaCodsSelected);
Exa_FreeListExams ((struct Exa_Exams *) Exams);
}
static void ExaRes_ListAllSesResultsInSelectedExams (struct Exa_Exams *Exams)
{
char *ExamsSelectedCommas = NULL; // Initialized to avoid warning
const char *Ptr;
/***** Table head *****/
ExaRes_ShowHeaderEvtResults (Usr_OTHER);
/***** List the sessions results of the selected users *****/
ExaRes_BuildExamsSelectedCommas (Exams,&ExamsSelectedCommas);
Ptr = Gbl.Usrs.Selected.List[Rol_UNK];
while (*Ptr)
{
Par_GetNextStrUntilSeparParamMult (&Ptr,Gbl.Usrs.Other.UsrDat.EncryptedUsrCod,
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat);
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat))
{
/***** Show sessions results *****/
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
ExaRes_ShowSesResults (Exams,Usr_OTHER,-1L,-1L,ExamsSelectedCommas);
}
}
free (ExamsSelectedCommas);
} }
/*****************************************************************************/ /*****************************************************************************/
/**************** Select users to show their sessions results *****************/ /**************** Select users to show their sessions results *****************/
/*****************************************************************************/ /*****************************************************************************/
void ExaRes_SelUsrsToViewExaResults (void) void ExaRes_SelUsrsToViewResults (void)
{ {
struct Exa_Exams Exams; struct Exa_Exams Exams;
@ -345,10 +275,10 @@ void ExaRes_SelUsrsToViewExaResults (void)
Exa_ResetExams (&Exams); Exa_ResetExams (&Exams);
/***** Put form to select users *****/ /***** Put form to select users *****/
ExaRes_PutFormToSelUsrsToViewEvtResults (&Exams); ExaRes_PutFormToSelUsrsToViewResults (&Exams);
} }
static void ExaRes_PutFormToSelUsrsToViewEvtResults (void *Exams) static void ExaRes_PutFormToSelUsrsToViewResults (void *Exams)
{ {
extern const char *Hlp_ASSESSMENT_Exams_results; extern const char *Hlp_ASSESSMENT_Exams_results;
extern const char *Txt_Results; extern const char *Txt_Results;
@ -364,11 +294,82 @@ static void ExaRes_PutFormToSelUsrsToViewEvtResults (void *Exams)
false); // Do not put form with date range false); // Do not put form with date range
} }
/*****************************************************************************/
/****************** Get users and show their sessions results *****************/
/*****************************************************************************/
void ExaRes_ShowAllResultsInCrs (void)
{
struct Exa_Exams Exams;
/***** Reset exams context *****/
Exa_ResetExams (&Exams);
/***** Get users and show their sessions results *****/
Usr_GetSelectedUsrsAndGoToAct (&Gbl.Usrs.Selected,
ExaRes_ShowAllResultsInSelectedExams,&Exams,
ExaRes_PutFormToSelUsrsToViewResults,&Exams);
}
/*****************************************************************************/
/****************** Show sessions results for several users *******************/
/*****************************************************************************/
static void ExaRes_ShowAllResultsInSelectedExams (void *Exams)
{
extern const char *Txt_Results;
if (!Exams)
return;
/***** Get list of exams *****/
Exa_GetListExams ((struct Exa_Exams *) Exams,Exa_ORDER_BY_TITLE);
Exa_GetListSelectedExaCods ((struct Exa_Exams *) Exams);
/***** List the sessions results of the selected users *****/
ExaRes_ShowResultsBegin ((struct Exa_Exams *) Exams,
Txt_Results,
true); // List exams to select
ExaRes_ListAllResultsInSelectedExams ((struct Exa_Exams *) Exams);
ExaRes_ShowResultsEnd ();
/***** Free list of exams *****/
free (((struct Exa_Exams *) Exams)->ExaCodsSelected);
Exa_FreeListExams ((struct Exa_Exams *) Exams);
}
static void ExaRes_ListAllResultsInSelectedExams (struct Exa_Exams *Exams)
{
char *ExamsSelectedCommas = NULL; // Initialized to avoid warning
const char *Ptr;
/***** Table head *****/
ExaRes_ShowHeaderResults (Usr_OTHER);
/***** List the sessions results of the selected users *****/
ExaRes_BuildExamsSelectedCommas (Exams,&ExamsSelectedCommas);
Ptr = Gbl.Usrs.Selected.List[Rol_UNK];
while (*Ptr)
{
Par_GetNextStrUntilSeparParamMult (&Ptr,Gbl.Usrs.Other.UsrDat.EncryptedUsrCod,
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat);
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat))
{
/***** Show sessions results *****/
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
ExaRes_ShowResults (Exams,Usr_OTHER,-1L,-1L,ExamsSelectedCommas);
}
}
free (ExamsSelectedCommas);
}
/*****************************************************************************/ /*****************************************************************************/
/*** Show sessions results of a exam for the users who answered in that exam **/ /*** Show sessions results of a exam for the users who answered in that exam **/
/*****************************************************************************/ /*****************************************************************************/
void ExaRes_ShowAllExaResultsInExa (void) void ExaRes_ShowAllResultsInExa (void)
{ {
extern const char *Txt_Results_of_exam_X; extern const char *Txt_Results_of_exam_X;
struct Exa_Exams Exams; struct Exa_Exams Exams;
@ -397,14 +398,14 @@ void ExaRes_ShowAllExaResultsInExa (void)
Str_BuildStringStr (Txt_Results_of_exam_X,Exam.Title), Str_BuildStringStr (Txt_Results_of_exam_X,Exam.Title),
false); // Do not list exams to select false); // Do not list exams to select
Str_FreeString (); Str_FreeString ();
ExaRes_ListAllSesResultsInExa (&Exams,Exam.ExaCod); ExaRes_ListAllResultsInExa (&Exams,Exam.ExaCod);
ExaRes_ShowResultsEnd (); ExaRes_ShowResultsEnd ();
/***** Exam end *****/ /***** Exam end *****/
Exa_ShowOnlyOneExamEnd (); Exa_ShowOnlyOneExamEnd ();
} }
static void ExaRes_ListAllSesResultsInExa (struct Exa_Exams *Exams,long ExaCod) static void ExaRes_ListAllResultsInExa (struct Exa_Exams *Exams,long ExaCod)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -412,7 +413,7 @@ static void ExaRes_ListAllSesResultsInExa (struct Exa_Exams *Exams,long ExaCod)
unsigned long NumUsr; unsigned long NumUsr;
/***** Table head *****/ /***** Table head *****/
ExaRes_ShowHeaderEvtResults (Usr_OTHER); ExaRes_ShowHeaderResults (Usr_OTHER);
/***** Get all users who have answered any session question in this exam *****/ /***** Get all users who have answered any session question in this exam *****/
NumUsrs = DB_QuerySELECT (&mysql_res,"can not get users in exam", NumUsrs = DB_QuerySELECT (&mysql_res,"can not get users in exam",
@ -446,7 +447,7 @@ static void ExaRes_ListAllSesResultsInExa (struct Exa_Exams *Exams,long ExaCod)
{ {
/***** Show sessions results *****/ /***** Show sessions results *****/
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat); Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
ExaRes_ShowSesResults (Exams,Usr_OTHER,-1L,ExaCod,NULL); ExaRes_ShowResults (Exams,Usr_OTHER,-1L,ExaCod,NULL);
} }
} }
} }
@ -459,7 +460,7 @@ static void ExaRes_ListAllSesResultsInExa (struct Exa_Exams *Exams,long ExaCod)
/** Show sessions results of a session for the users who answered in that session */ /** Show sessions results of a session for the users who answered in that session */
/*****************************************************************************/ /*****************************************************************************/
void ExaRes_ShowAllExaResultsInSes (void) void ExaRes_ShowAllResultsInSes (void)
{ {
extern const char *Txt_Results_of_session_X; extern const char *Txt_Results_of_session_X;
struct Exa_Exams Exams; struct Exa_Exams Exams;
@ -493,14 +494,14 @@ void ExaRes_ShowAllExaResultsInSes (void)
Str_BuildStringStr (Txt_Results_of_session_X,Session.Title), Str_BuildStringStr (Txt_Results_of_session_X,Session.Title),
false); // Do not list exams to select false); // Do not list exams to select
Str_FreeString (); Str_FreeString ();
ExaRes_ListAllSesResultsInSes (&Exams,Session.SesCod); ExaRes_ListAllResultsInSes (&Exams,Session.SesCod);
ExaRes_ShowResultsEnd (); ExaRes_ShowResultsEnd ();
/***** Exam end *****/ /***** Exam end *****/
Exa_ShowOnlyOneExamEnd (); Exa_ShowOnlyOneExamEnd ();
} }
static void ExaRes_ListAllSesResultsInSes (struct Exa_Exams *Exams,long SesCod) static void ExaRes_ListAllResultsInSes (struct Exa_Exams *Exams,long SesCod)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -508,7 +509,7 @@ static void ExaRes_ListAllSesResultsInSes (struct Exa_Exams *Exams,long SesCod)
unsigned long NumUsr; unsigned long NumUsr;
/***** Table head *****/ /***** Table head *****/
ExaRes_ShowHeaderEvtResults (Usr_OTHER); ExaRes_ShowHeaderResults (Usr_OTHER);
/***** Get all users who have answered any session question in this exam *****/ /***** Get all users who have answered any session question in this exam *****/
NumUsrs = DB_QuerySELECT (&mysql_res,"can not get users in session", NumUsrs = DB_QuerySELECT (&mysql_res,"can not get users in session",
@ -542,7 +543,7 @@ static void ExaRes_ListAllSesResultsInSes (struct Exa_Exams *Exams,long SesCod)
{ {
/***** Show sessions results *****/ /***** Show sessions results *****/
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat); Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
ExaRes_ShowSesResults (Exams,Usr_OTHER,SesCod,-1L,NULL); ExaRes_ShowResults (Exams,Usr_OTHER,SesCod,-1L,NULL);
} }
} }
} }
@ -687,7 +688,7 @@ static void ExaRes_ListExamsToSelect (struct Exa_Exams *Exams)
/********************* Show header of my sessions results *********************/ /********************* Show header of my sessions results *********************/
/*****************************************************************************/ /*****************************************************************************/
static void ExaRes_ShowHeaderEvtResults (Usr_MeOrOther_t MeOrOther) static void ExaRes_ShowHeaderResults (Usr_MeOrOther_t MeOrOther)
{ {
extern const char *Txt_User[Usr_NUM_SEXS]; extern const char *Txt_User[Usr_NUM_SEXS];
extern const char *Txt_Session; extern const char *Txt_Session;
@ -750,14 +751,14 @@ static void ExaRes_BuildExamsSelectedCommas (struct Exa_Exams *Exams,
/********* Show the sessions results of a user in the current course *********/ /********* Show the sessions results of a user in the current course *********/
/*****************************************************************************/ /*****************************************************************************/
static void ExaRes_ShowSesResults (struct Exa_Exams *Exams, static void ExaRes_ShowResults (struct Exa_Exams *Exams,
Usr_MeOrOther_t MeOrOther, Usr_MeOrOther_t MeOrOther,
long SesCod, // <= 0 ==> any long SesCod, // <= 0 ==> any
long ExaCod, // <= 0 ==> any long ExaCod, // <= 0 ==> any
const char *ExamsSelectedCommas) const char *ExamsSelectedCommas)
{ {
extern const char *Txt_Result; extern const char *Txt_Result;
char *EvtSubQuery; char *SesSubQuery;
char *ExaSubQuery; char *ExaSubQuery;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -792,12 +793,12 @@ static void ExaRes_ShowSesResults (struct Exa_Exams *Exams,
/***** Build sessions subquery *****/ /***** Build sessions subquery *****/
if (SesCod > 0) if (SesCod > 0)
{ {
if (asprintf (&EvtSubQuery," AND exa_prints.SesCod=%ld",SesCod) < 0) if (asprintf (&SesSubQuery," AND exa_prints.SesCod=%ld",SesCod) < 0)
Lay_NotEnoughMemoryExit (); Lay_NotEnoughMemoryExit ();
} }
else else
{ {
if (asprintf (&EvtSubQuery,"%s","") < 0) if (asprintf (&SesSubQuery,"%s","") < 0)
Lay_NotEnoughMemoryExit (); Lay_NotEnoughMemoryExit ();
} }
@ -847,11 +848,11 @@ static void ExaRes_ShowSesResults (struct Exa_Exams *Exams,
" AND exa_exams.CrsCod=%ld" // Extra check " AND exa_exams.CrsCod=%ld" // Extra check
" ORDER BY exa_sessions.Title", " ORDER BY exa_sessions.Title",
UsrDat->UsrCod, UsrDat->UsrCod,
EvtSubQuery, SesSubQuery,
ExaSubQuery, ExaSubQuery,
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
free (ExaSubQuery); free (ExaSubQuery);
free (EvtSubQuery); free (SesSubQuery);
/***** Show user's data *****/ /***** Show user's data *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
@ -1005,7 +1006,7 @@ static void ExaRes_ShowSesResults (struct Exa_Exams *Exams,
} }
/***** Write totals for this user *****/ /***** Write totals for this user *****/
ExaRes_ShowEvtResultsSummaryRow (NumResults, ExaRes_ShowResultsSummaryRow (NumResults,
NumTotalQsts,NumTotalQstsNotBlank, NumTotalQsts,NumTotalQstsNotBlank,
TotalScoreOfAllResults, TotalScoreOfAllResults,
TotalGrade); TotalGrade);
@ -1026,11 +1027,11 @@ static void ExaRes_ShowSesResults (struct Exa_Exams *Exams,
/************** Show row with summary of user's sessions results **************/ /************** Show row with summary of user's sessions results **************/
/*****************************************************************************/ /*****************************************************************************/
static void ExaRes_ShowEvtResultsSummaryRow (unsigned NumResults, static void ExaRes_ShowResultsSummaryRow (unsigned NumResults,
unsigned NumTotalQsts, unsigned NumTotalQsts,
unsigned NumTotalQstsNotBlank, unsigned NumTotalQstsNotBlank,
double TotalScoreOfAllResults, double TotalScoreOfAllResults,
double TotalGrade) double TotalGrade)
{ {
extern const char *Txt_Sessions; extern const char *Txt_Sessions;
@ -1237,9 +1238,12 @@ void ExaRes_ShowOneExaResult (void)
HTM_TD_End (); HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT LT\""); HTM_TD_Begin ("class=\"DAT LT\"");
HTM_TxtF ("%u (%u %s)", if (ICanViewResult)
Print.NumQsts, HTM_TxtF ("%u (%u %s)",
Print.NumQstsNotBlank,Txt_non_blank_QUESTIONS); Print.NumQsts,
Print.NumQstsNotBlank,Txt_non_blank_QUESTIONS);
else
Ico_PutIconNotVisible ();
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();

View File

@ -40,14 +40,14 @@
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
void ExaRes_ShowMyExaResultsInCrs (void); void ExaRes_ShowMyResultsInCrs (void);
void ExaRes_ShowMyExaResultsInExa (void); void ExaRes_ShowMyResultsInExa (void);
void ExaRes_ShowMyExaResultsInSes (void); void ExaRes_ShowMyResultsInSes (void);
void ExaRes_ShowAllExaResultsInCrs (void); void ExaRes_SelUsrsToViewResults (void);
void ExaRes_SelUsrsToViewExaResults (void); void ExaRes_ShowAllResultsInCrs (void);
void ExaRes_ShowAllExaResultsInExa (void); void ExaRes_ShowAllResultsInExa (void);
void ExaRes_ShowAllExaResultsInSes (void); void ExaRes_ShowAllResultsInSes (void);
void ExaRes_ShowOneExaResult (void); void ExaRes_ShowOneExaResult (void);

View File

@ -1452,20 +1452,21 @@ static void Tst_PutIconsTests (__attribute__((unused)) void *Args)
{ {
extern const char *Txt_New_question; extern const char *Txt_New_question;
/***** Put form to go to test configuration *****/
Ico_PutContextualIconToConfigure (ActCfgTst,
NULL,NULL);
/***** Put icon to view test exams *****/
switch (Gbl.Usrs.Me.Role.Logged) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
/***** Put icon to view test results *****/
Ico_PutContextualIconToShowResults (ActReqSeeMyTstRes,NULL, Ico_PutContextualIconToShowResults (ActReqSeeMyTstRes,NULL,
NULL,NULL); NULL,NULL);
break; break;
case Rol_NET: case Rol_NET:
case Rol_TCH: case Rol_TCH:
case Rol_SYS_ADM: case Rol_SYS_ADM:
/***** Put form to go to test configuration *****/
Ico_PutContextualIconToConfigure (ActCfgTst,
NULL,NULL);
/***** Put icon to view test results *****/
Ico_PutContextualIconToShowResults (ActReqSeeUsrTstRes,NULL, Ico_PutContextualIconToShowResults (ActReqSeeUsrTstRes,NULL,
NULL,NULL); NULL,NULL);
break; break;