mirror of https://github.com/acanas/swad-core.git
Version 22.37: Oct 01, 2022 Code refactoring and changes in layout of games.
This commit is contained in:
parent
9ec703e908
commit
d7fa488e47
|
@ -4463,7 +4463,6 @@ int swad__answerMatchQuestion (struct soap *soap,
|
|||
struct swad__answerMatchQuestionOutput *answerMatchQuestionOut) // output
|
||||
{
|
||||
int ReturnCode;
|
||||
// unsigned NumOpt;
|
||||
struct Gam_Game Game;
|
||||
struct Mch_Match Match;
|
||||
unsigned QstInd; // 0 means that the game has not started. First question has index 1.
|
||||
|
|
|
@ -606,10 +606,11 @@ TODO: Fix bug: error al enviar un mensaje a dos recipientes, error on duplicate
|
|||
|
||||
TODO: Attach pdf files in multimedia.
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 22.36.1 (2022-09-30)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 22.37 (2022-10-01)"
|
||||
#define CSS_FILE "swad22.35.css"
|
||||
#define JS_FILE "swad21.100.js"
|
||||
/*
|
||||
Version 22.37: Oct 01, 2022 Code refactoring and changes in layout of games. (? lines)
|
||||
Version 22.36.1: Sep 30, 2022 Changes in layout of exams. (332596 lines)
|
||||
Version 22.36: Sep 30, 2022 Code refactoring in exams. (332589 lines)
|
||||
Version 22.35: Sep 30, 2022 Changes in layout of projects. (332690 lines)
|
||||
|
|
25
swad_exam.c
25
swad_exam.c
|
@ -628,28 +628,9 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams,bool ShowOnlyThisExam)
|
|||
static void Exa_PutIconsOneExam (void *Exams)
|
||||
{
|
||||
char *Anchor;
|
||||
/*
|
||||
static const Act_Action_t NextAction[Rol_NUM_ROLES] =
|
||||
{
|
||||
[Rol_STD ] = ActSeeMyExaResExa,
|
||||
[Rol_NET ] = ActSeeUsrExaResExa,
|
||||
[Rol_TCH ] = ActSeeUsrExaResExa,
|
||||
[Rol_SYS_ADM] = ActSeeUsrExaResExa,
|
||||
};
|
||||
*/
|
||||
|
||||
if (Exams)
|
||||
{
|
||||
/***** Put icon to view results of sessions in exam *****/
|
||||
// if (NextAction[Gbl.Usrs.Me.Role.Logged])
|
||||
// Ico_PutContextualIconToShowResults (NextAction[Gbl.Usrs.Me.Role.Logged],ExaRes_RESULTS_BOX_ID,
|
||||
// Exa_PutParams,Exams);
|
||||
|
||||
/***** Link to get resource link *****/
|
||||
// if (PrgRsc_CheckIfICanGetLink ())
|
||||
// Ico_PutContextualIconToGetLink (ActReqLnkExa,NULL,
|
||||
// Exa_PutParams,Exams);
|
||||
|
||||
/***** Build anchor string *****/
|
||||
Frm_SetAnchorStr (((struct Exa_Exams *) Exams)->Exam.ExaCod,&Anchor);
|
||||
|
||||
|
@ -691,7 +672,7 @@ static void Exa_PutIconsToRemEditOneExam (struct Exa_Exams *Exams,
|
|||
[false] = ActHidExa, // Visible ==> action to hide
|
||||
[true ] = ActUnhExa, // Hidden ==> action to unhide
|
||||
};
|
||||
static const Act_Action_t NextAction[Rol_NUM_ROLES] =
|
||||
static const Act_Action_t ActionShowResults[Rol_NUM_ROLES] =
|
||||
{
|
||||
[Rol_STD ] = ActSeeMyExaResExa,
|
||||
[Rol_NET ] = ActSeeUsrExaResExa,
|
||||
|
@ -713,8 +694,8 @@ static void Exa_PutIconsToRemEditOneExam (struct Exa_Exams *Exams,
|
|||
Exa_PutParams,Exams);
|
||||
|
||||
/***** Put icon to view results of sessions in exam *****/
|
||||
if (NextAction[Gbl.Usrs.Me.Role.Logged])
|
||||
Ico_PutContextualIconToShowResults (NextAction[Gbl.Usrs.Me.Role.Logged],ExaRes_RESULTS_BOX_ID,
|
||||
if (ActionShowResults[Gbl.Usrs.Me.Role.Logged])
|
||||
Ico_PutContextualIconToShowResults (ActionShowResults[Gbl.Usrs.Me.Role.Logged],ExaRes_RESULTS_BOX_ID,
|
||||
Exa_PutParams,Exams);
|
||||
|
||||
/***** Link to get resource link *****/
|
||||
|
|
|
@ -93,7 +93,6 @@ struct Exa_Exams
|
|||
char *ListQuestions;
|
||||
char *ExaCodsSelected; // String with selected exam codes separated by separator multiple
|
||||
struct Exa_Exam Exam; // Selected/current exam
|
||||
// long ExaCod; // Selected/current exam code
|
||||
long SetCod; // Selected/current set code
|
||||
long SesCod; // Selected/current session code
|
||||
unsigned SetInd; // Current set index
|
||||
|
|
448
swad_game.c
448
swad_game.c
File diff suppressed because it is too large
Load Diff
44
swad_game.h
44
swad_game.h
|
@ -62,26 +62,6 @@ struct Gam_GameSelected
|
|||
bool Selected; // Is this game selected when seeing match results?
|
||||
};
|
||||
|
||||
struct Gam_Games
|
||||
{
|
||||
bool LstIsRead; // Is the list already read from database...
|
||||
// ...or it needs to be read?
|
||||
unsigned Num; // Total number of games
|
||||
unsigned NumSelected; // Number of games selected
|
||||
struct Gam_GameSelected *Lst;// List of games
|
||||
Gam_Order_t SelectedOrder;
|
||||
unsigned CurrentPage;
|
||||
char *ListQuestions;
|
||||
char *GamCodsSelected; // String with selected game codes separated by separator multiple
|
||||
long GamCod; // Selected/current game code
|
||||
struct
|
||||
{
|
||||
long Selected; // Current match code
|
||||
long Current;
|
||||
} MchCod;
|
||||
unsigned QstInd; // Current question index
|
||||
};
|
||||
|
||||
struct Gam_Game
|
||||
{
|
||||
long GamCod; // Game code
|
||||
|
@ -99,6 +79,26 @@ struct Gam_Game
|
|||
unsigned NumUnfinishedMchs; // Number of unfinished matches in the game
|
||||
};
|
||||
|
||||
struct Gam_Games
|
||||
{
|
||||
bool LstIsRead; // Is the list already read from database...
|
||||
// ...or it needs to be read?
|
||||
unsigned Num; // Total number of games
|
||||
unsigned NumSelected; // Number of games selected
|
||||
struct Gam_GameSelected *Lst;// List of games
|
||||
Gam_Order_t SelectedOrder;
|
||||
unsigned CurrentPage;
|
||||
char *ListQuestions;
|
||||
char *GamCodsSelected; // String with selected game codes separated by separator multiple
|
||||
struct Gam_Game Game; // Selected/current game
|
||||
struct
|
||||
{
|
||||
long Selected; // Current match code
|
||||
long Current;
|
||||
} MchCod;
|
||||
unsigned QstInd; // Current question index
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -110,11 +110,9 @@ void Gam_SeeAllGames (void);
|
|||
void Gam_ListAllGames (struct Gam_Games *Games);
|
||||
void Gam_SeeOneGame (void);
|
||||
void Gam_ShowOnlyOneGame (struct Gam_Games *Games,
|
||||
struct Gam_Game *Game,
|
||||
bool ListGameQuestions,
|
||||
bool PutFormNewMatch);
|
||||
void Gam_ShowOnlyOneGameBegin (struct Gam_Games *Games,
|
||||
struct Gam_Game *Game,
|
||||
bool ListGameQuestions,
|
||||
bool PutFormNewMatch);
|
||||
void Gam_ShowOnlyOneGameEnd (void);
|
||||
|
@ -158,7 +156,7 @@ void Gam_RemoveQstFromGame (void);
|
|||
void Gam_MoveUpQst (void);
|
||||
void Gam_MoveDownQst (void);
|
||||
|
||||
void Gam_PutButtonNewMatch (struct Gam_Games *Games,long GamCod);
|
||||
void Gam_PutButtonNewMatch (struct Gam_Games *Games);
|
||||
void Gam_RequestNewMatch (void);
|
||||
|
||||
void Gam_ShowTstTagsPresentInAGame (long GamCod);
|
||||
|
|
65
swad_match.c
65
swad_match.c
|
@ -96,7 +96,6 @@ static void Mch_PutIconsInListOfMatches (void *Games);
|
|||
static void Mch_PutIconToCreateNewMatch (struct Gam_Games *Games);
|
||||
|
||||
static void Mch_ListOneOrMoreMatches (struct Gam_Games *Games,
|
||||
const struct Gam_Game *Game,
|
||||
unsigned NumMatches,
|
||||
MYSQL_RES *mysql_res);
|
||||
static void Mch_ListOneOrMoreMatchesHeading (bool ICanEditMatches);
|
||||
|
@ -258,7 +257,6 @@ void Mch_ResetMatch (struct Mch_Match *Match)
|
|||
/*****************************************************************************/
|
||||
|
||||
void Mch_ListMatches (struct Gam_Games *Games,
|
||||
struct Gam_Game *Game,
|
||||
bool PutFormNewMatch)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Games_matches;
|
||||
|
@ -267,10 +265,9 @@ void Mch_ListMatches (struct Gam_Games *Games,
|
|||
unsigned NumMatches;
|
||||
|
||||
/***** Get data of matches from database *****/
|
||||
NumMatches = Mch_DB_GetMatchesInGame (&mysql_res,Game->GamCod);
|
||||
NumMatches = Mch_DB_GetMatchesInGame (&mysql_res,Games->Game.GamCod);
|
||||
|
||||
/***** Begin box *****/
|
||||
Games->GamCod = Game->GamCod;
|
||||
Box_BoxBegin ("100%",Txt_Matches,
|
||||
Mch_PutIconsInListOfMatches,Games,
|
||||
Hlp_ASSESSMENT_Games_matches,Box_NOT_CLOSABLE);
|
||||
|
@ -295,7 +292,7 @@ void Mch_ListMatches (struct Gam_Games *Games,
|
|||
|
||||
/***** Show the table with the matches *****/
|
||||
if (NumMatches)
|
||||
Mch_ListOneOrMoreMatches (Games,Game,NumMatches,mysql_res);
|
||||
Mch_ListOneOrMoreMatches (Games,NumMatches,mysql_res);
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
@ -307,9 +304,9 @@ void Mch_ListMatches (struct Gam_Games *Games,
|
|||
case Rol_TCH:
|
||||
case Rol_SYS_ADM:
|
||||
if (PutFormNewMatch)
|
||||
Mch_PutFormNewMatch (Game); // Form to fill in data and start playing a new match
|
||||
Mch_PutFormNewMatch (&Games->Game); // Form to fill in data and start playing a new match
|
||||
else
|
||||
Gam_PutButtonNewMatch (Games,Game->GamCod); // Button to create a new match
|
||||
Gam_PutButtonNewMatch (Games); // Button to create a new match
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -371,7 +368,6 @@ static void Mch_PutIconToCreateNewMatch (struct Gam_Games *Games)
|
|||
/*****************************************************************************/
|
||||
|
||||
static void Mch_ListOneOrMoreMatches (struct Gam_Games *Games,
|
||||
const struct Gam_Game *Game,
|
||||
unsigned NumMatches,
|
||||
MYSQL_RES *mysql_res)
|
||||
{
|
||||
|
@ -429,7 +425,7 @@ static void Mch_ListOneOrMoreMatches (struct Gam_Games *Games,
|
|||
Mch_ListOneOrMoreMatchesNumPlayers (&Match);
|
||||
|
||||
/* Match status */
|
||||
Mch_ListOneOrMoreMatchesStatus (&Match,Game->NumQsts);
|
||||
Mch_ListOneOrMoreMatchesStatus (&Match,Games->Game.NumQsts);
|
||||
|
||||
/* Match result visible? */
|
||||
Mch_ListOneOrMoreMatchesResult (Games,&Match);
|
||||
|
@ -558,7 +554,7 @@ static void Mch_ListOneOrMoreMatchesIcons (struct Gam_Games *Games,
|
|||
|
||||
if (Mch_CheckIfICanEditThisMatch (Match))
|
||||
{
|
||||
Games->GamCod = Match->GamCod;
|
||||
Games->Game.GamCod = Match->GamCod;
|
||||
Games->MchCod.Current = Match->MchCod;
|
||||
|
||||
/***** Put icon to remove the match *****/
|
||||
|
@ -783,7 +779,7 @@ static void Mch_ListOneOrMoreMatchesResultStd (struct Gam_Games *Games,
|
|||
if (Match->Status.ShowUsrResults)
|
||||
{
|
||||
/* Result is visible by me */
|
||||
Games->GamCod = Match->GamCod;
|
||||
Games->Game.GamCod = Match->GamCod;
|
||||
Games->MchCod.Current = Match->MchCod;
|
||||
Lay_PutContextualLinkOnlyIcon (ActSeeMyMchResMch,MchRes_RESULTS_BOX_ID,
|
||||
Mch_PutParamsEdit,Games,
|
||||
|
@ -800,7 +796,7 @@ static void Mch_ListOneOrMoreMatchesResultTch (struct Gam_Games *Games,
|
|||
extern const char *Txt_Visible_results;
|
||||
extern const char *Txt_Hidden_results;
|
||||
|
||||
Games->GamCod = Match->GamCod;
|
||||
Games->Game.GamCod = Match->GamCod;
|
||||
Games->MchCod.Current = Match->MchCod;
|
||||
|
||||
/***** Show match results *****/
|
||||
|
@ -839,18 +835,17 @@ static void Mch_ListOneOrMoreMatchesResultTch (struct Gam_Games *Games,
|
|||
void Mch_ToggleVisResultsMchUsr (void)
|
||||
{
|
||||
struct Gam_Games Games;
|
||||
struct Gam_Game Game;
|
||||
struct Mch_Match Match;
|
||||
|
||||
/***** Reset games context *****/
|
||||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game and match *****/
|
||||
Gam_ResetGame (&Game);
|
||||
Gam_ResetGame (&Games.Game);
|
||||
Mch_ResetMatch (&Match);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
Mch_GetAndCheckParameters (&Games,&Game,&Match);
|
||||
Mch_GetAndCheckParameters (&Games,&Match);
|
||||
|
||||
/***** Check if visibility of match results can be changed *****/
|
||||
if (!Mch_CheckIfVisibilityOfResultsCanBeChanged (&Match))
|
||||
|
@ -861,7 +856,7 @@ void Mch_ToggleVisResultsMchUsr (void)
|
|||
Mch_DB_UpdateVisResultsMchUsr (Match.MchCod,Match.Status.ShowUsrResults);
|
||||
|
||||
/***** Show current game *****/
|
||||
Gam_ShowOnlyOneGame (&Games,&Game,
|
||||
Gam_ShowOnlyOneGame (&Games,
|
||||
false, // Do not list game questions
|
||||
false); // Do not put form to start new match
|
||||
}
|
||||
|
@ -961,18 +956,17 @@ void Mch_RequestRemoveMatch (void)
|
|||
extern const char *Txt_Do_you_really_want_to_remove_the_match_X;
|
||||
extern const char *Txt_Remove_match;
|
||||
struct Gam_Games Games;
|
||||
struct Gam_Game Game;
|
||||
struct Mch_Match Match;
|
||||
|
||||
/***** Reset games context *****/
|
||||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game and match *****/
|
||||
Gam_ResetGame (&Game);
|
||||
Gam_ResetGame (&Games.Game);
|
||||
Mch_ResetMatch (&Match);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
Mch_GetAndCheckParameters (&Games,&Game,&Match);
|
||||
Mch_GetAndCheckParameters (&Games,&Match);
|
||||
|
||||
/***** Show question and button to remove question *****/
|
||||
Ale_ShowAlertAndButton (ActRemMch,NULL,NULL,
|
||||
|
@ -982,7 +976,7 @@ void Mch_RequestRemoveMatch (void)
|
|||
Match.Title);
|
||||
|
||||
/***** Show current game *****/
|
||||
Gam_ShowOnlyOneGame (&Games,&Game,
|
||||
Gam_ShowOnlyOneGame (&Games,
|
||||
false, // Do not list game questions
|
||||
false); // Do not put form to start new match
|
||||
}
|
||||
|
@ -995,18 +989,17 @@ void Mch_RemoveMatch (void)
|
|||
{
|
||||
extern const char *Txt_Match_X_removed;
|
||||
struct Gam_Games Games;
|
||||
struct Gam_Game Game;
|
||||
struct Mch_Match Match;
|
||||
|
||||
/***** Reset games context *****/
|
||||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game and match *****/
|
||||
Gam_ResetGame (&Game);
|
||||
Gam_ResetGame (&Games.Game);
|
||||
Mch_ResetMatch (&Match);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
Mch_GetAndCheckParameters (&Games,&Game,&Match);
|
||||
Mch_GetAndCheckParameters (&Games,&Match);
|
||||
|
||||
/***** Check if I can remove this match *****/
|
||||
if (!Mch_CheckIfICanEditThisMatch (&Match))
|
||||
|
@ -1020,7 +1013,7 @@ void Mch_RemoveMatch (void)
|
|||
Match.Title);
|
||||
|
||||
/***** Show current game *****/
|
||||
Gam_ShowOnlyOneGame (&Games,&Game,
|
||||
Gam_ShowOnlyOneGame (&Games,
|
||||
false, // Do not list game questions
|
||||
false); // Do not put form to start new match
|
||||
}
|
||||
|
@ -1094,25 +1087,24 @@ void Mch_RemoveMatchesMadeByUsrInCrs (long UsrCod,long CrsCod)
|
|||
void Mch_EditMatch (void)
|
||||
{
|
||||
struct Gam_Games Games;
|
||||
struct Gam_Game Game;
|
||||
struct Mch_Match Match;
|
||||
|
||||
/***** Reset games context *****/
|
||||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game and match *****/
|
||||
Gam_ResetGame (&Game);
|
||||
Gam_ResetGame (&Games.Game);
|
||||
Mch_ResetMatch (&Match);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
Mch_GetAndCheckParameters (&Games,&Game,&Match);
|
||||
Mch_GetAndCheckParameters (&Games,&Match);
|
||||
|
||||
/***** Check if I can edit this match *****/
|
||||
if (!Mch_CheckIfICanEditThisMatch (&Match))
|
||||
Err_NoPermissionExit ();
|
||||
|
||||
/***** Show current game *****/
|
||||
Gam_ShowOnlyOneGame (&Games,&Game,
|
||||
Gam_ShowOnlyOneGame (&Games,
|
||||
false, // Do not list game questions
|
||||
false); // Do not put form to start new match
|
||||
}
|
||||
|
@ -1157,15 +1149,14 @@ static void Mch_PutParamMchCod (long MchCod)
|
|||
/*****************************************************************************/
|
||||
|
||||
void Mch_GetAndCheckParameters (struct Gam_Games *Games,
|
||||
struct Gam_Game *Game,
|
||||
struct Mch_Match *Match)
|
||||
{
|
||||
/***** Get parameters *****/
|
||||
/* Get parameters of game */
|
||||
if ((Game->GamCod = Gam_GetParams (Games)) <= 0)
|
||||
if ((Games->Game.GamCod = Gam_GetParams (Games)) <= 0)
|
||||
Err_WrongGameExit ();
|
||||
Grp_GetParamWhichGroups ();
|
||||
Gam_GetDataOfGameByCod (Game);
|
||||
Gam_GetDataOfGameByCod (&Games->Game);
|
||||
|
||||
/* Get match code */
|
||||
if ((Match->MchCod = Mch_GetParamMchCod ()) <= 0)
|
||||
|
@ -1173,13 +1164,12 @@ void Mch_GetAndCheckParameters (struct Gam_Games *Games,
|
|||
Mch_GetDataOfMatchByCod (Match);
|
||||
|
||||
/***** Ensure parameters are correct *****/
|
||||
if (Game->GamCod != Match->GamCod)
|
||||
if (Games->Game.GamCod != Match->GamCod)
|
||||
Err_WrongGameExit ();
|
||||
if (Game->CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||
if (Games->Game.CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||
Err_WrongGameExit ();
|
||||
|
||||
/***** Initialize context *****/
|
||||
Games->GamCod = Game->GamCod;
|
||||
Games->MchCod.Current =
|
||||
Games->MchCod.Selected = Match->MchCod;
|
||||
}
|
||||
|
@ -1409,18 +1399,17 @@ void Mch_CreateNewMatch (void)
|
|||
void Mch_ChangeMatch (void)
|
||||
{
|
||||
struct Gam_Games Games;
|
||||
struct Gam_Game Game;
|
||||
struct Mch_Match Match;
|
||||
|
||||
/***** Reset games context *****/
|
||||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game and match *****/
|
||||
Gam_ResetGame (&Game);
|
||||
Gam_ResetGame (&Games.Game);
|
||||
Mch_ResetMatch (&Match);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
Mch_GetAndCheckParameters (&Games,&Game,&Match);
|
||||
Mch_GetAndCheckParameters (&Games,&Match);
|
||||
|
||||
/***** Check if I can update this match *****/
|
||||
if (!Mch_CheckIfICanEditThisMatch (&Match))
|
||||
|
@ -1440,7 +1429,7 @@ void Mch_ChangeMatch (void)
|
|||
Grp_FreeListCodSelectedGrps ();
|
||||
|
||||
/***** Show current game *****/
|
||||
Gam_ShowOnlyOneGame (&Games,&Game,
|
||||
Gam_ShowOnlyOneGame (&Games,
|
||||
false, // Do not list game questions
|
||||
false); // Do not put form to start new match
|
||||
}
|
||||
|
|
|
@ -95,7 +95,6 @@ long Mch_GetMchCodBeingPlayed (void);
|
|||
void Mch_ResetMatch (struct Mch_Match *Match);
|
||||
|
||||
void Mch_ListMatches (struct Gam_Games *Games,
|
||||
struct Gam_Game *Game,
|
||||
bool PutFormNewMatch);
|
||||
void Mch_GetDataOfMatchByCod (struct Mch_Match *Match);
|
||||
void Mch_ListOneOrMoreMatchesAuthor (const struct Mch_Match *Match);
|
||||
|
@ -116,7 +115,6 @@ void Mch_EditMatch (void);
|
|||
|
||||
void Mch_PutParamsEdit (void *Games);
|
||||
void Mch_GetAndCheckParameters (struct Gam_Games *Games,
|
||||
struct Gam_Game *Game,
|
||||
struct Mch_Match *Match);
|
||||
long Mch_GetParamMchCod (void);
|
||||
|
||||
|
|
|
@ -70,11 +70,11 @@ struct MchRes_ICanView
|
|||
static void MchRes_PutFormToSelUsrsToViewMchResults (void *Games);
|
||||
|
||||
static void MchRes_ListMyMchResultsInCrs (struct Gam_Games *Games);
|
||||
static void MchRes_ListMyMchResultsInGam (struct Gam_Games *Games,long GamCod);
|
||||
static void MchRes_ListMyMchResultsInGam (struct Gam_Games *Games);
|
||||
static void MchRes_ListMyMchResultsInMch (struct Gam_Games *Games,long MchCod);
|
||||
static void MchRes_ShowAllMchResultsInSelectedGames (void *Games);
|
||||
static void MchRes_ListAllMchResultsInSelectedGames (struct Gam_Games *Games);
|
||||
static void MchRes_ListAllMchResultsInGam (struct Gam_Games *Games,long GamCod);
|
||||
static void MchRes_ListAllMchResultsInGam (struct Gam_Games *Games);
|
||||
static void MchRes_ListAllMchResultsInMch (struct Gam_Games *Games,long MchCod);
|
||||
|
||||
static void MchRes_ShowResultsBegin (struct Gam_Games *Games,
|
||||
|
@ -149,45 +149,44 @@ void MchRes_ShowMyMchResultsInGam (void)
|
|||
{
|
||||
extern const char *Txt_Results_of_game_X;
|
||||
struct Gam_Games Games;
|
||||
struct Gam_Game Game;
|
||||
char *Title;
|
||||
|
||||
/***** Reset games context *****/
|
||||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game *****/
|
||||
Gam_ResetGame (&Game);
|
||||
Gam_ResetGame (&Games.Game);
|
||||
|
||||
/***** Get parameters *****/
|
||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||
if ((Games.Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||
Err_WrongGameExit ();
|
||||
Gam_GetDataOfGameByCod (&Game);
|
||||
Gam_GetDataOfGameByCod (&Games.Game);
|
||||
|
||||
/***** Game begin *****/
|
||||
Gam_ShowOnlyOneGameBegin (&Games,&Game,
|
||||
Gam_ShowOnlyOneGameBegin (&Games,
|
||||
false, // Do not list game questions
|
||||
false); // Do not put form to start new match
|
||||
|
||||
/***** List my matches results in game *****/
|
||||
if (asprintf (&Title,Txt_Results_of_game_X,Game.Title) < 0)
|
||||
if (asprintf (&Title,Txt_Results_of_game_X,Games.Game.Title) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
MchRes_ShowResultsBegin (&Games,Title,false); // Do not list games to select
|
||||
free (Title);
|
||||
MchRes_ListMyMchResultsInGam (&Games,Game.GamCod);
|
||||
MchRes_ListMyMchResultsInGam (&Games);
|
||||
MchRes_ShowResultsEnd ();
|
||||
|
||||
/***** Game end *****/
|
||||
Gam_ShowOnlyOneGameEnd ();
|
||||
}
|
||||
|
||||
static void MchRes_ListMyMchResultsInGam (struct Gam_Games *Games,long GamCod)
|
||||
static void MchRes_ListMyMchResultsInGam (struct Gam_Games *Games)
|
||||
{
|
||||
/***** Table header *****/
|
||||
MchRes_ShowHeaderMchResults (Usr_ME);
|
||||
|
||||
/***** List my matches results in game *****/
|
||||
TstCfg_GetConfig (); // Get feedback type
|
||||
MchRes_ShowMchResults (Games,Usr_ME,-1L,GamCod,NULL);
|
||||
MchRes_ShowMchResults (Games,Usr_ME,-1L,Games->Game.GamCod,NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -198,7 +197,6 @@ void MchRes_ShowMyMchResultsInMch (void)
|
|||
{
|
||||
extern const char *Txt_Results_of_match_X;
|
||||
struct Gam_Games Games;
|
||||
struct Gam_Game Game;
|
||||
struct Mch_Match Match;
|
||||
char *Title;
|
||||
|
||||
|
@ -206,19 +204,19 @@ void MchRes_ShowMyMchResultsInMch (void)
|
|||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game and match *****/
|
||||
Gam_ResetGame (&Game);
|
||||
Gam_ResetGame (&Games.Game);
|
||||
Mch_ResetMatch (&Match);
|
||||
|
||||
/***** Get parameters *****/
|
||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||
if ((Games.Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||
Err_WrongGameExit ();
|
||||
if ((Match.MchCod = Mch_GetParamMchCod ()) <= 0)
|
||||
Err_WrongMatchExit ();
|
||||
Gam_GetDataOfGameByCod (&Game);
|
||||
Gam_GetDataOfGameByCod (&Games.Game);
|
||||
Mch_GetDataOfMatchByCod (&Match);
|
||||
|
||||
/***** Game begin *****/
|
||||
Gam_ShowOnlyOneGameBegin (&Games,&Game,
|
||||
Gam_ShowOnlyOneGameBegin (&Games,
|
||||
false, // Do not list game questions
|
||||
false); // Do not put form to start new match
|
||||
|
||||
|
@ -356,38 +354,37 @@ void MchRes_ShowAllMchResultsInGam (void)
|
|||
{
|
||||
extern const char *Txt_Results_of_game_X;
|
||||
struct Gam_Games Games;
|
||||
struct Gam_Game Game;
|
||||
char *Title;
|
||||
|
||||
/***** Reset games context *****/
|
||||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game *****/
|
||||
Gam_ResetGame (&Game);
|
||||
Gam_ResetGame (&Games.Game);
|
||||
|
||||
/***** Get parameters *****/
|
||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||
if ((Games.Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||
Err_WrongGameExit ();
|
||||
Gam_GetDataOfGameByCod (&Game);
|
||||
Gam_GetDataOfGameByCod (&Games.Game);
|
||||
|
||||
/***** Game begin *****/
|
||||
Gam_ShowOnlyOneGameBegin (&Games,&Game,
|
||||
Gam_ShowOnlyOneGameBegin (&Games,
|
||||
false, // Do not list game questions
|
||||
false); // Do not put form to start new match
|
||||
|
||||
/***** List matches results in game *****/
|
||||
if (asprintf (&Title,Txt_Results_of_game_X,Game.Title) < 0)
|
||||
if (asprintf (&Title,Txt_Results_of_game_X,Games.Game.Title) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
MchRes_ShowResultsBegin (&Games,Title,false); // Do not list games to select
|
||||
free (Title);
|
||||
MchRes_ListAllMchResultsInGam (&Games,Game.GamCod);
|
||||
MchRes_ListAllMchResultsInGam (&Games);
|
||||
MchRes_ShowResultsEnd ();
|
||||
|
||||
/***** Game end *****/
|
||||
Gam_ShowOnlyOneGameEnd ();
|
||||
}
|
||||
|
||||
static void MchRes_ListAllMchResultsInGam (struct Gam_Games *Games,long GamCod)
|
||||
static void MchRes_ListAllMchResultsInGam (struct Gam_Games *Games)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
unsigned NumUsrs;
|
||||
|
@ -397,7 +394,7 @@ static void MchRes_ListAllMchResultsInGam (struct Gam_Games *Games,long GamCod)
|
|||
MchRes_ShowHeaderMchResults (Usr_OTHER);
|
||||
|
||||
/***** Get all users who have answered any match question in this game *****/
|
||||
NumUsrs = Mch_DB_GetUsrsWhoHavePlayedGam (&mysql_res,GamCod);
|
||||
NumUsrs = Mch_DB_GetUsrsWhoHavePlayedGam (&mysql_res,Games->Game.GamCod);
|
||||
|
||||
/***** List matches results for each user *****/
|
||||
for (NumUsr = 0;
|
||||
|
@ -412,7 +409,7 @@ static void MchRes_ListAllMchResultsInGam (struct Gam_Games *Games,long GamCod)
|
|||
{
|
||||
/***** Show matches results *****/
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Enr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
||||
MchRes_ShowMchResults (Games,Usr_OTHER,-1L,GamCod,NULL);
|
||||
MchRes_ShowMchResults (Games,Usr_OTHER,-1L,Games->Game.GamCod,NULL);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -427,7 +424,6 @@ void MchRes_ShowAllMchResultsInMch (void)
|
|||
{
|
||||
extern const char *Txt_Results_of_match_X;
|
||||
struct Gam_Games Games;
|
||||
struct Gam_Game Game;
|
||||
struct Mch_Match Match;
|
||||
char *Title;
|
||||
|
||||
|
@ -435,19 +431,19 @@ void MchRes_ShowAllMchResultsInMch (void)
|
|||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game and match *****/
|
||||
Gam_ResetGame (&Game);
|
||||
Gam_ResetGame (&Games.Game);
|
||||
Mch_ResetMatch (&Match);
|
||||
|
||||
/***** Get parameters *****/
|
||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||
if ((Games.Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||
Err_WrongGameExit ();
|
||||
if ((Match.MchCod = Mch_GetParamMchCod ()) <= 0)
|
||||
Err_WrongMatchExit ();
|
||||
Gam_GetDataOfGameByCod (&Game);
|
||||
Gam_GetDataOfGameByCod (&Games.Game);
|
||||
Mch_GetDataOfMatchByCod (&Match);
|
||||
|
||||
/***** Game begin *****/
|
||||
Gam_ShowOnlyOneGameBegin (&Games,&Game,
|
||||
Gam_ShowOnlyOneGameBegin (&Games,
|
||||
false, // Do not list game questions
|
||||
false); // Do not put form to start new match
|
||||
|
||||
|
@ -541,10 +537,9 @@ static void MchRes_ListGamesToSelect (struct Gam_Games *Games)
|
|||
extern const char *Txt_Update_results;
|
||||
unsigned UniqueId;
|
||||
unsigned NumGame;
|
||||
struct Gam_Game Game;
|
||||
|
||||
/***** Reset game *****/
|
||||
Gam_ResetGame (&Game);
|
||||
Gam_ResetGame (&Games->Game);
|
||||
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin (NULL,Txt_Games,
|
||||
|
@ -572,8 +567,8 @@ static void MchRes_ListGamesToSelect (struct Gam_Games *Games)
|
|||
NumGame++, UniqueId++, The_ChangeRowColor ())
|
||||
{
|
||||
/* Get data of this game */
|
||||
Game.GamCod = Games->Lst[NumGame].GamCod;
|
||||
Gam_GetDataOfGameByCod (&Game);
|
||||
Games->Game.GamCod = Games->Lst[NumGame].GamCod;
|
||||
Gam_GetDataOfGameByCod (&Games->Game);
|
||||
|
||||
/* Write a row for this event */
|
||||
HTM_TR_Begin (NULL);
|
||||
|
@ -599,7 +594,7 @@ static void MchRes_ListGamesToSelect (struct Gam_Games *Games)
|
|||
HTM_TD_Begin ("class=\"LT DAT_%s %s\"",
|
||||
The_GetSuffix (),
|
||||
The_GetColorRows ());
|
||||
HTM_Txt (Game.Title);
|
||||
HTM_Txt (Games->Game.Title);
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
|
@ -727,7 +722,6 @@ static void MchRes_ShowMchResults (struct Gam_Games *Games,
|
|||
struct MchPrn_Print Print;
|
||||
unsigned NumQstsBlank;
|
||||
struct Mch_Match Match;
|
||||
struct Gam_Game Game;
|
||||
double Grade;
|
||||
struct MchPrn_NumQuestions NumTotalQsts;
|
||||
double TotalScore;
|
||||
|
@ -769,11 +763,11 @@ static void MchRes_ShowMchResults (struct Gam_Games *Games,
|
|||
/* Get data of match and game */
|
||||
Match.MchCod = Print.MchCod;
|
||||
Mch_GetDataOfMatchByCod (&Match);
|
||||
Game.GamCod = Match.GamCod;
|
||||
Gam_GetDataOfGameByCod (&Game);
|
||||
Games->Game.GamCod = Match.GamCod;
|
||||
Gam_GetDataOfGameByCod (&Games->Game);
|
||||
|
||||
/* Check if I can view this match result and score */
|
||||
MchRes_CheckIfICanSeeMatchResult (&Game,&Match,UsrDat->UsrCod,&ICanView);
|
||||
MchRes_CheckIfICanSeeMatchResult (&Games->Game,&Match,UsrDat->UsrCod,&ICanView);
|
||||
|
||||
if (NumResult)
|
||||
HTM_TR_Begin (NULL);
|
||||
|
@ -885,8 +879,8 @@ static void MchRes_ShowMchResults (struct Gam_Games *Games,
|
|||
The_GetColorRows ());
|
||||
if (ICanView.Score)
|
||||
{
|
||||
Grade = TstPrn_ComputeGrade (Print.NumQsts.All,Print.Score,Game.MaxGrade);
|
||||
TstPrn_ShowGrade (Grade,Game.MaxGrade);
|
||||
Grade = TstPrn_ComputeGrade (Print.NumQsts.All,Print.Score,Games->Game.MaxGrade);
|
||||
TstPrn_ShowGrade (Grade,Games->Game.MaxGrade);
|
||||
TotalGrade += Grade;
|
||||
}
|
||||
else
|
||||
|
@ -898,7 +892,7 @@ static void MchRes_ShowMchResults (struct Gam_Games *Games,
|
|||
The_GetColorRows ());
|
||||
if (ICanView.Result)
|
||||
{
|
||||
Games->GamCod = Match.GamCod;
|
||||
Games->Game.GamCod = Match.GamCod;
|
||||
Games->MchCod.Current = Match.MchCod;
|
||||
switch (MeOrOther)
|
||||
{
|
||||
|
@ -1073,7 +1067,6 @@ void MchRes_ShowOneMchResult (void)
|
|||
[PhoSha_SHAPE_RECTANGLE] = "PHOTOR45x60",
|
||||
};
|
||||
struct Gam_Games Games;
|
||||
struct Gam_Game Game;
|
||||
struct Mch_Match Match;
|
||||
Usr_MeOrOther_t MeOrOther;
|
||||
struct Usr_Data *UsrDat;
|
||||
|
@ -1086,11 +1079,11 @@ void MchRes_ShowOneMchResult (void)
|
|||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game and match *****/
|
||||
Gam_ResetGame (&Game);
|
||||
Gam_ResetGame (&Games.Game);
|
||||
Mch_ResetMatch (&Match);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
Mch_GetAndCheckParameters (&Games,&Game,&Match);
|
||||
Mch_GetAndCheckParameters (&Games,&Match);
|
||||
|
||||
/***** Pointer to user's data *****/
|
||||
MeOrOther = (Gbl.Action.Act == ActSeeOneMchResMe) ? Usr_ME :
|
||||
|
@ -1113,7 +1106,7 @@ void MchRes_ShowOneMchResult (void)
|
|||
MchPrn_GetMatchPrintDataByMchCodAndUsrCod (&Print);
|
||||
|
||||
/***** Check if I can view this match result and score *****/
|
||||
MchRes_CheckIfICanSeeMatchResult (&Game,&Match,UsrDat->UsrCod,&ICanView);
|
||||
MchRes_CheckIfICanSeeMatchResult (&Games.Game,&Match,UsrDat->UsrCod,&ICanView);
|
||||
|
||||
if (ICanView.Result) // I am allowed to view this match result
|
||||
{
|
||||
|
@ -1260,7 +1253,7 @@ void MchRes_ShowOneMchResult (void)
|
|||
if (ICanView.Score)
|
||||
{
|
||||
HTM_STRONG_Begin ();
|
||||
TstPrn_ComputeAndShowGrade (Print.NumQsts.All,Print.Score,Game.MaxGrade);
|
||||
TstPrn_ComputeAndShowGrade (Print.NumQsts.All,Print.Score,Games.Game.MaxGrade);
|
||||
HTM_STRONG_End ();
|
||||
}
|
||||
else
|
||||
|
@ -1289,7 +1282,7 @@ void MchRes_ShowOneMchResult (void)
|
|||
Print.NumQsts.All,
|
||||
Print.PrintedQuestions,
|
||||
Print.TimeUTC,
|
||||
Game.Visibility);
|
||||
Games.Game.Visibility);
|
||||
|
||||
/***** End table *****/
|
||||
HTM_TABLE_End ();
|
||||
|
|
|
@ -13243,48 +13243,48 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
|
|||
,
|
||||
[ActSeeMyMchResGam] =
|
||||
#if L==1 // ca
|
||||
"See all my matches results in a given game" // Necessita traducció
|
||||
"See all my matches results in game" // Necessita traducció
|
||||
#elif L==2 // de
|
||||
"See all my matches results in a given game" // Need Übersetzung
|
||||
"See all my matches results in game" // Need Übersetzung
|
||||
#elif L==3 // en
|
||||
"See all my matches results in a given game"
|
||||
"See all my matches results in game"
|
||||
#elif L==4 // es
|
||||
"Ver todos mis resultados en partidas de un juego"
|
||||
"Ver todos mis resultados en partidas de juego"
|
||||
#elif L==5 // fr
|
||||
"See all my matches results in a given game" // Besoin de traduction
|
||||
"See all my matches results in game" // Besoin de traduction
|
||||
#elif L==6 // gn
|
||||
"Ver todos mis resultados en partidas de un juego" // Okoteve traducción
|
||||
"Ver todos mis resultados en partidas de juego" // Okoteve traducción
|
||||
#elif L==7 // it
|
||||
"See all my matches results in a given game" // Bisogno di traduzione
|
||||
"See all my matches results in game" // Bisogno di traduzione
|
||||
#elif L==8 // pl
|
||||
"See all my matches results in a given game" // Potrzebujesz tlumaczenie
|
||||
"See all my matches results in game" // Potrzebujesz tlumaczenie
|
||||
#elif L==9 // pt
|
||||
"See all my matches results in a given game" // Precisa de tradução
|
||||
"See all my matches results in game" // Precisa de tradução
|
||||
#elif L==10 // tr
|
||||
"See all my matches results in a given game" // Çeviri lazim!
|
||||
"See all my matches results in game" // Çeviri lazim!
|
||||
#endif
|
||||
,
|
||||
[ActSeeMyMchResMch] =
|
||||
#if L==1 // ca
|
||||
"See my results in a given match" // Necessita traducció
|
||||
"See my results in match" // Necessita traducció
|
||||
#elif L==2 // de
|
||||
"See my results in a given match" // Need Übersetzung
|
||||
"See my results in match" // Need Übersetzung
|
||||
#elif L==3 // en
|
||||
"See my results in a given match"
|
||||
"See my results in match"
|
||||
#elif L==4 // es
|
||||
"Ver mis resultados en una partida"
|
||||
"Ver mis resultados en partida"
|
||||
#elif L==5 // fr
|
||||
"See my results in a given match" // Besoin de traduction
|
||||
"See my results in match" // Besoin de traduction
|
||||
#elif L==6 // gn
|
||||
"Ver mis resultados en una partida" // Okoteve traducción
|
||||
"Ver mis resultados en partida" // Okoteve traducción
|
||||
#elif L==7 // it
|
||||
"See my results in a given match" // Bisogno di traduzione
|
||||
"See my results in match" // Bisogno di traduzione
|
||||
#elif L==8 // pl
|
||||
"See my results in a given match" // Potrzebujesz tlumaczenie
|
||||
"See my results in match" // Potrzebujesz tlumaczenie
|
||||
#elif L==9 // pt
|
||||
"See my results in a given match" // Precisa de tradução
|
||||
"See my results in match" // Precisa de tradução
|
||||
#elif L==10 // tr
|
||||
"See my results in a given match" // Çeviri lazim!
|
||||
"See my results in match" // Çeviri lazim!
|
||||
#endif
|
||||
,
|
||||
[ActSeeOneMchResMe] =
|
||||
|
@ -13358,48 +13358,48 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
|
|||
,
|
||||
[ActSeeUsrMchResGam] =
|
||||
#if L==1 // ca
|
||||
"See all matches results in a given game" // Necessita traducció
|
||||
"See all matches results in game" // Necessita traducció
|
||||
#elif L==2 // de
|
||||
"See all matches results in a given game" // Need Übersetzung
|
||||
"See all matches results in game" // Need Übersetzung
|
||||
#elif L==3 // en
|
||||
"See all matches results in a given game"
|
||||
"See all matches results in game"
|
||||
#elif L==4 // es
|
||||
"Ver resultados de todas las partidas de un juego"
|
||||
#elif L==5 // fr
|
||||
"See all matches results in a given game" // Besoin de traduction
|
||||
"See all matches results in game" // Besoin de traduction
|
||||
#elif L==6 // gn
|
||||
"Ver resultados de todas las partidas de un juego" // Okoteve traducción
|
||||
#elif L==7 // it
|
||||
"See all matches results in a given game" // Bisogno di traduzione
|
||||
"See all matches results in game" // Bisogno di traduzione
|
||||
#elif L==8 // pl
|
||||
"See all matches results in a given game" // Potrzebujesz tlumaczenie
|
||||
"See all matches results in game" // Potrzebujesz tlumaczenie
|
||||
#elif L==9 // pt
|
||||
"See all matches results in a given game" // Precisa de tradução
|
||||
"See all matches results in game" // Precisa de tradução
|
||||
#elif L==10 // tr
|
||||
"See all matches results in a given game" // Çeviri lazim!
|
||||
"See all matches results in game" // Çeviri lazim!
|
||||
#endif
|
||||
,
|
||||
[ActSeeUsrMchResMch] =
|
||||
#if L==1 // ca
|
||||
"See results de usuario in a given match" // Necessita traducció
|
||||
"See user's results in match" // Necessita traducció
|
||||
#elif L==2 // de
|
||||
"See results de usuario in a given match" // Need Übersetzung
|
||||
"See user's results in match" // Need Übersetzung
|
||||
#elif L==3 // en
|
||||
"See results de usuario in a given match"
|
||||
"See user's results in match"
|
||||
#elif L==4 // es
|
||||
"Ver los resultados de usuario en una partida"
|
||||
"Ver resultados de usuario en partida"
|
||||
#elif L==5 // fr
|
||||
"See results de usuario in a given match" // Besoin de traduction
|
||||
"See user's results in match" // Besoin de traduction
|
||||
#elif L==6 // gn
|
||||
"Ver los resultados de usuario en una partida" // Okoteve traducción
|
||||
"Ver resultados de usuario en partida" // Okoteve traducción
|
||||
#elif L==7 // it
|
||||
"See results de usuario in a given match" // Bisogno di traduzione
|
||||
"See user's results in match" // Bisogno di traduzione
|
||||
#elif L==8 // pl
|
||||
"See results de usuario in a given match" // Potrzebujesz tlumaczenie
|
||||
"See user's results in match" // Potrzebujesz tlumaczenie
|
||||
#elif L==9 // pt
|
||||
"See results de usuario in a given match" // Precisa de tradução
|
||||
"See user's results in match" // Precisa de tradução
|
||||
#elif L==10 // tr
|
||||
"See results de usuario in a given match" // Çeviri lazim!
|
||||
"See user's results in match" // Çeviri lazim!
|
||||
#endif
|
||||
,
|
||||
[ActSeeOneMchResOth] =
|
||||
|
|
Loading…
Reference in New Issue