Version19.223.1

This commit is contained in:
acanas 2020-05-11 13:05:38 +02:00
parent f6cd6490fb
commit 5bb6533e38
2 changed files with 47 additions and 53 deletions

View File

@ -548,11 +548,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.223 (2020-05-11)"
#define Log_PLATFORM_VERSION "SWAD 19.223.1 (2020-05-11)"
#define CSS_FILE "swad19.217.css"
#define JS_FILE "swad19.223.js"
/*
Version 19.223: May 11, 2020 Store exam answer and refresh exam print. (303024 lines)
Version 19.223.1: May 11, 2020 Code refactoring in exam print. Stored float and text answers. (303023 lines)
Version 19.223: May 11, 2020 Store int answer and refresh exam print. (303024 lines)
Version 19.222.2: May 10, 2020 Fixed bugs in exams. (302852 lines)
Version 19.222.1: May 10, 2020 Code refactoring in exam prints. (302794 lines)
Version 19.222: May 10, 2020 Changes in exam prints. (302787 lines)
@ -574,7 +575,7 @@ UPDATE usr_data SET SideCols=0 WHERE (SideCols & 1)<>0 AND UsrCod NOT IN (SELECT
2 change necessary in database:
CREATE TABLE IF NOT EXISTS exa_prints (PrnCod INT NOT NULL AUTO_INCREMENT,EvtCod INT NOT NULL,UsrCod INT NOT NULL,StartTime DATETIME NOT NULL,EndTime DATETIME NOT NULL,NumQsts INT NOT NULL DEFAULT 0,NumQstsNotBlank INT NOT NULL DEFAULT 0,Sent ENUM('N','Y') NOT NULL DEFAULT 'N',Score DOUBLE PRECISION NOT NULL DEFAULT 0,UNIQUE INDEX(PrnCod),UNIQUE INDEX(EvtCod,UsrCod));
CREATE TABLE IF NOT EXISTS exa_print_questions (PrnCod INT NOT NULL,QstCod INT NOT NULL,QstInd INT NOT NULL,Score DOUBLE PRECISION NOT NULL DEFAULT 0,Indexes TEXT NOT NULL,Answers TEXT NOT NULL,UNIQUE INDEX(PrnCod,QstCod));
-----
Version 19.218.1: May 07, 2020 Fixed minor bug in test results and match results. (302171 lines)
Version 19.218: May 07, 2020 Fixed bug in creation of new exam announcements, reported by Francisco Gómez Mula.
Changes in exam announcementes. (302170 lines)
@ -601,7 +602,7 @@ ALTER TABLE room_MAC ENGINE=MyISAM;
Version 19.211: May 05, 2020 Exam events can be hidden/unhidden. (301215 lines)
1 change necessary in database:
ALTER TABLE exa_events ADD COLUMN Hidden ENUM('N','Y') NOT NULL DEFAULT 'N' AFTER ExaCod;
----
Version 19.210.4: May 05, 2020 Fixed bug searching courses. (301103 lines)
Version 19.210.3: May 03, 2020 All figures cacheable are cached everytime they are calculated. (301089 lines)
Version 19.210.2: May 03, 2020 More figures cached. (301125 lines)

View File

@ -106,16 +106,16 @@ static void ExaPrn_WriteQstAndAnsToFill (struct ExaPrn_Print *Print,
static void ExaPrn_WriteAnswersToFill (const struct ExaPrn_Print *Print,
unsigned NumQst,
const struct Tst_Question *Question);
static void ExaPrn_WriteIntAnsSeeing (const struct ExaPrn_Print *Print,
static void ExaPrn_WriteIntAnsToFill (const struct ExaPrn_Print *Print,
unsigned NumQst);
static void ExaPrn_WriteFloatAnsSeeing (const struct ExaPrn_Print *Print,
static void ExaPrn_WriteFloatAnsToFill (const struct ExaPrn_Print *Print,
unsigned NumQst);
static void ExaPrn_WriteTFAnsSeeing (const struct ExaPrn_Print *Print,
static void ExaPrn_WriteTFAnsToFill (const struct ExaPrn_Print *Print,
unsigned NumQst);
static void ExaPrn_WriteChoiceAnsSeeing (const struct ExaPrn_Print *Print,
static void ExaPrn_WriteChoiceAnsToFill (const struct ExaPrn_Print *Print,
unsigned NumQst,
const struct Tst_Question *Question);
static void ExaPrn_WriteTextAnsSeeing (const struct ExaPrn_Print *Print,
static void ExaPrn_WriteTextAnsToFill (const struct ExaPrn_Print *Print,
unsigned NumQst);
static unsigned ExaPrn_GetAnswerFromForm (struct ExaPrn_Print *Print);
@ -302,8 +302,6 @@ static void ExaPrn_GetQuestionsForNewPrintFromDB (struct ExaPrn_Print *Print)
" ORDER BY SetInd",
Print->ExaCod);
Ale_ShowAlert (Ale_INFO,"%u conjuntos de preguntas.",NumSets); // TODO: Remove this. Only for debug purpose.
/***** Get questions from all sets *****/
Print->NumQsts = 0;
if (NumSets)
@ -641,9 +639,6 @@ static void ExaPrn_WriteQstAndAnsToFill (struct ExaPrn_Print *Print,
/***** Stem, media and answers *****/
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
/* Write parameter with question code */
Tst_WriteParamQstCod (NumQst,Question->QstCod);
/* Stem */
Tst_WriteQstStem (Question->Stem,"TEST_EXA",true);
@ -673,20 +668,20 @@ static void ExaPrn_WriteAnswersToFill (const struct ExaPrn_Print *Print,
switch (Question->Answer.Type)
{
case Tst_ANS_INT:
ExaPrn_WriteIntAnsSeeing (Print,NumQst);
ExaPrn_WriteIntAnsToFill (Print,NumQst);
break;
case Tst_ANS_FLOAT:
ExaPrn_WriteFloatAnsSeeing (Print,NumQst);
ExaPrn_WriteFloatAnsToFill (Print,NumQst);
break;
case Tst_ANS_TRUE_FALSE:
ExaPrn_WriteTFAnsSeeing (Print,NumQst);
ExaPrn_WriteTFAnsToFill (Print,NumQst);
break;
case Tst_ANS_UNIQUE_CHOICE:
case Tst_ANS_MULTIPLE_CHOICE:
ExaPrn_WriteChoiceAnsSeeing (Print,NumQst,Question);
ExaPrn_WriteChoiceAnsToFill (Print,NumQst,Question);
break;
case Tst_ANS_TEXT:
ExaPrn_WriteTextAnsSeeing (Print,NumQst);
ExaPrn_WriteTextAnsToFill (Print,NumQst);
break;
default:
break;
@ -697,7 +692,7 @@ static void ExaPrn_WriteAnswersToFill (const struct ExaPrn_Print *Print,
/****************** Write integer answer when seeing a test ******************/
/*****************************************************************************/
static void ExaPrn_WriteIntAnsSeeing (const struct ExaPrn_Print *Print,
static void ExaPrn_WriteIntAnsToFill (const struct ExaPrn_Print *Print,
unsigned NumQst)
{
char Id[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x"
@ -716,7 +711,6 @@ static void ExaPrn_WriteIntAnsSeeing (const struct ExaPrn_Print *Print,
Id,Id,
Act_GetActCod (ActAnsExaPrn),
Gbl.Session.Id,Print->EvtCod,NumQst);
HTM_Txt (" />");
}
@ -724,25 +718,33 @@ static void ExaPrn_WriteIntAnsSeeing (const struct ExaPrn_Print *Print,
/****************** Write float answer when seeing a test ********************/
/*****************************************************************************/
static void ExaPrn_WriteFloatAnsSeeing (const struct ExaPrn_Print *Print,
static void ExaPrn_WriteFloatAnsToFill (const struct ExaPrn_Print *Print,
unsigned NumQst)
{
char StrAns[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x"
char Id[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x"
/***** Write input field for the answer *****/
snprintf (StrAns,sizeof (StrAns),
snprintf (Id,sizeof (Id),
"Ans%010u",
NumQst);
HTM_INPUT_TEXT (StrAns,Tst_MAX_BYTES_FLOAT_ANSWER,Print->PrintedQuestions[NumQst].StrAnswers,
HTM_DONT_SUBMIT_ON_CHANGE,
"size=\"11\"");
HTM_TxtF ("<input type=\"text\" id=\"%s\" name=\"%s\""
" size=\"11\" maxlength=\"%u\" value=\"%s\"",
Id,Id,Tst_MAX_BYTES_FLOAT_ANSWER,
Print->PrintedQuestions[NumQst].StrAnswers);
HTM_TxtF (" onchange=\"updateExamPrint('examprint','%s','%s',"
"'act=%ld&ses=%s&EvtCod=%ld&NumQst=%u');"
" return false;\"", // return false is necessary to not submit form
Id,Id,
Act_GetActCod (ActAnsExaPrn),
Gbl.Session.Id,Print->EvtCod,NumQst);
HTM_Txt (" />");
}
/*****************************************************************************/
/************** Write false / true answer when seeing a test ****************/
/*****************************************************************************/
static void ExaPrn_WriteTFAnsSeeing (const struct ExaPrn_Print *Print,
static void ExaPrn_WriteTFAnsToFill (const struct ExaPrn_Print *Print,
unsigned NumQst)
{
extern const char *Txt_TF_QST[2];
@ -763,7 +765,7 @@ static void ExaPrn_WriteTFAnsSeeing (const struct ExaPrn_Print *Print,
/******** Write single or multiple choice answer when seeing a test **********/
/*****************************************************************************/
static void ExaPrn_WriteChoiceAnsSeeing (const struct ExaPrn_Print *Print,
static void ExaPrn_WriteChoiceAnsToFill (const struct ExaPrn_Print *Print,
unsigned NumQst,
const struct Tst_Question *Question)
{
@ -844,18 +846,26 @@ static void ExaPrn_WriteChoiceAnsSeeing (const struct ExaPrn_Print *Print,
/******************** Write text answer when seeing a test *******************/
/*****************************************************************************/
static void ExaPrn_WriteTextAnsSeeing (const struct ExaPrn_Print *Print,
static void ExaPrn_WriteTextAnsToFill (const struct ExaPrn_Print *Print,
unsigned NumQst)
{
char StrAns[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x"
char Id[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x"
/***** Write input field for the answer *****/
snprintf (StrAns,sizeof (StrAns),
snprintf (Id,sizeof (Id),
"Ans%010u",
NumQst);
HTM_INPUT_TEXT (StrAns,Tst_MAX_CHARS_ANSWERS_ONE_QST,Print->PrintedQuestions[NumQst].StrAnswers,
HTM_DONT_SUBMIT_ON_CHANGE,
"size=\"40\"");
HTM_TxtF ("<input type=\"text\" id=\"%s\" name=\"%s\""
" size=\"40\" maxlength=\"%u\" value=\"%s\"",
Id,Id,Tst_MAX_CHARS_ANSWERS_ONE_QST,
Print->PrintedQuestions[NumQst].StrAnswers);
HTM_TxtF (" onchange=\"updateExamPrint('examprint','%s','%s',"
"'act=%ld&ses=%s&EvtCod=%ld&NumQst=%u');"
" return false;\"", // return false is necessary to not submit form
Id,Id,
Act_GetActCod (ActAnsExaPrn),
Gbl.Session.Id,Print->EvtCod,NumQst);
HTM_Txt (" />");
}
/*****************************************************************************/
@ -864,16 +874,10 @@ static void ExaPrn_WriteTextAnsSeeing (const struct ExaPrn_Print *Print,
void ExaPrn_ReceivePrintAnswer (void)
{
// struct Exa_Exams Exams;
// struct Exa_Exam Exam;
// struct ExaEvt_Event Event;
struct ExaPrn_Print Print;
unsigned NumQst;
/***** Reset exams context *****/
// Exa_ResetExams (&Exams);
// Exa_ResetExam (&Exam);
// ExaEvt_ResetEvent (&Event);
/***** Reset print *****/
ExaPrn_ResetPrint (&Print);
/***** Get and check parameters *****/
@ -883,17 +887,6 @@ void ExaPrn_ReceivePrintAnswer (void)
if (Print.PrnCod <= 0)
Lay_ShowErrorAndExit ("Wrong exam print.");
/***** Get exam data and event from database *****/
/*
Exam.ExaCod = Print.ExaCod;
Exa_GetDataOfExamByCod (Exam);
Exams->ExaCod = Exam.ExaCod;
Event.EvtCod = Print.EvtCod;
ExaEvt_GetDataOfEventByCod (Event);
Exams->EvtCod = Event.ExaCod;
*/
/***** Get questions and answers from database *****/
ExaPrn_GetPrintQuestionsFromDB (&Print);