Version20.10

This commit is contained in:
acanas 2021-01-27 22:40:04 +01:00
parent ae7744cbf4
commit 94eb3c5cbe
2 changed files with 40 additions and 43 deletions

View File

@ -553,7 +553,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 20.9.1 (2021-01-27)" #define Log_PLATFORM_VERSION "SWAD 20.10 (2021-01-27)"
#define CSS_FILE "swad20.8.css" #define CSS_FILE "swad20.8.css"
#define JS_FILE "swad20.6.2.js" #define JS_FILE "swad20.6.2.js"
/* /*
@ -602,6 +602,7 @@ TODO: DNI de un estudiante sale err
TODO: Reportado por Javier Fernández Baldomero. Un profesor debería poder cambiar la foto de un estudiante confirmado. Sale el icono, pero luego dice ue no hay permiso TODO: Reportado por Javier Fernández Baldomero. Un profesor debería poder cambiar la foto de un estudiante confirmado. Sale el icono, pero luego dice ue no hay permiso
Version 20.10: Jan 27, 2021 Exam print is visible just after answering it. (304863 lines)
Version 20.9.1: Jan 27, 2021 Code refactoring in exam results. (304865 lines) Version 20.9.1: Jan 27, 2021 Code refactoring in exam results. (304865 lines)
Version 20.9: Jan 20, 2021 Exam print ready to be answered is displayed in a new tab. Version 20.9: Jan 20, 2021 Exam print ready to be answered is displayed in a new tab.
Code refactoring in exam results. (304829 lines) Code refactoring in exam results. (304829 lines)

View File

@ -116,12 +116,14 @@ static void ExaRes_ShowResultsSummaryRow (unsigned NumResults,
static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam, static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam,
const struct ExaSes_Session *Session, const struct ExaSes_Session *Session,
struct ExaPrn_Print *Print, struct ExaPrn_Print *Print,
struct UsrData *UsrDat); struct UsrData *UsrDat,
struct ExaRes_ICanView *ICanView,
unsigned Visibility);
static void ExaRes_CheckIfICanSeePrintResult (const struct Exa_Exam *Exam, static void ExaRes_CheckIfICanViewResult (const struct Exa_Exam *Exam,
const struct ExaSes_Session *Session, const struct ExaSes_Session *Session,
long UsrCod, long UsrCod,
struct ExaRes_ICanView *ICanView); struct ExaRes_ICanView *ICanView);
static void ExaRes_ComputeValidPrintScore (struct ExaPrn_Print *Print); static void ExaRes_ComputeValidPrintScore (struct ExaPrn_Print *Print);
static void ExaRes_ShowExamResultTime (struct ExaPrn_Print *Print); static void ExaRes_ShowExamResultTime (struct ExaPrn_Print *Print);
@ -970,7 +972,7 @@ static void ExaRes_ShowResults (struct Exa_Exams *Exams,
Exa_GetDataOfExamByCod (&Exam); Exa_GetDataOfExamByCod (&Exam);
/* Check if I can view this print result and its score */ /* Check if I can view this print result and its score */
ExaRes_CheckIfICanSeePrintResult (&Exam,&Session,UsrDat->UsrCod,&ICanView); ExaRes_CheckIfICanViewResult (&Exam,&Session,UsrDat->UsrCod,&ICanView);
if (NumResult) if (NumResult)
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
@ -1332,6 +1334,12 @@ void ExaRes_ShowExaResultAfterFinish (void)
struct Exa_Exam Exam; struct Exa_Exam Exam;
struct ExaSes_Session Session; struct ExaSes_Session Session;
struct ExaPrn_Print Print; struct ExaPrn_Print Print;
struct ExaRes_ICanView ICanView =
{
.Result = true, // I have just finish answering, so show result...
.Score = false, // ...but not score
};
unsigned Visibility = 1 << TstVis_VISIBLE_QST_ANS_TXT; // Show only questions and answers text
/***** Reset exams context *****/ /***** Reset exams context *****/
Exa_ResetExams (&Exams); Exa_ResetExams (&Exams);
@ -1356,22 +1364,8 @@ void ExaRes_ShowExaResultAfterFinish (void)
ExaPrn_GetPrintQuestionsFromDB (&Print); ExaPrn_GetPrintQuestionsFromDB (&Print);
/***** Show exam result *****/ /***** Show exam result *****/
ExaRes_ShowExamResult (&Exam,&Session,&Print,&Gbl.Usrs.Me.UsrDat); ExaRes_ShowExamResult (&Exam,&Session,&Print,
&Gbl.Usrs.Me.UsrDat,&ICanView,Visibility);
/***** Show exam log *****/
switch (Gbl.Usrs.Me.Role.Logged)
{
case Rol_NET:
case Rol_TCH:
case Rol_DEG_ADM:
case Rol_CTR_ADM:
case Rol_INS_ADM:
case Rol_SYS_ADM:
ExaLog_ShowExamLog (&Print);
break;
default: // Other users can not see log
return;
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1386,6 +1380,7 @@ void ExaRes_ShowOneExaResult (void)
Usr_MeOrOther_t MeOrOther; Usr_MeOrOther_t MeOrOther;
struct UsrData *UsrDat; struct UsrData *UsrDat;
struct ExaPrn_Print Print; struct ExaPrn_Print Print;
struct ExaRes_ICanView ICanView;
/***** Reset exams context *****/ /***** Reset exams context *****/
Exa_ResetExams (&Exams); Exa_ResetExams (&Exams);
@ -1418,8 +1413,12 @@ void ExaRes_ShowOneExaResult (void)
/***** Get questions and user's answers of exam print from database *****/ /***** Get questions and user's answers of exam print from database *****/
ExaPrn_GetPrintQuestionsFromDB (&Print); ExaPrn_GetPrintQuestionsFromDB (&Print);
/***** Check if I can view this print result and its score *****/
ExaRes_CheckIfICanViewResult (&Exam,&Session,UsrDat->UsrCod,&ICanView);
/***** Show exam result *****/ /***** Show exam result *****/
ExaRes_ShowExamResult (&Exam,&Session,&Print,UsrDat); ExaRes_ShowExamResult (&Exam,&Session,&Print,
UsrDat,&ICanView,Exam.Visibility);
/***** Show exam log *****/ /***** Show exam log *****/
switch (Gbl.Usrs.Me.Role.Logged) switch (Gbl.Usrs.Me.Role.Logged)
@ -1444,18 +1443,15 @@ void ExaRes_ShowOneExaResult (void)
static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam, static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam,
const struct ExaSes_Session *Session, const struct ExaSes_Session *Session,
struct ExaPrn_Print *Print, struct ExaPrn_Print *Print,
struct UsrData *UsrDat) struct UsrData *UsrDat,
struct ExaRes_ICanView *ICanView,
unsigned Visibility)
{ {
extern const char *Hlp_ASSESSMENT_Exams_results; extern const char *Hlp_ASSESSMENT_Exams_results;
extern const char *Txt_The_user_does_not_exist; extern const char *Txt_The_user_does_not_exist;
struct ExaRes_ICanView ICanView;
/***** Check if I can view this print result and its score *****/
ExaRes_CheckIfICanSeePrintResult (Exam,Session,UsrDat->UsrCod,&ICanView);
/***** Compute score taking into account only valid questions *****/ /***** Compute score taking into account only valid questions *****/
if (ICanView.Score) ExaRes_ComputeValidPrintScore (Print);
ExaRes_ComputeValidPrintScore (Print);
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin (NULL,Session->Title, Box_BoxBegin (NULL,Session->Title,
@ -1483,20 +1479,20 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam,
ExaRes_ShowExamResultTime (Print); ExaRes_ShowExamResultTime (Print);
/***** Number of questions *****/ /***** Number of questions *****/
ExaRes_ShowExamResultNumQsts (Print,&ICanView); ExaRes_ShowExamResultNumQsts (Print,ICanView);
/***** Number of answers *****/ /***** Number of answers *****/
ExaRes_ShowExamResultNumAnss (Print,&ICanView); ExaRes_ShowExamResultNumAnss (Print,ICanView);
/***** Score *****/ /***** Score *****/
ExaRes_ShowExamResultScore (Print,&ICanView); ExaRes_ShowExamResultScore (Print,ICanView);
/***** Grade *****/ /***** Grade *****/
ExaRes_ShowExamResultGrade (Exam,Print,&ICanView); ExaRes_ShowExamResultGrade (Exam,Print,ICanView);
/***** Write answers and solutions *****/ /***** Write answers and solutions *****/
if (ICanView.Result) if (ICanView->Result)
ExaRes_ShowExamAnswers (UsrDat,Print,Exam->Visibility); ExaRes_ShowExamAnswers (UsrDat,Print,Visibility);
/***** End table *****/ /***** End table *****/
HTM_TABLE_End (); HTM_TABLE_End ();
@ -1506,13 +1502,13 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam,
} }
/*****************************************************************************/ /*****************************************************************************/
/********************** Get if I can see print result ************************/ /********************* Get if I can view print result ************************/
/*****************************************************************************/ /*****************************************************************************/
static void ExaRes_CheckIfICanSeePrintResult (const struct Exa_Exam *Exam, static void ExaRes_CheckIfICanViewResult (const struct Exa_Exam *Exam,
const struct ExaSes_Session *Session, const struct ExaSes_Session *Session,
long UsrCod, long UsrCod,
struct ExaRes_ICanView *ICanView) struct ExaRes_ICanView *ICanView)
{ {
bool ItsMe; bool ItsMe;
@ -1779,7 +1775,7 @@ static void ExaRes_ShowExamResultNumAnss (struct ExaPrn_Print *Print,
/***** Number of answers *****/ /***** Number of answers *****/
HTM_TD_Begin ("class=\"DAT LB\""); HTM_TD_Begin ("class=\"DAT LB\"");
if (ICanView->Result) if (ICanView->Score)
HTM_TxtF ("%s(<em>p<sub>i</sub></em>=1):&nbsp;%u; " HTM_TxtF ("%s(<em>p<sub>i</sub></em>=1):&nbsp;%u; "
"%s(-1&le;<em>p<sub>i</sub></em>&lt;0):&nbsp;%u; " "%s(-1&le;<em>p<sub>i</sub></em>&lt;0):&nbsp;%u; "
"%s(<em>p<sub>i</sub></em>=0):&nbsp;%u; " "%s(<em>p<sub>i</sub></em>=0):&nbsp;%u; "