Version19.8

This commit is contained in:
Antonio Cañas Vargas 2019-09-22 13:54:11 +02:00
parent 8d53450993
commit e727a66f68
12 changed files with 993 additions and 66 deletions

View File

@ -658,6 +658,18 @@ CREATE TABLE IF NOT EXISTS mch_players (
TS TIMESTAMP,
UNIQUE INDEX(MchCod,UsrCod));
--
-- Table mch_results: stores the current match results
--
CREATE TABLE IF NOT EXISTS mch_results (
MchResCod INT NOT NULL AUTO_INCREMENT,
MchCod INT NOT NULL,
UsrCod INT NOT NULL,
NumQsts INT NOT NULL DEFAULT 0,
NumQstsNotBlank INT NOT NULL DEFAULT 0,
Score DOUBLE PRECISION NOT NULL DEFAULT 0,
UNIQUE INDEX(MchResCod),
UNIQUE INDEX(MchCod,UsrCod));
--
-- Table gam_questions: stores the questions in the games
--
CREATE TABLE IF NOT EXISTS gam_questions (

View File

@ -2149,12 +2149,12 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActRenTag */{ 143,-1,TabUnk,ActReqTst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_RenameTag ,NULL},
/* ActRcvCfgTst */{ 454,-1,TabUnk,ActReqTst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_ReceiveConfigTst ,NULL},
/* ActReqSeeMyTstRes */{1083,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,Tst_SelDatesToSeeMyTestResults ,NULL},
/* ActSeeMyTstRes */{1084,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_ShowMyTestResults ,NULL},
/* ActSeeOneTstResMe */{1085,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_ShowOneTestResult ,NULL},
/* ActReqSeeMyTstRes */{1083,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,Tst_SelDatesToSeeMyTstResults ,NULL},
/* ActSeeMyTstRes */{1084,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_ShowMyTstResults ,NULL},
/* ActSeeOneTstResMe */{1085,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_ShowOneTstResult ,NULL},
/* ActReqSeeUsrTstRes*/{1080,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,Tst_SelUsrsToViewUsrsTstResults,NULL},
/* ActSeeUsrTstRes */{1081,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_ShowUsrsTestResults ,NULL},
/* ActSeeOneTstResOth*/{1082,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_ShowOneTestResult ,NULL},
/* ActSeeUsrTstRes */{1081,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_ShowUsrsTstResults ,NULL},
/* ActSeeOneTstResOth*/{1082,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_ShowOneTstResult ,NULL},
/* ActSeeGam */{1650,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_SeeOneGame ,NULL},
@ -2175,12 +2175,12 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActRefMchStd */{1782,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_AJAX_RFRESH,Mch_GetMatchBeingPlayed ,Mch_RefreshMatchStd ,NULL},
/* ActAnsMchQstStd */{1651,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Mch_GetMatchBeingPlayed ,Mch_ReceiveQstAnsFromStd ,NULL},
/* ActReqSeeMyMchRes */{1795,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,Tst_SelDatesToSeeMyTestResults ,NULL},
/* ActSeeMyMchRes */{1796,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_ShowMyTestResults ,NULL},
/* ActSeeOneMchResMe */{1797,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_ShowOneTestResult ,NULL},
/* ActReqSeeMyMchRes */{1795,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,Mch_SelDatesToSeeMyMchResults ,NULL},
/* ActSeeMyMchRes */{1796,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ShowMyMchResults ,NULL},
/* ActSeeOneMchResMe */{1797,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ShowOneMchResult ,NULL},
/* ActReqSeeUsrMchRes*/{1798,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,Mch_SelUsrsToViewUsrsMchResults,NULL},
/* ActSeeUsrMchRes */{1799,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_ShowUsrsTestResults ,NULL},
/* ActSeeOneMchResOth*/{1800,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_ShowOneTestResult ,NULL},
/* ActSeeUsrMchRes */{1799,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ShowUsrsMchResults ,NULL},
/* ActSeeOneMchResOth*/{1800,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ShowOneMchResult ,NULL},
/* ActFrmNewGam */{1652,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RequestCreatOrEditGame ,NULL},
/* ActEdiOneGam */{1653,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RequestCreatOrEditGame ,NULL},

View File

@ -441,6 +441,12 @@ Lo de mutear anuncios, en principio prefiero hacer una opci
// TODO: Al confirmar una inscripción, mostrar ficha de retroalimentación similar a la que se muestra cuando se crea un administrador. Tal y como está ahora crea confusión al usuario.
// TODO: Suggested by Jose Luis Bernier Villamor: "Compartidos" debería inhabilitarse si el profesor lo quiere, porque algunos alumnos suben por error los trabajos
// Alternativa. Llamarle "Públicos" o algo así y poner la opción más alejada de Trabajos.
// TODO: Suggested by Jose Luis Bernier Villamor: Posibilidad de que los profesores decidan en la configuración
// de la asignatura si desean o no que se pueda solicitar
// inscripción en la asignatura
// TODO: En Eventos de asistencia, poner un icono de enlace a horario de la asignatura ¿y otro a grupos?
// 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
@ -462,12 +468,19 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 19.7.1 (2019-09-18)"
#define Log_PLATFORM_VERSION "SWAD 19.8 (2019-09-22)"
#define CSS_FILE "swad19.3.css"
#define JS_FILE "swad18.130.2.js"
/*
Version 19.7.1: Sep 17, 2019 Users' selection to view the matches results. (244768 lines)
Version 19.7: Sep 17, 2019 New actions to view the matches results. (244664 lines)
Version 19.8: Sep 22, 2019 View matches results. Not finished.
Help links related to test and match results changed. (245412 lines)
1 change necessary in database:
CREATE TABLE IF NOT EXISTS mch_results (MchResCod INT NOT NULL AUTO_INCREMENT,MchCod INT NOT NULL,UsrCod INT NOT NULL,NumQsts INT NOT NULL DEFAULT 0,NumQstsNotBlank INT NOT NULL DEFAULT 0,Score DOUBLE PRECISION NOT NULL DEFAULT 0,UNIQUE INDEX(MchResCod),UNIQUE INDEX(MchCod,UsrCod));
Version 19.7.3: Sep 19, 2019 View matches results. Not finished. (244858 lines)
Version 19.7.2: Sep 19, 2019 Users' selection to view my matches results. (244789 lines)
Version 19.7.1: Sep 18, 2019 Users' selection to view users' matches results. (244768 lines)
Version 19.7: Sep 18, 2019 New actions to view the matches results. (244664 lines)
6 changes necessary in database:
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1795','es','N','Seleccionar fechas para mis result. partidas');
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1796','es','N','Ver mis resultados de partidas');

134
swad_cookie.c Normal file
View File

@ -0,0 +1,134 @@
// swad_cookies.c: user's preferences about cookies
/*
SWAD (Shared Workspace At a Distance),
is a web platform developed at the University of Granada (Spain),
and used to support university teaching.
This file is part of SWAD core.
Copyright (C) 1999-2019 Antonio Cañas Vargas
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*****************************************************************************/
/********************************* Headers ***********************************/
/*****************************************************************************/
#include "swad_box.h"
#include "swad_cookie.h"
#include "swad_database.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_layout.h"
#include "swad_setting.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
/*****************************************************************************/
extern struct Globals Gbl;
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
/*****************************************************************************/
/***************************** Private constants *****************************/
/*****************************************************************************/
/*****************************************************************************/
/***************************** Private prototypes ****************************/
/*****************************************************************************/
static void Coo_PutIconsCookies (void);
/*****************************************************************************/
/********************* Edit my preferences on cookies ************************/
/*****************************************************************************/
void Coo_EditMyPrefsOnCookies (void)
{
extern const char *Hlp_PROFILE_Settings_cookies;
extern const char *Txt_Cookies;
extern const char *Txt_Accept_third_party_cookies_to_view_multimedia_content_from_other_websites;
/***** Start section with preferences about cookies *****/
Lay_StartSection (Coo_COOKIES_ID);
/***** Start box and table *****/
Box_StartBoxTable (NULL,Txt_Cookies,Coo_PutIconsCookies,
Hlp_PROFILE_Settings_cookies,Box_NOT_CLOSABLE,2);
/***** Edit my preference about cookies *****/
/* Start form */
Frm_StartFormAnchor (ActChgCooPrf,Coo_COOKIES_ID);
/* Start container */
fprintf (Gbl.F.Out,"<div class=\"%s\">",
(Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies) ? "DAT_N LIGHT_BLUE" :
"DAT");
/* Check box */
fprintf (Gbl.F.Out,"<label>"
"<input type=\"checkbox\""
" name=\"cookies\" value=\"Y\"");
if (Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies)
fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />"
"%s"
"</label>",
Gbl.Form.Id,
Txt_Accept_third_party_cookies_to_view_multimedia_content_from_other_websites);
/* End container */
fprintf (Gbl.F.Out,"</div>");
/***** End table and box *****/
Box_EndBoxTable ();
/***** End section with preferences about cookies *****/
Lay_EndSection ();
}
/*****************************************************************************/
/***************** Put contextual icons in cookies preference ****************/
/*****************************************************************************/
static void Coo_PutIconsCookies (void)
{
/***** Put icon to show a figure *****/
Gbl.Figures.FigureType = Fig_COOKIES;
Fig_PutIconToShowFigure ();
}
/*****************************************************************************/
/************** Change my preference about third party cookies ***************/
/*****************************************************************************/
void Coo_ChangeMyPrefsCookies (void)
{
/***** Get param with preference about third party cookies *****/
Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies = Par_GetParToBool ("cookies");
/***** Store preference in database *****/
if (Gbl.Usrs.Me.Logged)
DB_QueryUPDATE ("can not update your preference about cookies",
"UPDATE usr_data SET ThirdPartyCookies='%c'"
" WHERE UsrCod=%ld",
Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies ? 'Y' :
'N',
Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Show forms again *****/
Set_EditSettings ();
}

43
swad_cookie.h Normal file
View File

@ -0,0 +1,43 @@
// swad_cookie.h: user's preferences about cookies
#ifndef _SWAD_COO
#define _SWAD_COO
/*
SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain),
and used to support university teaching.
This file is part of SWAD core.
Copyright (C) 1999-2019 Antonio Cañas Vargas
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*****************************************************************************/
/********************************* Headers ***********************************/
/*****************************************************************************/
/*****************************************************************************/
/************************* Public types and constants ************************/
/*****************************************************************************/
#define Coo_COOKIES_ID "cookies"
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void Coo_EditMyPrefsOnCookies (void);
void Coo_ChangeMyPrefsCookies (void);
#endif

View File

@ -1433,6 +1433,31 @@ mysql> DESCRIBE mch_players;
"TS TIMESTAMP,"
"UNIQUE INDEX(MchCod,UsrCod))");
/***** Table mch_results *****/
/*
mysql> DESCRIBE mch_results;
+-----------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+---------+------+-----+---------+----------------+
| MchResCod | int(11) | NO | PRI | NULL | auto_increment |
| MchCod | int(11) | NO | MUL | NULL | |
| UsrCod | int(11) | NO | | NULL | |
| NumQsts | int(11) | NO | | 0 | |
| NumQstsNotBlank | int(11) | NO | | 0 | |
| Score | double | NO | | 0 | |
+-----------------+---------+------+-----+---------+----------------+
6 rows in set (0.01 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS mch_results ("
"MchResCod INT NOT NULL AUTO_INCREMENT,"
"MchCod INT NOT NULL,"
"UsrCod INT NOT NULL,"
"NumQsts INT NOT NULL DEFAULT 0,"
"NumQstsNotBlank INT NOT NULL DEFAULT 0,"
"Score DOUBLE PRECISION NOT NULL DEFAULT 0,"
"UNIQUE INDEX(MchResCod),"
"UNIQUE INDEX(MchCod,UsrCod))");
/***** Table gam_questions *****/
/*
mysql> DESCRIBE gam_questions;

View File

@ -1243,6 +1243,28 @@ const char *Hlp_ASSESSMENT_Tests_results =
"ASSESSMENT.Tests.en#test-results"; // TODO: Change to #results
#endif
const char *Hlp_ASSESSMENT_Games_results =
#if L==1
"ASSESSMENT.Games.es#resultados";
#elif L==2
"ASSESSMENT.Games.en#results";
#elif L==3
"ASSESSMENT.Games.en#results";
#elif L==4
"ASSESSMENT.Games.es#resultados";
#elif L==5
"ASSESSMENT.Games.en#results";
#elif L==6
"ASSESSMENT.Games.es#resultados";
#elif L==7
"ASSESSMENT.Games.en#results";
#elif L==8
"ASSESSMENT.Games.en#results";
#elif L==9
"ASSESSMENT.Games.en#results";
#endif
const char *Hlp_ASSESSMENT_Surveys =
#if L==1
"ASSESSMENT.Surveys.es";

View File

@ -39,6 +39,7 @@
#include "swad_game.h"
#include "swad_global.h"
#include "swad_group.h"
#include "swad_ID.h"
#include "swad_match.h"
#include "swad_pagination.h"
#include "swad_parameter.h"
@ -131,8 +132,9 @@ static void Mch_GetMatchDataFromRow (MYSQL_RES *mysql_res,
static Mch_Showing_t Mch_GetShowingFromStr (const char *Str);
static void Mch_PutParamCurrentMchCod (void);
static void Mch_PutParamMatchCod (long MchCod);
static long Mch_GetParamMatchCod (void);
static void Mch_PutParamMchCod (long MchCod);
static long Mch_GetParamMchCod (void);
static long Mch_GetParamMchResCod (void);
static void Mch_PutButtonNewMatch (long GamCod);
@ -195,6 +197,15 @@ static unsigned Mch_GetNumUsrsWhoHaveChosenAns (long MchCod,unsigned QstInd,unsi
static unsigned Mch_GetNumUsrsWhoHaveAnswerMch (long MchCod);
static void Mch_DrawBarNumUsrs (unsigned NumAnswerersAns,unsigned NumAnswerersQst,bool Correct);
static void Mch_ShowHeaderMchResults (void);
static void Mch_ShowMchResults (struct UsrData *UsrDat);
static void Mch_GetMatchResultDataByMchCod (long MchResCod,
time_t *StartTimeUTC,
time_t *EndTimeUTC,
unsigned *NumQsts,
unsigned *NumQstsNotBlank,
double *Score);
/*****************************************************************************/
/************************* List the matches of a game ************************/
/*****************************************************************************/
@ -416,7 +427,7 @@ static void Mch_ListOneOrMoreMatches (struct Game *Game,
/* Put icon to remove the match */
Frm_StartForm (ActReqRemMchTch);
Mch_PutParamMatchCod (Match.MchCod);
Mch_PutParamMchCod (Match.MchCod);
Ico_PutIconRemove ();
Frm_EndForm ();
@ -691,7 +702,7 @@ void Mch_RequestRemoveMatchTch (void)
/***** Get parameters *****/
/* Get match code */
if ((Match.MchCod = Mch_GetParamMatchCod ()) == -1L)
if ((Match.MchCod = Mch_GetParamMchCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of match is missing.");
/***** Get data of the match from database *****/
@ -722,7 +733,7 @@ void Mch_RemoveMatchTch (void)
/***** Get parameters *****/
/* Get match code */
if ((Match.MchCod = Mch_GetParamMatchCod ()) == -1L)
if ((Match.MchCod = Mch_GetParamMchCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of match is missing.");
/***** Get data of the match from database *****/
@ -798,14 +809,14 @@ void Mch_RemoveMatchTch (void)
static void Mch_PutParamCurrentMchCod (void)
{
if (Mch_CurrentMchCod > 0)
Mch_PutParamMatchCod (Mch_CurrentMchCod);
Mch_PutParamMchCod (Mch_CurrentMchCod);
}
/*****************************************************************************/
/******************** Write parameter with code of match **********************/
/*****************************************************************************/
static void Mch_PutParamMatchCod (long MchCod)
static void Mch_PutParamMchCod (long MchCod)
{
Par_PutHiddenParamLong ("MchCod",MchCod);
}
@ -814,12 +825,22 @@ static void Mch_PutParamMatchCod (long MchCod)
/********************* Get parameter with code of match **********************/
/*****************************************************************************/
static long Mch_GetParamMatchCod (void)
static long Mch_GetParamMchCod (void)
{
/***** Get code of match *****/
return Par_GetParToLong ("MchCod");
}
/*****************************************************************************/
/****************** Get parameter with code of match result ******************/
/*****************************************************************************/
static long Mch_GetParamMchResCod (void)
{
/***** Get code of match *****/
return Par_GetParToLong ("MchResCod");
}
/*****************************************************************************/
/********************* Put button to create a new match **********************/
/*****************************************************************************/
@ -1727,7 +1748,7 @@ static void Mch_PutCheckboxResult (struct Match *Match)
/***** Start form *****/
Frm_StartForm (ActChgDisResMchTch);
Mch_PutParamMatchCod (Match->MchCod); // Current match being played
Mch_PutParamMchCod (Match->MchCod); // Current match being played
/***** Put icon with link *****/
/* Submitting onmousedown instead of default onclick
@ -1933,7 +1954,7 @@ static void Mch_ShowQuestionAndAnswersStd (struct Match *Match)
is necessary in order to be fast
and not lose clicks due to refresh */
Frm_StartForm (ActAnsMchQstStd);
Mch_PutParamMatchCod (Match->MchCod); // Current match being played
Mch_PutParamMchCod (Match->MchCod); // Current match being played
Gam_PutParamQstInd (Match->Status.QstInd); // Current question index shown
Mch_PutParamAnswer (Index); // Index for this option
fprintf (Gbl.F.Out,"<button type=\"submit\""
@ -1999,7 +2020,7 @@ static void Mch_PutBigButton (Act_Action_t NextAction,long MchCod,
{
/***** Start form *****/
Frm_StartForm (NextAction);
Mch_PutParamMatchCod (MchCod);
Mch_PutParamMchCod (MchCod);
/***** Put icon with link *****/
/* Submitting onmousedown instead of default onclick
@ -2151,7 +2172,7 @@ void Mch_ShowFinishedMatchResults (void)
void Mch_GetMatchBeingPlayed (void)
{
/***** Get match code ****/
if ((Gbl.Games.MchCodBeingPlayed = Mch_GetParamMatchCod ()) == -1L)
if ((Gbl.Games.MchCodBeingPlayed = Mch_GetParamMchCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of match is missing.");
}
@ -2453,13 +2474,65 @@ void Mch_PutFormToViewMchResults (Act_Action_t Action)
fprintf (Gbl.F.Out,"</div>");
}
/*****************************************************************************/
/****************** Select dates to show my matches results ******************/
/*****************************************************************************/
void Mch_SelDatesToSeeMyMchResults (void)
{
extern const char *Hlp_ASSESSMENT_Games_results;
extern const char *Txt_Results;
extern const char *Txt_View_matches_results;
/***** Start form *****/
Frm_StartForm (ActSeeMyMchRes);
/***** Start box and table *****/
Box_StartBoxTable (NULL,Txt_Results,NULL,
Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE,2);
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (false);
/***** End table, send button and end box *****/
Box_EndBoxTableWithButton (Btn_CONFIRM_BUTTON,Txt_View_matches_results);
/***** End form *****/
Frm_EndForm ();
}
/*****************************************************************************/
/*************************** Show my matches results *************************/
/*****************************************************************************/
void Mch_ShowMyMchResults (void)
{
extern const char *Hlp_ASSESSMENT_Games_results;
extern const char *Txt_Results;
/***** Get starting and ending dates *****/
Dat_GetIniEndDatesFromForm ();
/***** Start box and table *****/
Box_StartBoxTable (NULL,Txt_Results,NULL,
Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE,2);
/***** Header of the table with the list of users *****/
Mch_ShowHeaderMchResults ();
/***** List my test results *****/
// Tst_GetConfigTstFromDB (); // To get feedback type // TODO: Change to matches results
Mch_ShowMchResults (&Gbl.Usrs.Me.UsrDat);
/***** End table and box *****/
Box_EndBoxTable ();
}
/*****************************************************************************/
/*********** Select users and dates to show their matches results ************/
/*****************************************************************************/
void Mch_SelUsrsToViewUsrsMchResults (void)
{
extern const char *Hlp_ASSESSMENT_Tests_results; // TODO: Change to matches results
extern const char *Hlp_ASSESSMENT_Games_results;
extern const char *The_ClassFormInBox[The_NUM_THEMES];
extern const char *Txt_Results;
extern const char *Txt_Users;
@ -2484,7 +2557,7 @@ void Mch_SelUsrsToViewUsrsMchResults (void)
/***** Start box *****/
Box_StartBox (NULL,Txt_Results,NULL,
Hlp_ASSESSMENT_Tests_results,Box_NOT_CLOSABLE);
Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE);
/***** Show form to select the groups *****/
Grp_ShowFormToSelectSeveralGroups (NULL,
@ -2554,3 +2627,582 @@ void Mch_SelUsrsToViewUsrsMchResults (void)
/***** Free memory for list of selected groups *****/
Grp_FreeListCodSelectedGrps ();
}
/*****************************************************************************/
/****************** Show matches results for several users *******************/
/*****************************************************************************/
void Mch_ShowUsrsMchResults (void)
{
extern const char *Hlp_ASSESSMENT_Games_results;
extern const char *Txt_Results;
extern const char *Txt_You_must_select_one_ore_more_users;
const char *Ptr;
/***** Get list of the selected users's IDs *****/
Usr_GetListsSelectedUsrsCods ();
/***** Get starting and ending dates *****/
Dat_GetIniEndDatesFromForm ();
/***** Check the number of users whose tests results will be shown *****/
if (Usr_CountNumUsrsInListOfSelectedUsrs ()) // If some users are selected...
{
/***** Start box and table *****/
Box_StartBoxTable (NULL,Txt_Results,NULL,
Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE,2);
/***** Header of the table with the list of users *****/
Mch_ShowHeaderMchResults ();
/***** List the test exams of the selected users *****/
Ptr = Gbl.Usrs.Selected.List[Rol_UNK];
while (*Ptr)
{
Par_GetNextStrUntilSeparParamMult (&Ptr,Gbl.Usrs.Other.UsrDat.EncryptedUsrCod,
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat);
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // Get of the database the data of the user
if (Usr_CheckIfICanViewTst (&Gbl.Usrs.Other.UsrDat)) // TODO: Change to matches results
/***** Show matches results *****/
Mch_ShowMchResults (&Gbl.Usrs.Other.UsrDat);
}
/***** End table and box *****/
Box_EndBoxTable ();
}
else // If no users are selected...
{
// ...write warning alert
Ale_ShowAlert (Ale_WARNING,Txt_You_must_select_one_ore_more_users);
// ...and show again the form
Mch_SelUsrsToViewUsrsMchResults ();
}
/***** Free memory used by list of selected users' codes *****/
Usr_FreeListsSelectedUsrsCods ();
}
/*****************************************************************************/
/********************* Show header of my matches results *********************/
/*****************************************************************************/
static void Mch_ShowHeaderMchResults (void)
{
extern const char *Txt_User[Usr_NUM_SEXS];
extern const char *Txt_Date;
extern const char *Txt_Questions;
extern const char *Txt_Non_blank_BR_questions;
extern const char *Txt_Total_BR_score;
extern const char *Txt_Average_BR_score_BR_per_question_BR_from_0_to_1;
extern const char *Txt_Score;
extern const char *Txt_out_of_PART_OF_A_SCORE;
fprintf (Gbl.F.Out,"<tr>"
"<th colspan=\"2\" class=\"CENTER_TOP\">"
"%s"
"</th>"
"<th class=\"RIGHT_TOP\">"
"%s"
"</th>"
"<th class=\"RIGHT_TOP\">"
"%s"
"</th>"
"<th class=\"RIGHT_TOP\">"
"%s"
"</th>"
"<th class=\"RIGHT_TOP\">"
"%s"
"</th>"
"<th class=\"RIGHT_TOP\">"
"%s"
"</th>"
"<th class=\"RIGHT_TOP\">"
"%s<br />%s<br />%u"
"</th>"
"<th></th>"
"</tr>",
Txt_User[Usr_SEX_UNKNOWN],
Txt_Date,
Txt_Questions,
Txt_Non_blank_BR_questions,
Txt_Total_BR_score,
Txt_Average_BR_score_BR_per_question_BR_from_0_to_1,
Txt_Score,Txt_out_of_PART_OF_A_SCORE,Tst_SCORE_MAX);
}
/*****************************************************************************/
/*********** Show the test results of a user in the current course ***********/
/*****************************************************************************/
static void Mch_ShowMchResults (struct UsrData *UsrDat)
{
extern const char *Txt_Today;
extern const char *Txt_View_test;
MYSQL_RES *mysql_res;
MYSQL_ROW row;
unsigned NumExams;
unsigned NumTest;
static unsigned UniqueId = 0;
long TstCod;
unsigned NumQstsInThisTest;
unsigned NumQstsNotBlankInThisTest;
unsigned NumTotalQsts = 0;
unsigned NumTotalQstsNotBlank = 0;
double ScoreInThisTest;
double TotalScoreOfAllTests = 0.0;
unsigned NumExamsVisibleByTchs = 0;
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
bool ICanViewTest;
bool ICanViewScore;
time_t TimeUTC;
char *ClassDat;
/***** Make database query *****/
NumExams =
(unsigned) DB_QuerySELECT (&mysql_res,"can not get test exams of a user",
"SELECT TstCod," // row[0]
"AllowTeachers," // row[1]
"UNIX_TIMESTAMP(TstTime)," // row[2]
"NumQsts," // row[3]
"NumQstsNotBlank," // row[4]
"Score" // row[5]
" FROM tst_exams"
" WHERE CrsCod=%ld AND UsrCod=%ld"
" AND TstTime>=FROM_UNIXTIME(%ld)"
" AND TstTime<=FROM_UNIXTIME(%ld)"
" ORDER BY TstCod",
Gbl.Hierarchy.Crs.CrsCod,
UsrDat->UsrCod,
(long) Gbl.DateRange.TimeUTC[0],
(long) Gbl.DateRange.TimeUTC[1]);
/***** Show user's data *****/
fprintf (Gbl.F.Out,"<tr>");
// Tst_ShowDataUsr (UsrDat,NumExams); // TODO: Change to matches results
/***** Get and print test results *****/
if (NumExams)
{
for (NumTest = 0;
NumTest < NumExams;
NumTest++)
{
row = mysql_fetch_row (mysql_res);
/* Get test code (row[0]) */
if ((TstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
Lay_ShowErrorAndExit ("Wrong code of test result.");
/* Get if teachers are allowed to see this test result (row[1]) */
Gbl.Test.AllowTeachers = (row[1][0] == 'Y');
ClassDat = Gbl.Test.AllowTeachers ? "DAT" :
"DAT_LIGHT";
switch (Gbl.Usrs.Me.Role.Logged)
{
case Rol_STD:
ICanViewTest = ItsMe;
ICanViewScore = ItsMe &&
Gbl.Test.Config.Feedback != Tst_FEEDBACK_NOTHING;
break;
case Rol_NET:
case Rol_TCH:
case Rol_DEG_ADM:
case Rol_CTR_ADM:
case Rol_INS_ADM:
ICanViewTest =
ICanViewScore = ItsMe ||
Gbl.Test.AllowTeachers;
break;
case Rol_SYS_ADM:
ICanViewTest =
ICanViewScore = true;
break;
default:
ICanViewTest =
ICanViewScore = false;
break;
}
if (NumTest)
fprintf (Gbl.F.Out,"<tr>");
/* Write date and time (row[2] holds UTC date-time) */
TimeUTC = Dat_GetUNIXTimeFromStr (row[2]);
UniqueId++;
fprintf (Gbl.F.Out,"<td id =\"tst_date_%u\" class=\"%s RIGHT_TOP COLOR%u\">"
"<script type=\"text/javascript\">"
"writeLocalDateHMSFromUTC('tst_date_%u',%ld,"
"%u,',&nbsp;','%s',true,false,0x7);"
"</script>"
"</td>",
UniqueId,ClassDat,Gbl.RowEvenOdd,
UniqueId,(long) TimeUTC,
(unsigned) Gbl.Prefs.DateFormat,Txt_Today);
/* Get number of questions (row[3]) */
if (sscanf (row[3],"%u",&NumQstsInThisTest) != 1)
NumQstsInThisTest = 0;
if (Gbl.Test.AllowTeachers)
NumTotalQsts += NumQstsInThisTest;
/* Get number of questions not blank (row[4]) */
if (sscanf (row[4],"%u",&NumQstsNotBlankInThisTest) != 1)
NumQstsNotBlankInThisTest = 0;
if (Gbl.Test.AllowTeachers)
NumTotalQstsNotBlank += NumQstsNotBlankInThisTest;
/* Get score (row[5]) */
Str_SetDecimalPointToUS (); // To get the decimal point as a dot
if (sscanf (row[5],"%lf",&ScoreInThisTest) != 1)
ScoreInThisTest = 0.0;
Str_SetDecimalPointToLocal (); // Return to local system
if (Gbl.Test.AllowTeachers)
TotalScoreOfAllTests += ScoreInThisTest;
/* Write number of questions */
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_TOP COLOR%u\">",
ClassDat,Gbl.RowEvenOdd);
if (ICanViewTest)
fprintf (Gbl.F.Out,"%u",NumQstsInThisTest);
fprintf (Gbl.F.Out,"</td>");
/* Write number of questions not blank */
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_TOP COLOR%u\">",
ClassDat,Gbl.RowEvenOdd);
if (ICanViewTest)
fprintf (Gbl.F.Out,"%u",NumQstsNotBlankInThisTest);
fprintf (Gbl.F.Out,"</td>");
/* Write score */
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_TOP COLOR%u\">",
ClassDat,Gbl.RowEvenOdd);
if (ICanViewScore)
fprintf (Gbl.F.Out,"%.2lf",ScoreInThisTest);
fprintf (Gbl.F.Out,"</td>");
/* Write average score per question */
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_TOP COLOR%u\">",
ClassDat,Gbl.RowEvenOdd);
if (ICanViewScore)
fprintf (Gbl.F.Out,"%.2lf",
NumQstsInThisTest ? ScoreInThisTest / (double) NumQstsInThisTest :
0.0);
fprintf (Gbl.F.Out,"</td>");
/* Write score over Tst_SCORE_MAX */
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_TOP COLOR%u\">",
ClassDat,Gbl.RowEvenOdd);
if (ICanViewScore)
fprintf (Gbl.F.Out,"%.2lf",
NumQstsInThisTest ? ScoreInThisTest * Tst_SCORE_MAX / (double) NumQstsInThisTest :
0.0);
fprintf (Gbl.F.Out,"</td>");
/* Link to show this result */
fprintf (Gbl.F.Out,"<td class=\"RIGHT_TOP COLOR%u\">",
Gbl.RowEvenOdd);
if (ICanViewTest)
{
Frm_StartForm (Gbl.Action.Act == ActSeeMyTstRes ? ActSeeOneTstResMe :
ActSeeOneTstResOth);
// Tst_PutParamTstCod (TstCod); // TODO: Change to matches results
Ico_PutIconLink ("tasks.svg",Txt_View_test);
Frm_EndForm ();
}
fprintf (Gbl.F.Out,"</td>"
"</tr>");
if (Gbl.Test.AllowTeachers)
NumExamsVisibleByTchs++;
}
/***** Write totals for this user *****/
// Tst_ShowTestResultsSummaryRow (ItsMe,NumExamsVisibleByTchs,
// NumTotalQsts,NumTotalQstsNotBlank,
// TotalScoreOfAllTests); // TODO: Change to matches results
}
else
fprintf (Gbl.F.Out,"<td class=\"COLOR%u\"></td>"
"<td class=\"COLOR%u\"></td>"
"<td class=\"COLOR%u\"></td>"
"<td class=\"COLOR%u\"></td>"
"<td class=\"COLOR%u\"></td>"
"<td class=\"COLOR%u\"></td>"
"<td class=\"COLOR%u\"></td>"
"</tr>",
Gbl.RowEvenOdd,
Gbl.RowEvenOdd,
Gbl.RowEvenOdd,
Gbl.RowEvenOdd,
Gbl.RowEvenOdd,
Gbl.RowEvenOdd,
Gbl.RowEvenOdd);
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
/*****************************************************************************/
/******************* Show one match result of another user *******************/
/*****************************************************************************/
void Mch_ShowOneMchResult (void)
{
extern const char *Hlp_ASSESSMENT_Games_results;
extern const char *Txt_Match_result;
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
extern const char *Txt_Date;
extern const char *Txt_Today;
extern const char *Txt_Questions;
extern const char *Txt_non_blank_QUESTIONS;
extern const char *Txt_Score;
extern const char *Txt_out_of_PART_OF_A_SCORE;
long MchResCod;
time_t StartTimeUTC = 0; // Match result UTC date-time, initialized to avoid warning
time_t EndTimeUTC = 0; // Match result UTC date-time, initialized to avoid warning
unsigned NumQstsNotBlank;
double TotalScore;
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
bool ItsMe;
bool ICanViewTest;
bool ICanViewScore;
/***** Get the code of the test *****/
if ((MchResCod = Mch_GetParamMchResCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of match result is missing.");
/***** Get test result data *****/
Mch_GetMatchResultDataByMchCod (MchResCod,
&StartTimeUTC,
&EndTimeUTC,
&Gbl.Test.NumQsts,
&NumQstsNotBlank,
&TotalScore);
Gbl.Test.Config.Feedback = Tst_FEEDBACK_FULL_FEEDBACK; // Initialize feedback to maximum
/***** Check if I can view this test result *****/
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
switch (Gbl.Usrs.Me.Role.Logged)
{
case Rol_STD:
ICanViewTest = ItsMe;
if (ItsMe)
{
Tst_GetConfigTstFromDB (); // To get feedback type
ICanViewScore = Gbl.Test.Config.Feedback != Tst_FEEDBACK_NOTHING;
}
else
ICanViewScore = false;
break;
case Rol_TCH:
case Rol_DEG_ADM:
case Rol_CTR_ADM:
case Rol_INS_ADM:
switch (Gbl.Action.Act)
{
case ActSeeOneTstResMe:
ICanViewTest =
ICanViewScore = ItsMe;
break;
case ActSeeOneTstResOth:
ICanViewTest =
ICanViewScore = ItsMe ||
Gbl.Test.AllowTeachers;
break;
default:
ICanViewTest =
ICanViewScore = false;
break;
}
break;
case Rol_SYS_ADM:
ICanViewTest =
ICanViewScore = true;
break;
default:
ICanViewTest =
ICanViewScore = false;
break;
}
if (ICanViewTest) // I am allowed to view this test result
{
/***** Get questions and user's answers of the test result from database *****/
// Tst_GetTestResultQuestionsFromDB (TstCod); // TODO: Change to matches results
/***** Start box *****/
Box_StartBox (NULL,Txt_Match_result,NULL,
Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE);
Lay_WriteHeaderClassPhoto (false,false,
Gbl.Hierarchy.Ins.InsCod,
Gbl.Hierarchy.Deg.DegCod,
Gbl.Hierarchy.Crs.CrsCod);
/***** Start table *****/
Tbl_StartTableWideMargin (10);
/***** Header row *****/
/* Get data of the user who made the test */
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
Lay_ShowErrorAndExit ("User does not exists.");
if (!Usr_CheckIfICanViewTst (&Gbl.Usrs.Other.UsrDat))
Lay_ShowErrorAndExit ("You can not view this test result.");
/* User */
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"DAT_N RIGHT_TOP\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_TOP\">",
Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role][Gbl.Usrs.Other.UsrDat.Sex]);
ID_WriteUsrIDs (&Gbl.Usrs.Other.UsrDat,NULL);
fprintf (Gbl.F.Out," %s",
Gbl.Usrs.Other.UsrDat.Surname1);
if (Gbl.Usrs.Other.UsrDat.Surname2[0])
fprintf (Gbl.F.Out," %s",
Gbl.Usrs.Other.UsrDat.Surname2);
if (Gbl.Usrs.Other.UsrDat.FirstName[0])
fprintf (Gbl.F.Out,", %s",
Gbl.Usrs.Other.UsrDat.FirstName);
fprintf (Gbl.F.Out,"<br />");
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&Gbl.Usrs.Other.UsrDat,PhotoURL);
Pho_ShowUsrPhoto (&Gbl.Usrs.Other.UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO45x60",Pho_ZOOM,false);
fprintf (Gbl.F.Out,"</td>"
"</tr>");
/* Test dates */
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"DAT_N RIGHT_TOP\">"
"%s:"
"</td>"
"<td id=\"match_start\" class=\"DAT LEFT_TOP\">"
"<script type=\"text/javascript\">"
"writeLocalDateHMSFromUTC('match_start',%ld,"
"%u,',&nbsp;','%s',true,true,0x7);"
"</script>"
"</td>"
"<td id=\"match_end\" class=\"DAT LEFT_TOP\">"
"<script type=\"text/javascript\">"
"writeLocalDateHMSFromUTC('match_end',%ld,"
"%u,',&nbsp;','%s',true,true,0x7);"
"</script>"
"</td>"
"</tr>",
Txt_Date,
StartTimeUTC,(unsigned) Gbl.Prefs.DateFormat,Txt_Today,
EndTimeUTC ,(unsigned) Gbl.Prefs.DateFormat,Txt_Today);
/* Number of questions */
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"DAT_N RIGHT_TOP\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_TOP\">"
"%u (%u %s)"
"</td>"
"</tr>",
Txt_Questions,
Gbl.Test.NumQsts,NumQstsNotBlank,Txt_non_blank_QUESTIONS);
/* Score */
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"DAT_N RIGHT_TOP\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_TOP\">",
Txt_Score);
if (ICanViewScore)
fprintf (Gbl.F.Out,"%.2lf (%.2lf",
TotalScore,
Gbl.Test.NumQsts ? TotalScore * Tst_SCORE_MAX / (double) Gbl.Test.NumQsts :
0.0);
else
fprintf (Gbl.F.Out,"? (?"); // No feedback
fprintf (Gbl.F.Out," %s %u)</td>"
"</tr>",
Txt_out_of_PART_OF_A_SCORE,Tst_SCORE_MAX);
/***** Write answers and solutions *****/
// Tst_ShowTestResult (TstTimeUTC); // TODO: Change to matches results
/***** Write total mark of test *****/
// if (ICanViewScore)
// Tst_ShowTstTotalMark (TotalScore); // TODO: Change to matches results
/***** End table *****/
Tbl_EndTable ();
/***** End box *****/
Box_EndBox ();
}
else // I am not allowed to view this match result
Lay_ShowErrorAndExit ("You can not view this match result.");
}
/*****************************************************************************/
/************* Get data of a match result using its match code ***************/
/*****************************************************************************/
static void Mch_GetMatchResultDataByMchCod (long MchResCod,
time_t *StartTimeUTC,
time_t *EndTimeUTC,
unsigned *NumQsts,
unsigned *NumQstsNotBlank,
double *Score)
{
MYSQL_RES *mysql_res;
MYSQL_ROW row;
/***** Make database query *****/
if (DB_QuerySELECT (&mysql_res,"can not get data"
" of a test result of a user",
"SELECT mch_results.UsrCod," // row[0]
"UNIX_TIMESTAMP(mch_matches.StartTime)," // row[2]
"UNIX_TIMESTAMP(mch_matches.EndTime)," // row[2]
"mch_results.NumQsts," // row[3]
"mch_results.NumQstsNotBlank," // row[4]
"mch_results.Score" // row[5]
" FROM mch_results,mch_matches"
" WHERE mch_results.MchResCod=%ld"
" AND mch_results.MchCod=mch_matches.MchCod"
" AND mch_matches.CrsCod=%ld", // Extra check
MchResCod,
Gbl.Hierarchy.Crs.CrsCod) == 1)
{
row = mysql_fetch_row (mysql_res);
/* Get user code (row[0]) */
Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
/* Get if teachers are allowed to see this test result (row[1]) */
Gbl.Test.AllowTeachers = (row[1][0] == 'Y');
/* Get start time (row[1] and row[2] hold UTC date-times) */
*StartTimeUTC = Dat_GetUNIXTimeFromStr (row[1]);
*EndTimeUTC = Dat_GetUNIXTimeFromStr (row[2]);
/* Get number of questions (row[3]) */
if (sscanf (row[3],"%u",NumQsts) != 1)
*NumQsts = 0;
/* Get number of questions not blank (row[4]) */
if (sscanf (row[4],"%u",NumQstsNotBlank) != 1)
*NumQstsNotBlank = 0;
/* Get score (row[5]) */
Str_SetDecimalPointToUS (); // To get the decimal point as a dot
if (sscanf (row[5],"%lf",Score) != 1)
*Score = 0.0;
Str_SetDecimalPointToLocal (); // Return to local system
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}

View File

@ -68,6 +68,10 @@ void Mch_GetAndDrawBarNumUsrsWhoHaveChosenAns (long MchCod,unsigned QstInd,unsig
unsigned Mch_GetNumUsrsWhoHaveAnswerQst (long MchCod,unsigned QstInd);
void Mch_PutFormToViewMchResults (Act_Action_t Action);
void Mch_SelDatesToSeeMyMchResults (void);
void Mch_ShowMyMchResults (void);
void Mch_SelUsrsToViewUsrsMchResults (void);
void Mch_ShowUsrsMchResults (void);
void Mch_ShowOneMchResult (void);
#endif

View File

@ -181,7 +181,6 @@ static void Tst_PutIconDisable (long TagCod,const char *TagTxt);
static void Tst_ShowFormConfigTst (void);
static void Tst_PutInputFieldNumQst (const char *Field,const char *Label,
unsigned Value);
static void Tst_GetConfigTstFromDB (void);
static Tst_Pluggable_t Tst_GetPluggableFromForm (void);
static Tst_Feedback_t Tst_GetFeedbackTypeFromForm (void);
static void Tst_CheckAndCorrectNumbersQst (void);
@ -290,7 +289,7 @@ static long Tst_CreateTestResultInDB (void);
static void Tst_StoreScoreOfTestResultInDB (long TstCod,
unsigned NumQstsNotBlank,double Score);
static void Tst_ShowHeaderTestResults (void);
static void Tst_ShowTestResults (struct UsrData *UsrDat);
static void Tst_ShowTstResults (struct UsrData *UsrDat);
static void Tst_ShowDataUsr (struct UsrData *UsrDat,unsigned NumExams);
static void Tst_PutParamTstCod (long TstCod);
static long Tst_GetParamTstCod (void);
@ -2037,7 +2036,7 @@ static void Tst_PutInputFieldNumQst (const char *Field,const char *Label,
/*************** Get configuration of test for current course ****************/
/*****************************************************************************/
static void Tst_GetConfigTstFromDB (void)
void Tst_GetConfigTstFromDB (void)
{
MYSQL_RES *mysql_res;
MYSQL_ROW row;
@ -7418,7 +7417,7 @@ void Tst_SelUsrsToViewUsrsTstResults (void)
/******************* Select dates to show my test results ********************/
/*****************************************************************************/
void Tst_SelDatesToSeeMyTestResults (void)
void Tst_SelDatesToSeeMyTstResults (void)
{
extern const char *Hlp_ASSESSMENT_Tests_results;
extern const char *Txt_Results;
@ -7439,6 +7438,33 @@ void Tst_SelDatesToSeeMyTestResults (void)
Frm_EndForm ();
}
/*****************************************************************************/
/***************************** Show my test results **************************/
/*****************************************************************************/
void Tst_ShowMyTstResults (void)
{
extern const char *Hlp_ASSESSMENT_Tests_results;
extern const char *Txt_Results;
/***** Get starting and ending dates *****/
Dat_GetIniEndDatesFromForm ();
/***** Start box and table *****/
Box_StartBoxTable (NULL,Txt_Results,NULL,
Hlp_ASSESSMENT_Tests_results,Box_NOT_CLOSABLE,2);
/***** Header of the table with the list of users *****/
Tst_ShowHeaderTestResults ();
/***** List my test results *****/
Tst_GetConfigTstFromDB (); // To get feedback type
Tst_ShowTstResults (&Gbl.Usrs.Me.UsrDat);
/***** End table and box *****/
Box_EndBoxTable ();
}
/*****************************************************************************/
/********************* Store test result in database *************************/
/*****************************************************************************/
@ -7481,7 +7507,7 @@ static void Tst_StoreScoreOfTestResultInDB (long TstCod,
/******************** Show test results for several users ********************/
/*****************************************************************************/
void Tst_ShowUsrsTestResults (void)
void Tst_ShowUsrsTstResults (void)
{
extern const char *Hlp_ASSESSMENT_Tests_results;
extern const char *Txt_Results;
@ -7514,7 +7540,7 @@ void Tst_ShowUsrsTestResults (void)
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // Get of the database the data of the user
if (Usr_CheckIfICanViewTst (&Gbl.Usrs.Other.UsrDat))
/***** Show test results *****/
Tst_ShowTestResults (&Gbl.Usrs.Other.UsrDat);
Tst_ShowTstResults (&Gbl.Usrs.Other.UsrDat);
}
/***** End table and box *****/
@ -7580,38 +7606,11 @@ static void Tst_ShowHeaderTestResults (void)
Txt_Score,Txt_out_of_PART_OF_A_SCORE,Tst_SCORE_MAX);
}
/*****************************************************************************/
/***************************** Show my test results **************************/
/*****************************************************************************/
void Tst_ShowMyTestResults (void)
{
extern const char *Hlp_ASSESSMENT_Tests_results;
extern const char *Txt_Results;
/***** Get starting and ending dates *****/
Dat_GetIniEndDatesFromForm ();
/***** Start box and table *****/
Box_StartBoxTable (NULL,Txt_Results,NULL,
Hlp_ASSESSMENT_Tests_results,Box_NOT_CLOSABLE,2);
/***** Header of the table with the list of users *****/
Tst_ShowHeaderTestResults ();
/***** List my test results *****/
Tst_GetConfigTstFromDB (); // To get feedback type
Tst_ShowTestResults (&Gbl.Usrs.Me.UsrDat);
/***** End table and box *****/
Box_EndBoxTable ();
}
/*****************************************************************************/
/*********** Show the test results of a user in the current course ***********/
/*****************************************************************************/
static void Tst_ShowTestResults (struct UsrData *UsrDat)
static void Tst_ShowTstResults (struct UsrData *UsrDat)
{
extern const char *Txt_Today;
extern const char *Txt_View_test;
@ -7999,7 +7998,7 @@ static void Tst_ShowTestResultsSummaryRow (bool ItsMe,
/******************* Show one test result of another user ********************/
/*****************************************************************************/
void Tst_ShowOneTestResult (void)
void Tst_ShowOneTstResult (void)
{
extern const char *Hlp_ASSESSMENT_Tests_results;
extern const char *Txt_Test_result;

View File

@ -168,6 +168,8 @@ void Tst_EnableTag (void);
void Tst_DisableTag (void);
void Tst_RenameTag (void);
void Tst_GetConfigTstFromDB (void);
void Tst_GetConfigFromRow (MYSQL_ROW row);
bool Tst_CheckIfCourseHaveTestsAndPluggableIsUnknown (void);
void Tst_ReceiveConfigTst (void);
@ -196,10 +198,10 @@ void Tst_FreeTagsList (void);
void Tst_GetTestStats (Tst_AnswerType_t AnsType,struct Tst_Stats *Stats);
void Tst_SelUsrsToViewUsrsTstResults (void);
void Tst_SelDatesToSeeMyTestResults (void);
void Tst_ShowUsrsTestResults (void);
void Tst_ShowMyTestResults (void);
void Tst_ShowOneTestResult (void);
void Tst_SelDatesToSeeMyTstResults (void);
void Tst_ShowMyTstResults (void);
void Tst_ShowUsrsTstResults (void);
void Tst_ShowOneTstResult (void);
void Tst_RemoveTestResultsMadeByUsrInAllCrss (long UsrCod);
void Tst_RemoveTestResultsMadeByUsrInCrs (long UsrCod,long CrsCod);
void Tst_RemoveCrsTestResults (long CrsCod);

View File

@ -18036,6 +18036,27 @@ const char *Txt_MATCH_respond =
"respondem";
#endif
const char *Txt_Match_result =
#if L==1 // ca
"Resultat de la partida";
#elif L==2 // de
"Spielergebnis";
#elif L==3 // en
"Match result";
#elif L==4 // es
"Resultado de la partida";
#elif L==5 // fr
"R&eacute;sultat du match";
#elif L==6 // gn
"Resultado de la partida"; // Okoteve traducción
#elif L==7 // it
"Risultato della partita";
#elif L==8 // pl
"Wynik mecz";
#elif L==9 // pt
"Resultado do jogo";
#endif
const char *Txt_Matches = // of a game
#if L==1 // ca
"Partides";