mirror of
https://github.com/acanas/swad-core.git
synced 2024-09-22 00:00:40 +02:00
Version 20.78.1: May 20, 2021 Fixed bug in matches. Reported by Jesús Garrido Alcázar.
This commit is contained in:
parent
c208e3d542
commit
a6dae83d81
|
@ -13503,5 +13503,9 @@ 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;
|
||||
|
||||
|
|
@ -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)
|
||||
|
|
27
swad_exam.c
27
swad_exam.c
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
47
swad_game.c
47
swad_game.c
|
@ -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"
|
||||
" WHERE gam_questions.GamCod=%ld"
|
||||
" AND gam_questions.QstCod=tst_answers.QstCod"
|
||||
" GROUP BY tst_answers.QstCod",
|
||||
GamCod);
|
||||
if (NumAnswers < 2)
|
||||
Err_WrongAnswerExit ();
|
||||
/***** 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);
|
||||
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;
|
||||
*MinScore += -1.0 / (double) (NumAnswers - 1);
|
||||
*MaxScore += 1.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);
|
||||
}
|
||||
|
|
84
swad_match.c
84
swad_match.c
|
@ -1733,7 +1733,7 @@ void Mch_ResumeMatch (void)
|
|||
|
||||
/***** Show current match status *****/
|
||||
HTM_DIV_Begin ("id=\"match\" class=\"MCH_CONT\"");
|
||||
Mch_ShowMatchStatusForTch (&Match);
|
||||
Mch_ShowMatchStatusForTch (&Match);
|
||||
HTM_DIV_End ();
|
||||
}
|
||||
|
||||
|
@ -2852,14 +2852,14 @@ static void Mch_ShowRightColumnTch (const struct Mch_Match *Match)
|
|||
/***** Start right container *****/
|
||||
HTM_DIV_Begin ("class=\"MCH_RIGHT_TCH\"");
|
||||
|
||||
/***** Top row: match title *****/
|
||||
Mch_ShowMatchTitleTch (Match);
|
||||
/***** Top row: match title *****/
|
||||
Mch_ShowMatchTitleTch (Match);
|
||||
|
||||
/***** Bottom row: current question and possible answers *****/
|
||||
if (Match->Status.Showing == Mch_END) // Match over
|
||||
Mch_ShowMatchScore (Match);
|
||||
else // Match not over
|
||||
Mch_ShowQuestionAndAnswersTch (Match);
|
||||
/***** Bottom row: current question and possible answers *****/
|
||||
if (Match->Status.Showing == Mch_END) // Match over
|
||||
Mch_ShowMatchScore (Match);
|
||||
else // Match not over
|
||||
Mch_ShowQuestionAndAnswersTch (Match);
|
||||
|
||||
/***** End right container *****/
|
||||
HTM_DIV_End ();
|
||||
|
@ -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 *****/
|
||||
|
@ -3531,7 +3532,7 @@ static void Mch_ShowMatchScore (const struct Mch_Match *Match)
|
|||
/***** Get scores from database *****/
|
||||
NumScores = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get scores",
|
||||
"SELECT Score," // row[0]
|
||||
"SELECT Score," // row[0]
|
||||
"COUNT(*) AS NumUsrs" // row[1]
|
||||
" FROM mch_results"
|
||||
" WHERE MchCod=%ld"
|
||||
|
@ -3542,43 +3543,44 @@ static void Mch_ShowMatchScore (const struct Mch_Match *Match)
|
|||
/***** Begin table ****/
|
||||
HTM_TABLE_BeginWide ();
|
||||
|
||||
/***** Get and draw scores *****/
|
||||
for (NumScore = 0, NumRow = 0;
|
||||
NumScore < NumScores;
|
||||
NumScore++)
|
||||
{
|
||||
/***** Get score and number of users from database *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
/***** Get and draw scores *****/
|
||||
for (NumScore = 0, NumRow = 0;
|
||||
NumScore < NumScores;
|
||||
NumScore++)
|
||||
{
|
||||
/***** Get score and number of users from database *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get score (row[0]) */
|
||||
Str_SetDecimalPointToUS (); // To get the decimal point as a dot
|
||||
if (sscanf (row[0],"%lf",&Score) != 1)
|
||||
Score = 0.0;
|
||||
Str_SetDecimalPointToLocal (); // Return to local system
|
||||
/* Get score (row[0]) */
|
||||
Str_SetDecimalPointToUS (); // To get the decimal point as a dot
|
||||
if (sscanf (row[0],"%lf",&Score) != 1)
|
||||
Score = 0.0;
|
||||
Str_SetDecimalPointToLocal (); // Return to local system
|
||||
|
||||
/* Get number of users (row[1]) *****/
|
||||
if (sscanf (row[1],"%u",&NumUsrs) != 1)
|
||||
NumUsrs = 0;
|
||||
/* Get number of users (row[1]) *****/
|
||||
if (sscanf (row[1],"%u",&NumUsrs) != 1)
|
||||
NumUsrs = 0;
|
||||
|
||||
/***** Draw empty rows until reaching the adequate row *****/
|
||||
NumRowForThisScore = (unsigned) ((MaxScore - Score) * NumRowsPerScorePoint);
|
||||
if (NumRowForThisScore == Mch_NUM_ROWS_SCORE)
|
||||
NumRowForThisScore = Mch_NUM_ROWS_SCORE - 1;
|
||||
/***** Draw empty rows until reaching the adequate row *****/
|
||||
NumRowForThisScore = (unsigned) ((MaxScore - Score) * NumRowsPerScorePoint);
|
||||
if (NumRowForThisScore == Mch_NUM_ROWS_SCORE)
|
||||
NumRowForThisScore = Mch_NUM_ROWS_SCORE - 1;
|
||||
for (;
|
||||
NumRow < NumRowForThisScore;
|
||||
NumRow++)
|
||||
Mch_DrawEmptyScoreRow (NumRow,MinScore,MaxScore);
|
||||
|
||||
/***** Draw row for this score *****/
|
||||
Mch_DrawScoreRow (Score,MinScore,MaxScore,NumRow,NumUsrs,MaxUsrs);
|
||||
|
||||
NumRow++;
|
||||
}
|
||||
|
||||
/***** Draw final empty rows *****/
|
||||
for (;
|
||||
NumRow < NumRowForThisScore;
|
||||
NumRow < Mch_NUM_ROWS_SCORE;
|
||||
NumRow++)
|
||||
Mch_DrawEmptyScoreRow (NumRow,MinScore,MaxScore);
|
||||
|
||||
/***** Draw row for this score *****/
|
||||
Mch_DrawScoreRow (Score,MinScore,MaxScore,NumRow,NumUsrs,MaxUsrs);
|
||||
NumRow++;
|
||||
}
|
||||
|
||||
/***** Draw final empty rows *****/
|
||||
for (;
|
||||
NumRow < Mch_NUM_ROWS_SCORE;
|
||||
NumRow++)
|
||||
Mch_DrawEmptyScoreRow (NumRow,MinScore,MaxScore);
|
||||
Mch_DrawEmptyScoreRow (NumRow,MinScore,MaxScore);
|
||||
|
||||
/***** End table *****/
|
||||
HTM_TABLE_End ();
|
||||
|
|
Loading…
Reference in New Issue
Block a user