Version19.250.2

This commit is contained in:
acanas 2020-06-17 22:19:57 +02:00
parent 092188c219
commit d1514dfbc1
5 changed files with 120 additions and 10 deletions

View File

@ -1099,6 +1099,9 @@ void Att_RequestCreatOrEditAttEvent (void)
[Dat_END_TIME ] = Dat_HMS_DO_NOT_SET
};
/***** Reset attendance events *****/
Att_ResetEvents (&Events);
/***** Get parameters *****/
Events.SelectedOrder = Att_GetParamAttOrder ();
Grp_GetParamWhichGroups ();

View File

@ -556,7 +556,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 19.250 (2020-06-17)"
#define Log_PLATFORM_VERSION "SWAD 19.250.2 (2020-06-17)"
#define CSS_FILE "swad19.250.css"
#define JS_FILE "swad19.246.1.js"
/*
@ -564,6 +564,8 @@ TODO: Encarnaci
Se trataría de añadir un par de líneas "Nuevos archivos en actividades", "Nuevos archivos en otros trabajos".
TODO: Fix bug: Cuando se pulsa en ver fichas, y luego en una ficha en "Ver trabajos" o "Ver exámenes", o lo que sea, sale dos veces ese estudiante.
Version 19.250.2: Jun 17, 2020 Show valid score and valid grade in exam result. (303069 lines)
Version 19.250.1: Jun 17, 2020 Fixed bug in attendance events, reported by Carlos A. Pozzo. (302977 lines)
Version 19.250: Jun 17, 2020 Exam questions can be invalidated. Not finished. (302974 lines)
1 change necessary in database:
ALTER TABLE exa_set_questions ADD COLUMN Invalid ENUM('N','Y') NOT NULL DEFAULT 'N' AFTER SetCod;

View File

@ -163,9 +163,11 @@ static void ExaPrn_ResetPrintExceptEvtCodAndUsrCod (struct ExaPrn_Print *Print)
Print->TimeUTC[Dat_START_TIME] =
Print->TimeUTC[Dat_END_TIME ] = (time_t) 0;
Print->NumQsts =
Print->NumQstsNotBlank = 0;
Print->NumQstsNotBlank =
Print->NumQstsValid = 0;
Print->Sent = false; // After creating an exam print, it's not sent
Print->Score = 0.0;
Print->Score =
Print->ScoreValid = 0.0;
}
/*****************************************************************************/

View File

@ -43,9 +43,11 @@ struct ExaPrn_Print
time_t TimeUTC[Dat_NUM_START_END_TIME];
unsigned NumQsts; // Number of questions
unsigned NumQstsNotBlank; // Number of questions not blank
unsigned NumQstsValid; // Number of valid questions (not invalidated by teachers)
bool Sent; // This exam print has been sent or not?
// "Sent" means that user has clicked "Send" button after finishing
double Score; // Total score of the exam print
double ScoreValid; // Total score taking into account only valid questions
struct TstPrn_PrintedQuestion PrintedQuestions[ExaPrn_MAX_QUESTIONS_PER_EXAM_PRINT];
};

View File

