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

View File

@ -468,10 +468,11 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
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 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)
2 changes necessary in database:
DROP TABLE IF EXISTS mch_results;

View File

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

View File

@ -47,6 +47,7 @@
#include "swad_setting.h"
#include "swad_table.h"
#include "swad_test.h"
#include "swad_user.h"
/*****************************************************************************/
/************** 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_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,
time_t TimeUTC[Dat_NUM_START_END_TIME],
unsigned *NumQsts,
@ -2662,9 +2663,8 @@ void Mch_ShowMyMchResults (void)
/***** 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);
/***** List my matches results *****/
Mch_ShowMchResults (Usr_ME);
/***** End table and box *****/
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_CheckIfICanViewMch (&Gbl.Usrs.Other.UsrDat))
/***** Show matches results *****/
Mch_ShowMchResults (&Gbl.Usrs.Other.UsrDat);
Mch_ShowMchResults (Usr_OTHER);
}
/***** End table and box *****/
@ -2883,12 +2883,13 @@ static void Mch_ShowHeaderMchResults (void)
/*********** 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_View_test;
MYSQL_RES *mysql_res;
MYSQL_ROW row;
struct UsrData *UsrDat;
unsigned NumResults;
unsigned NumResult;
static unsigned UniqueId = 0;
@ -2903,6 +2904,10 @@ static void Mch_ShowMchResults (struct UsrData *UsrDat)
time_t TimeUTC[Dat_NUM_START_END_TIME];
char *ClassDat;
/***** Set user *****/
UsrDat = (MeOrOther == Usr_ME) ? &Gbl.Usrs.Me.UsrDat :
&Gbl.Usrs.Other.UsrDat;
/***** Make database query *****/
NumResults =
(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 */
fprintf (Gbl.F.Out,"<td class=\"RIGHT_TOP COLOR%u\">",
Gbl.RowEvenOdd);
Frm_StartForm (Gbl.Action.Act == ActSeeMyMchRes ? ActSeeOneMchResMe :
ActSeeOneMchResOth);
// Tst_PutParamTstCod (TstCod); // TODO: Change to matches results
switch (MeOrOther)
{
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);
Frm_EndForm ();
fprintf (Gbl.F.Out,"</td>"
@ -3027,21 +3041,10 @@ static void Mch_ShowMchResults (struct UsrData *UsrDat)
// 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);
{
Tbl_PutEmptyCells (8);
fprintf (Gbl.F.Out,"</tr>");
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);

View File

@ -92,3 +92,14 @@ void Tbl_EndTable (void)
{
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_EndTable (void);
void Tbl_PutEmptyCells (unsigned NumColumns);
#endif

View File

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

View File

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