Version19.9.3

This commit is contained in:
Antonio Cañas Vargas 2019-09-23 09:44:10 +02:00
parent 8e3a5e671b
commit dd1e1866bd
8 changed files with 59 additions and 55 deletions

View File

@ -3589,13 +3589,12 @@ static void Att_ListAttEventsForAStd (unsigned NumUsr,struct UsrData *UsrDat)
Gbl.AttEvents.Lst[NumAttEvent].CommentTchVisible); Gbl.AttEvents.Lst[NumAttEvent].CommentTchVisible);
/***** Write a row for this event *****/ /***** Write a row for this event *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>");
"<td class=\"COLOR%u\"></td>" Tbl_PutEmptyCells (1);
"<td class=\"%s RIGHT_TOP COLOR%u\">" fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_TOP COLOR%u\">"
"%u:" "%u:"
"</td>" "</td>"
"<td class=\"BT%u\">", "<td class=\"BT%u\">",
Gbl.RowEvenOdd,
Present ? "DAT_GREEN" : Present ? "DAT_GREEN" :
"DAT_RED", "DAT_RED",
Gbl.RowEvenOdd, Gbl.RowEvenOdd,
@ -3622,15 +3621,12 @@ static void Att_ListAttEventsForAStd (unsigned NumUsr,struct UsrData *UsrDat)
/***** Write comments for this student *****/ /***** Write comments for this student *****/
if (ShowCommentStd || ShowCommentTch) if (ShowCommentStd || ShowCommentTch)
{ {
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>");
"<td class=\"COLOR%u\"></td>" Tbl_PutEmptyCells (2);
"<td class=\"COLOR%u\"></td>" fprintf (Gbl.F.Out,"<td class=\"BT%u\"></td>"
"<td class=\"BT%u\"></td>"
"<td class=\"DAT LEFT_MIDDLE COLOR%u\">" "<td class=\"DAT LEFT_MIDDLE COLOR%u\">"
"<dl>", "<dl>",
Gbl.RowEvenOdd, Gbl.RowEvenOdd,
Gbl.RowEvenOdd,
Gbl.RowEvenOdd,
Gbl.RowEvenOdd); Gbl.RowEvenOdd);
if (ShowCommentStd) if (ShowCommentStd)
{ {

View File

@ -468,10 +468,11 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD: En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 19.9.2 (2019-09-23)" #define Log_PLATFORM_VERSION "SWAD 19.9.3 (2019-09-23)"
#define CSS_FILE "swad19.3.css" #define CSS_FILE "swad19.3.css"
#define JS_FILE "swad18.130.2.js" #define JS_FILE "swad18.130.2.js"
/* /*
Version 19.9.3: Sep 23, 2019 Code refactoring in tables. (245597 lines)
Version 19.9.2: Sep 23, 2019 View matches results. Not finished. (245598 lines) Version 19.9.2: Sep 23, 2019 View matches results. Not finished. (245598 lines)
2 changes necessary in database: 2 changes necessary in database:
DROP TABLE IF EXISTS mch_results; DROP TABLE IF EXISTS mch_results;

View File

@ -113,10 +113,7 @@ void Mrk_GetAndWriteNumRowsHeaderAndFooter (void)
struct MarksProperties Marks; struct MarksProperties Marks;
if (Gbl.FileBrowser.FilFolLnk.Type == Brw_IS_FOLDER) if (Gbl.FileBrowser.FilFolLnk.Type == Brw_IS_FOLDER)
fprintf (Gbl.F.Out,"<td class=\"COLOR%u\"></td>" Tbl_PutEmptyCells (2);
"<td class=\"COLOR%u\"></td>",
Gbl.RowEvenOdd,
Gbl.RowEvenOdd);
else // File or link else // File or link
{ {
/***** Get number of rows in header or footer *****/ /***** Get number of rows in header or footer *****/

View File

@ -47,6 +47,7 @@
#include "swad_setting.h" #include "swad_setting.h"
#include "swad_table.h" #include "swad_table.h"
#include "swad_test.h" #include "swad_test.h"
#include "swad_user.h"
/*****************************************************************************/ /*****************************************************************************/
/************** External global variables from others modules ****************/ /************** External global variables from others modules ****************/
@ -199,7 +200,7 @@ static unsigned Mch_GetNumUsrsWhoHaveAnswerMch (long MchCod);
static void Mch_DrawBarNumUsrs (unsigned NumAnswerersAns,unsigned NumAnswerersQst,bool Correct); static void Mch_DrawBarNumUsrs (unsigned NumAnswerersAns,unsigned NumAnswerersQst,bool Correct);
static void Mch_ShowHeaderMchResults (void); static void Mch_ShowHeaderMchResults (void);
static void Mch_ShowMchResults (struct UsrData *UsrDat); static void Mch_ShowMchResults (Usr_MeOrOther_t MeOrOther);
static void Mch_GetMatchResultDataByMchCod (long MchCod,long UsrCod, static void Mch_GetMatchResultDataByMchCod (long MchCod,long UsrCod,
time_t TimeUTC[Dat_NUM_START_END_TIME], time_t TimeUTC[Dat_NUM_START_END_TIME],
unsigned *NumQsts, unsigned *NumQsts,
@ -2662,9 +2663,8 @@ void Mch_ShowMyMchResults (void)
/***** Header of the table with the list of users *****/ /***** Header of the table with the list of users *****/
Mch_ShowHeaderMchResults (); Mch_ShowHeaderMchResults ();
/***** List my test results *****/ /***** List my matches results *****/
// Tst_GetConfigTstFromDB (); // To get feedback type // TODO: Change to matches results Mch_ShowMchResults (Usr_ME);
Mch_ShowMchResults (&Gbl.Usrs.Me.UsrDat);
/***** End table and box *****/ /***** End table and box *****/
Box_EndBoxTable (); Box_EndBoxTable ();
@ -2809,7 +2809,7 @@ void Mch_ShowUsrsMchResults (void)
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // Get of the database the data of the user if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // Get of the database the data of the user
if (Usr_CheckIfICanViewMch (&Gbl.Usrs.Other.UsrDat)) if (Usr_CheckIfICanViewMch (&Gbl.Usrs.Other.UsrDat))
/***** Show matches results *****/ /***** Show matches results *****/
Mch_ShowMchResults (&Gbl.Usrs.Other.UsrDat); Mch_ShowMchResults (Usr_OTHER);
} }
/***** End table and box *****/ /***** End table and box *****/
@ -2883,12 +2883,13 @@ static void Mch_ShowHeaderMchResults (void)
/*********** Show the test results of a user in the current course ***********/ /*********** Show the test results of a user in the current course ***********/
/*****************************************************************************/ /*****************************************************************************/
static void Mch_ShowMchResults (struct UsrData *UsrDat) static void Mch_ShowMchResults (Usr_MeOrOther_t MeOrOther)
{ {
extern const char *Txt_Today; extern const char *Txt_Today;
extern const char *Txt_View_test; extern const char *Txt_View_test;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
struct UsrData *UsrDat;
unsigned NumResults; unsigned NumResults;
unsigned NumResult; unsigned NumResult;
static unsigned UniqueId = 0; static unsigned UniqueId = 0;
@ -2903,6 +2904,10 @@ static void Mch_ShowMchResults (struct UsrData *UsrDat)
time_t TimeUTC[Dat_NUM_START_END_TIME]; time_t TimeUTC[Dat_NUM_START_END_TIME];
char *ClassDat; char *ClassDat;
/***** Set user *****/
UsrDat = (MeOrOther == Usr_ME) ? &Gbl.Usrs.Me.UsrDat :
&Gbl.Usrs.Other.UsrDat;
/***** Make database query *****/ /***** Make database query *****/
NumResults = NumResults =
(unsigned) DB_QuerySELECT (&mysql_res,"can not get matches results of a user", (unsigned) DB_QuerySELECT (&mysql_res,"can not get matches results of a user",
@ -3012,9 +3017,18 @@ static void Mch_ShowMchResults (struct UsrData *UsrDat)
/* Link to show this result */ /* Link to show this result */
fprintf (Gbl.F.Out,"<td class=\"RIGHT_TOP COLOR%u\">", fprintf (Gbl.F.Out,"<td class=\"RIGHT_TOP COLOR%u\">",
Gbl.RowEvenOdd); Gbl.RowEvenOdd);
Frm_StartForm (Gbl.Action.Act == ActSeeMyMchRes ? ActSeeOneMchResMe : switch (MeOrOther)
ActSeeOneMchResOth); {
// Tst_PutParamTstCod (TstCod); // TODO: Change to matches results case Usr_ME:
Frm_StartForm (ActSeeOneMchResMe);
Mch_PutParamMchCod (MchCod);
break;
case Usr_OTHER:
Frm_StartForm (ActSeeOneMchResOth);
Mch_PutParamMchCod (MchCod);
Usr_PutParamOtherUsrCodEncrypted ();
break;
}
Ico_PutIconLink ("tasks.svg",Txt_View_test); Ico_PutIconLink ("tasks.svg",Txt_View_test);
Frm_EndForm (); Frm_EndForm ();
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
@ -3027,21 +3041,10 @@ static void Mch_ShowMchResults (struct UsrData *UsrDat)
// TotalScoreOfAllTests); // TODO: Change to matches results // TotalScoreOfAllTests); // TODO: Change to matches results
} }
else else
fprintf (Gbl.F.Out,"<td class=\"COLOR%u\"></td>" {
"<td class=\"COLOR%u\"></td>" Tbl_PutEmptyCells (8);
"<td class=\"COLOR%u\"></td>" fprintf (Gbl.F.Out,"</tr>");
"<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 *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);

View File

@ -92,3 +92,14 @@ void Tbl_EndTable (void)
{ {
fprintf (Gbl.F.Out,"</table>"); fprintf (Gbl.F.Out,"</table>");
} }
void Tbl_PutEmptyCells (unsigned NumColumns)
{
unsigned NumCol;
for (NumCol = 0;
NumCol < NumColumns;
NumCol++)
fprintf (Gbl.F.Out,"<td class=\"COLOR%u\"></td>",
Gbl.RowEvenOdd);
}

View File

@ -45,4 +45,6 @@ void Tbl_StartTableWide (unsigned CellPadding);
void Tbl_StartTableWideMargin (unsigned CellPadding); void Tbl_StartTableWideMargin (unsigned CellPadding);
void Tbl_EndTable (void); void Tbl_EndTable (void);
void Tbl_PutEmptyCells (unsigned NumColumns);
#endif #endif

View File

@ -7830,21 +7830,10 @@ static void Tst_ShowTstResults (struct UsrData *UsrDat)
TotalScoreOfAllTests); TotalScoreOfAllTests);
} }
else else
fprintf (Gbl.F.Out,"<td class=\"COLOR%u\"></td>" {
"<td class=\"COLOR%u\"></td>" Tbl_PutEmptyCells (7);
"<td class=\"COLOR%u\"></td>" fprintf (Gbl.F.Out,"</tr>");
"<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 *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);

View File

@ -136,6 +136,12 @@ typedef enum
} Usr_ListUsrsOption_t; } Usr_ListUsrsOption_t;
#define Usr_LIST_USRS_DEFAULT_OPTION Usr_OPTION_RECORDS #define Usr_LIST_USRS_DEFAULT_OPTION Usr_OPTION_RECORDS
typedef enum
{
Usr_ME,
Usr_OTHER,
} Usr_MeOrOther_t;
// Related with user's data // Related with user's data
struct UsrData struct UsrData
{ {
@ -212,7 +218,6 @@ struct UsrData
struct UsrLast struct UsrLast
{ {
Sch_WhatToSearch_t WhatToSearch; // Search courses, teachers, documents...? Sch_WhatToSearch_t WhatToSearch; // Search courses, teachers, documents...?
// long LastCrs;
struct struct
{ {
Hie_Level_t Scope; // Course, degree, centre, etc. Hie_Level_t Scope; // Course, degree, centre, etc.