Version 20.78.1: May 20, 2021 Fixed bug in matches. Reported by Jesús Garrido Alcázar.

This commit is contained in:
acanas 2021-05-20 12:16:49 +02:00
parent c208e3d542
commit a6dae83d81
6 changed files with 81 additions and 88 deletions

View File

@ -13504,4 +13504,8 @@ RENAME TABLE pho_clicks_without_photo TO usr_clicks_without_photo;
SELECT gam_questions.QstCod,gam_questions.QstInd,tst_questions.AnsType,tst_questions.Shuffle FROM gam_questions,tst_questions WHERE gam_questions.GamCod=7 AND gam_questions.QstCod=tst_questions.QstCod ORDER BY gam_questions.QstInd;
---------------------------
SELECT COUNT(tst_answers.AnsInd) AS N FROM tst_answers,gam_questions WHERE gam_questions.GamCod=8 AND gam_questions.QstCod=tst_answers.QstCod GROUP BY tst_answers.QstCod;

View File

@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
*/
#define Log_PLATFORM_VERSION "SWAD 20.78 (2021-05-19)"
#define Log_PLATFORM_VERSION "SWAD 20.78.1 (2021-05-20)"
#define CSS_FILE "swad20.45.css"
#define JS_FILE "swad20.69.1.js"
/*
TODO: Rename CENTRE to CENTER in help wiki.
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
Version 20.78.1: May 20, 2021 Fixed bug in matches. Reported by Jesús Garrido Alcázar. (311317 lines)
Version 20.78: May 19, 2021 New module swad_chat_database for database queries related to chat. (311327 lines)
Version 20.77: May 18, 2021 New module swad_banner_database for database queries related to banners. (311249 lines)
Version 20.76: May 11, 2021 New module swad_atendance_database for database queries related to attendance events. (311109 lines)

View File

@ -1975,30 +1975,3 @@ double Exa_GetNumQstsPerCrsExam (Hie_Lvl_Level_t Scope)
return 0.0; // Not reached
}
}
/*****************************************************************************/
/*************** Get maximum score of an exam from database *******************/
/*****************************************************************************/
void Exa_GetScoreRange (long ExaCod,double *MinScore,double *MaxScore)
{
unsigned NumAnswers;
/***** Get number of answers of exam from database *****/
NumAnswers = (unsigned)
DB_QueryCOUNT ("can not get data of a question",
"SELECT COUNT(tst_answers.AnsInd)"
" FROM tst_answers,"
"exa_set_questions"
" WHERE exa_set_questions.ExaCod=%ld"
" AND exa_set_questions.QstCod=tst_answers.QstCod"
" GROUP BY tst_answers.QstCod",
ExaCod);
if (NumAnswers < 2)
Err_ShowErrorAndExit ("Wrong number of answers.");
/***** Set minimum and maximum scores *****/
*MinScore = *MaxScore = 0.0;
*MinScore += -1.0 / (double) (NumAnswers - 1);
*MaxScore += 1.0;
}

View File

@ -95,6 +95,4 @@ unsigned Exa_GetNumCoursesWithExams (Hie_Lvl_Level_t Scope);
unsigned Exa_GetNumExams (Hie_Lvl_Level_t Scope);
double Exa_GetNumQstsPerCrsExam (Hie_Lvl_Level_t Scope);
void Exa_GetScoreRange (long ExaCod,double *MinScore,double *MaxScore);
#endif

View File

@ -2879,23 +2879,38 @@ void Gam_ShowTstTagsPresentInAGame (long GamCod)
void Gam_GetScoreRange (long GamCod,double *MinScore,double *MaxScore)
{
MYSQL_RES *mysql_res;
MYSQL_ROW row;
unsigned NumQsts;
unsigned NumQst;
unsigned NumAnswers;
/***** Get number of answers of a game from database *****/
NumAnswers = (unsigned)
DB_QueryCOUNT ("can not number of answers of a question",
"SELECT COUNT(tst_answers.AnsInd)"
" FROM tst_answers,"
"gam_questions"
/***** Get maximum score of a game from database *****/
NumQsts = (unsigned)
DB_QuerySELECT (&mysql_res,"can not get data of a question",
"SELECT COUNT(tst_answers.AnsInd) AS N" // row[0]
" FROM tst_answers,gam_questions"
" WHERE gam_questions.GamCod=%ld"
" AND gam_questions.QstCod=tst_answers.QstCod"
" GROUP BY tst_answers.QstCod",
GamCod);
if (NumAnswers < 2)
Err_WrongAnswerExit ();
for (NumQst = 0, *MinScore = *MaxScore = 0.0;
NumQst < NumQsts;
NumQst++)
{
row = mysql_fetch_row (mysql_res);
/***** Set minimum and maximum scores *****/
*MinScore = *MaxScore = 0.0;
/* Get number of answers (row[0]) for this question */
if (sscanf (row[0],"%u",&NumAnswers) != 1)
NumAnswers = 0;
/* Accumulate minimum and maximum score */
if (NumAnswers < 2)
Err_ShowErrorAndExit ("Wrong number of answers.");
*MinScore += -1.0 / (double) (NumAnswers - 1);
*MaxScore += 1.0;
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}

View File

@ -3516,6 +3516,7 @@ static void Mch_ShowMatchScore (const struct Mch_Match *Match)
Range = MaxScore - MinScore;
if (Range == 0.0)
return;
NumRowsPerScorePoint = (double) Mch_NUM_ROWS_SCORE / Range;
/***** Get maximum number of users *****/
@ -3571,6 +3572,7 @@ static void Mch_ShowMatchScore (const struct Mch_Match *Match)
/***** Draw row for this score *****/
Mch_DrawScoreRow (Score,MinScore,MaxScore,NumRow,NumUsrs,MaxUsrs);
NumRow++;
}