@ -118,6 +118,8 @@ static bool ExaRes_CheckIfICanSeePrintResult (const struct Exa_Exam *Exam,
long UsrCod);
static bool ExaRes_CheckIfICanViewScore (bool ICanViewResult,unsigned Visibility);
static void ExaRes_ComputeScoreValid (struct ExaPrn_Print *Print);
static void ExaRes_ShowExamAnswers (struct UsrData *UsrDat,
struct ExaPrn_Print *Print,
unsigned Visibility);
@ -1222,6 +1224,10 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam,
break;
}
/***** Compute score taking into account only valid questions *****/
if (ICanView.Score)
ExaRes_ComputeScoreValid (Print);
/***** Begin box *****/
Box_BoxBegin (NULL,Session->Title,
NULL,NULL,
@ -1296,9 +1302,15 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam,
HTM_TD_Begin ("class=\"DAT LT\"");
if (ICanView.Result)
HTM_TxtF ("%u (%u %s)",
Print->NumQsts,
Print->NumQstsNotBlank,Txt_non_blank_QUESTIONS);
{
HTM_TxtF ("%u",Print->NumQsts);
if (Print->NumQsts != Print->NumQstsValid)
HTM_TxtF (" (%s: %u, %s: %u)",
"válidas",Print->NumQstsValid, // TODO: Need translation!!!
"anuladas",Print->NumQsts - Print->NumQstsValid); // TODO: Need translation!!!
HTM_TxtF ("; %s: %u",
Txt_non_blank_QUESTIONS,Print->NumQstsNotBlank);
}
else
Ico_PutIconNotVisible ();
HTM_TD_End ();
@ -1314,7 +1326,16 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam,
HTM_TD_Begin ("class=\"DAT LT\"");
if (ICanView.Score)
{
HTM_Double2Decimals (Print->Score);
if (Print->NumQsts != Print->NumQstsValid)
{
HTM_Txt (" (");
HTM_TxtColonNBSP ("Puntuación válida"); // TODO: Need translation!!!!
HTM_Double2Decimals (Print->ScoreValid);
HTM_Txt (")");
}
}
else
Ico_PutIconNotVisible ();
HTM_TD_End ();
@ -1330,8 +1351,18 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam,
HTM_TD_Begin ("class=\"DAT LT\"");
if (ICanView.Score)
{
TstPrn_ComputeAndShowGrade (Print->NumQsts,Print->Score,
Exam->MaxGrade);
if (Print->NumQsts != Print->NumQstsValid)
{
HTM_Txt (" (");
HTM_TxtColonNBSP ("Nota válida"); // TODO: Need translation!!!!
TstPrn_ComputeAndShowGrade (Print->NumQstsValid,Print->ScoreValid,
Exam->MaxGrade);
HTM_Txt (")");
}
}
else
Ico_PutIconNotVisible ();
HTM_TD_End ();
@ -1349,12 +1380,31 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam,
if (ICanView.Score)
{
HTM_DIV_Begin ("class=\"DAT_N_BOLD CM\"");
/* Score */
HTM_TxtColonNBSP (Txt_Score);
HTM_Double2Decimals (Print->Score);
if (Print->NumQsts != Print->NumQstsValid)
{
HTM_Txt (" / ");
HTM_TxtColonNBSP ("Puntuación válida"); // TODO: Need translation!!!!
HTM_Double2Decimals (Print->ScoreValid);
}
HTM_BR ();
/* Grade */
HTM_TxtColonNBSP (Txt_Grade);
TstPrn_ComputeAndShowGrade (Print->NumQsts,Print->Score,
Exam->MaxGrade);
if (Print->NumQsts != Print->NumQstsValid)
{
HTM_Txt (" / ");
HTM_TxtColonNBSP ("Nota válida"); // TODO: Need translation!!!!
TstPrn_ComputeAndShowGrade (Print->NumQstsValid,Print->ScoreValid,
Exam->MaxGrade);
}
HTM_DIV_End ();
}
@ -1419,6 +1469,45 @@ static bool ExaRes_CheckIfICanViewScore (bool ICanViewResult,unsigned Visibility
}
}
/*****************************************************************************/
/******* Compute total score taking into account only valid questions ********/
/*****************************************************************************/
static void ExaRes_ComputeScoreValid (struct ExaPrn_Print *Print)
{
unsigned NumQst;
struct Tst_Question Question;
/***** Initialize score valid *****/
Print->NumQstsValid = 0;
Print->ScoreValid = 0.0;
for (NumQst = 0;
NumQst < Print->NumQsts;
NumQst++)
{
Gbl.RowEvenOdd = NumQst % 2;
/***** Create test question *****/
Tst_QstConstructor (&Question);
Question.QstCod = Print->PrintedQuestions[NumQst].QstCod;
/***** Get question data *****/
ExaSet_GetQstDataFromDB (&Question);
/***** Compute answer score *****/
if (Question.Validity == Tst_VALID_QUESTION)
{
ExaPrn_ComputeAnswerScore (&Print->PrintedQuestions[NumQst],&Question);
Print->NumQstsValid++;
Print->ScoreValid += Print->PrintedQuestions[NumQst].Score;
}
/***** Destroy test question *****/
Tst_QstDestructor (&Question);
}
}
/*****************************************************************************/
/************** Show user's and correct answers of a test exam ***************/
/*****************************************************************************/
@ -1463,6 +1552,16 @@ static void ExaRes_WriteQstAndAnsExam (struct UsrData *UsrDat,
{
extern const char *Txt_Score;
bool ICanView[TstVis_NUM_ITEMS_VISIBILITY];
static char *ClassNumQst[Tst_NUM_VALIDITIES] =
{
[Tst_INVALID_QUESTION] = "BIG_INDEX_RED",
[Tst_VALID_QUESTION ] = "BIG_INDEX",
};
static char *ClassAnswerType[Tst_NUM_VALIDITIES] =
{
[Tst_INVALID_QUESTION] = "DAT_SMALL_RED",
[Tst_VALID_QUESTION ] = "DAT_SMALL",
};
static char *ClassTxt[Tst_NUM_VALIDITIES] =
{
[Tst_INVALID_QUESTION] = "TEST_TXT_RED",
@ -1507,8 +1606,8 @@ static void ExaRes_WriteQstAndAnsExam (struct UsrData *UsrDat,
/***** Number of question and answer type *****/
HTM_TD_Begin ("class=\"RT COLOR%u\"",Gbl.RowEvenOdd);
Tst_WriteNumQst (NumQst + 1,"BIG_INDEX");
Tst_WriteAnswerType (Question->Answer.Type,"DAT_SMALL");
Tst_WriteNumQst (NumQst + 1,ClassNumQst[Question->Validity]);
Tst_WriteAnswerType (Question->Answer.Type,ClassAnswerType[Question->Validity]);
HTM_TD_End ();
/***** Stem, media and answers *****/
@ -1539,9 +1638,11 @@ static void ExaRes_WriteQstAndAnsExam (struct UsrData *UsrDat,
HTM_SPAN_Begin ("class=\"%s\"",
Print->PrintedQuestions[NumQst].StrAnswers[0] ?
(Print->PrintedQuestions[NumQst].Score > 0 ? "ANS_OK" : // Correct/semicorrect
"ANS_BAD") : // Wrong
"ANS_0"); // Blank answer
"ANS_BAD") : // Wrong
"ANS_0"); // Blank answer
HTM_Double2Decimals (Print->PrintedQuestions[NumQst].Score);
if (Question->Validity == Tst_INVALID_QUESTION)
HTM_TxtF (" (%s)","Pregunta anulada"); // TODO: Need translation!!!!
HTM_SPAN_End ();
HTM_DIV_End ();
}