Version19.180.5

This commit is contained in:
acanas 2020-04-13 19:48:17 +02:00
parent 394dd3627a
commit 304628776b
2 changed files with 55 additions and 33 deletions

View File

@ -497,7 +497,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 19.180.4 (2020-04-13)"
#define Log_PLATFORM_VERSION "SWAD 19.180.5 (2020-04-13)"
#define CSS_FILE "swad19.146.css"
#define JS_FILE "swad19.172.1.js"
/*
@ -548,6 +548,7 @@ Funci
// TODO: Oresti Baños: cambiar ojos por candados en descriptores para prohibir/permitir y dejar los ojos para poder elegir descriptores
// TODO: Integrar pull requests con traducciones del alemán del usuario eruedin en GitHub
Version 19.180.5: Apr 13, 2020 Fixed bug in statistics. (285637 lines)
Version 19.180.4: Apr 13, 2020 Fixed bug in attendance.
Fixed bug in lists of users.
Fixed bug in dates (assignments, agenda). (285622 lines)
@ -598,8 +599,10 @@ INSERT INTO log SELECT * FROM log_full WHERE YEAR(ClickTime) = 2016;
INSERT INTO log SELECT * FROM log_full WHERE YEAR(ClickTime) = 2017;
INSERT INTO log SELECT * FROM log_full WHERE YEAR(ClickTime) = 2018;
INSERT INTO log SELECT * FROM log_full WHERE YEAR(ClickTime) = 2019;
INSERT INTO log SELECT * FROM log_full WHERE YEAR(ClickTime) = 2020;
INSERT INTO log SELECT * FROM log_full WHERE YEAR(ClickTime) > 2020;
RENAME TABLE log_full TO log_old;
Version 19.162: Apr 04, 2020 Code refactoring in tests. (284492 lines)
@ -613,8 +616,8 @@ sudo cp icon/filext32x32/m4a32x32.gif /var/www/html/swad/icon/filext32x32/
Version 19.159: Apr 03, 2020 Code refactoring and bug fixing in tests. (285052 lines)
Version 19.158: Apr 02, 2020 Lot of code refactoring in tests. (285031 lines)
5 changes necessary in database:
ALTER TABLE tst_exams RENAME INDEX TstCod TO ExaCod;
ALTER TABLE tst_exams CHANGE COLUMN TstCod ExaCod INT NOT NULL AUTO_INCREMENT;
ALTER TABLE tst_exams DROP INDEX TstCod,ADD UNIQUE INDEX(ExaCod);
DROP INDEX TstCod ON tst_exam_questions;
ALTER TABLE tst_exam_questions CHANGE COLUMN TstCod ExaCod INT NOT NULL;

View File

@ -100,6 +100,9 @@ typedef enum
/***************************** Private prototypes ****************************/
/*****************************************************************************/
static void Sta_PutFormCrsHits (struct Sta_Stats *Stats);
static void Sta_PutFormGblHits (struct Sta_Stats *Stats);
static void Sta_WriteSelectorCountType (const struct Sta_Stats *Stats);
static void Sta_WriteSelectorAction (const struct Sta_Stats *Stats);
static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse);
@ -207,6 +210,17 @@ void Sta_GetRemoteAddr (void)
/*****************************************************************************/
void Sta_AskShowCrsHits (void)
{
struct Sta_Stats Stats;
/***** Reset stats context *****/
Sta_ResetStats (&Stats);
/***** Show form to select global hits *****/
Sta_PutFormCrsHits (&Stats);
}
static void Sta_PutFormCrsHits (struct Sta_Stats *Stats)
{
extern const char *Hlp_ANALYTICS_Visits_visits_to_course;
extern const char *The_ClassFormInBox[The_NUM_THEMES];
@ -234,16 +248,12 @@ void Sta_AskShowCrsHits (void)
Sta_MAX_ROWS_PER_PAGE,
};
#define NUM_OPTIONS_ROWS_PER_PAGE (sizeof (RowsPerPage) / sizeof (RowsPerPage[0]))
struct Sta_Stats Stats;
Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME];
unsigned NumTotalUsrs;
Sta_ClicksGroupedBy_t ClicksGroupedBy;
unsigned ClicksGroupedByUnsigned;
size_t i;
/***** Reset stats context *****/
Sta_ResetStats (&Stats);
/***** Contextual menu *****/
Mnu_ContextMenuBegin ();
Sta_PutLinkToGlobalHits (); // Global hits
@ -332,7 +342,7 @@ void Sta_AskShowCrsHits (void)
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (SetHMS);
/***** Selection of action *****/
Sta_WriteSelectorAction (&Stats);
Sta_WriteSelectorAction (Stats);
/***** Option a) Listing of clicks distributed by some metric *****/
HTM_TR_Begin (NULL);
@ -343,19 +353,19 @@ void Sta_AskShowCrsHits (void)
HTM_TD_Begin ("class=\"LM\"");
if ((Stats.ClicksGroupedBy < Sta_CLICKS_CRS_PER_USR ||
Stats.ClicksGroupedBy > Sta_CLICKS_CRS_PER_ACTION) &&
Stats.ClicksGroupedBy != Sta_CLICKS_CRS_DETAILED_LIST)
Stats.ClicksGroupedBy = Sta_CLICKS_GROUPED_BY_DEFAULT;
if ((Stats->ClicksGroupedBy < Sta_CLICKS_CRS_PER_USR ||
Stats->ClicksGroupedBy > Sta_CLICKS_CRS_PER_ACTION) &&
Stats->ClicksGroupedBy != Sta_CLICKS_CRS_DETAILED_LIST)
Stats->ClicksGroupedBy = Sta_CLICKS_GROUPED_BY_DEFAULT;
HTM_INPUT_RADIO ("GroupedOrDetailed",false,
"value=\"%u\"%s onclick=\"disableDetailedClicks();\"",
(unsigned) Sta_CLICKS_GROUPED,
Stats.ClicksGroupedBy == Sta_CLICKS_CRS_DETAILED_LIST ? "" :
" checked=\"checked\"");
Stats->ClicksGroupedBy == Sta_CLICKS_CRS_DETAILED_LIST ? "" :
" checked=\"checked\"");
/* Selection of count type (number of pages generated, accesses per user, etc.) */
Sta_WriteSelectorCountType (&Stats);
Sta_WriteSelectorCountType (Stats);
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
HTM_TxtF ("&nbsp;%s&nbsp;",Txt_distributed_by);
@ -367,7 +377,7 @@ void Sta_AskShowCrsHits (void)
{
ClicksGroupedByUnsigned = (unsigned) ClicksGroupedBy;
HTM_OPTION (HTM_Type_UNSIGNED,&ClicksGroupedByUnsigned,
ClicksGroupedBy == Stats.ClicksGroupedBy,false,
ClicksGroupedBy == Stats->ClicksGroupedBy,false,
"%s",Txt_STAT_CLICKS_GROUPED_BY[ClicksGroupedBy]);
}
HTM_SELECT_End ();
@ -381,8 +391,8 @@ void Sta_AskShowCrsHits (void)
HTM_INPUT_RADIO ("GroupedOrDetailed",false,
"value=\"%u\"%s onclick=\"enableDetailedClicks();\"",
(unsigned) Sta_CLICKS_DETAILED,
Stats.ClicksGroupedBy == Sta_CLICKS_CRS_DETAILED_LIST ? " checked=\"checked\"" :
"");
Stats->ClicksGroupedBy == Sta_CLICKS_CRS_DETAILED_LIST ? " checked=\"checked\"" :
"");
HTM_Txt (Txt_STAT_CLICKS_GROUPED_BY[Sta_CLICKS_CRS_DETAILED_LIST]);
HTM_LABEL_End ();
@ -395,13 +405,13 @@ void Sta_AskShowCrsHits (void)
HTM_TxtF ("(%s: ",Txt_results_per_page);
HTM_SELECT_Begin (false,
"id=\"RowsPage\" name=\"RowsPage\"%s",
Stats.ClicksGroupedBy == Sta_CLICKS_CRS_DETAILED_LIST ? "" :
" disabled=\"disabled\"");
Stats->ClicksGroupedBy == Sta_CLICKS_CRS_DETAILED_LIST ? "" :
" disabled=\"disabled\"");
for (i = 0;
i < NUM_OPTIONS_ROWS_PER_PAGE;
i++)
HTM_OPTION (HTM_Type_UNSIGNED,&RowsPerPage[i],
RowsPerPage[i] == Stats.RowsPerPage,false,
RowsPerPage[i] == Stats->RowsPerPage,false,
"%u",RowsPerPage[i]);
HTM_SELECT_End ();
HTM_Txt (")");
@ -444,6 +454,17 @@ void Sta_AskShowCrsHits (void)
/*****************************************************************************/
void Sta_AskShowGblHits (void)
{
struct Sta_Stats Stats;
/***** Reset stats context *****/
Sta_ResetStats (&Stats);
/***** Show form to select global hits *****/
Sta_PutFormGblHits (&Stats);
}
static void Sta_PutFormGblHits (struct Sta_Stats *Stats)
{
extern const char *Hlp_ANALYTICS_Visits_global_visits;
extern const char *The_ClassFormInBox[The_NUM_THEMES];
@ -455,7 +476,6 @@ void Sta_AskShowGblHits (void)
extern const char *Txt_distributed_by;
extern const char *Txt_STAT_CLICKS_GROUPED_BY[Sta_NUM_CLICKS_GROUPED_BY];
extern const char *Txt_Show_hits;
struct Sta_Stats Stats;
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
{
[Dat_START_TIME] = Dat_HMS_TO_000000,
@ -466,9 +486,6 @@ void Sta_AskShowGblHits (void)
Sta_ClicksGroupedBy_t ClicksGroupedBy;
unsigned ClicksGroupedByUnsigned;
/***** Reset stats context *****/
Sta_ResetStats (&Stats);
/***** Contextual menu *****/
Mnu_ContextMenuBegin ();
Sta_PutLinkToCourseHits (); // Course hits
@ -502,7 +519,7 @@ void Sta_AskShowGblHits (void)
{
RoleStatUnsigned = (unsigned) RoleStat;
HTM_OPTION (HTM_Type_UNSIGNED,&RoleStatUnsigned,
RoleStat == Stats.Role,false,
RoleStat == Stats->Role,false,
"%s",Txt_ROLE_STATS[RoleStat]);
}
HTM_SELECT_End ();
@ -511,7 +528,7 @@ void Sta_AskShowGblHits (void)
HTM_TR_End ();
/***** Selection of action *****/
Sta_WriteSelectorAction (&Stats);
Sta_WriteSelectorAction (Stats);
/***** Clicks made from anywhere, current centre, current degree or current course *****/
HTM_TR_Begin (NULL);
@ -542,15 +559,15 @@ void Sta_AskShowGblHits (void)
/* Data */
HTM_TD_Begin ("class=\"LT\"");
Sta_WriteSelectorCountType (&Stats);
Sta_WriteSelectorCountType (Stats);
/***** Type of statistic *****/
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
HTM_TxtF ("&nbsp;%s&nbsp;",Txt_distributed_by);
if (Stats.ClicksGroupedBy < Sta_CLICKS_GBL_PER_DAY ||
Stats.ClicksGroupedBy > Sta_CLICKS_GBL_PER_COURSE)
Stats.ClicksGroupedBy = Sta_CLICKS_GBL_PER_DAY;
if (Stats->ClicksGroupedBy < Sta_CLICKS_GBL_PER_DAY ||
Stats->ClicksGroupedBy > Sta_CLICKS_GBL_PER_COURSE)
Stats->ClicksGroupedBy = Sta_CLICKS_GBL_PER_DAY;
HTM_SELECT_Begin (false,
"name=\"GroupedBy\"");
@ -560,7 +577,7 @@ void Sta_AskShowGblHits (void)
{
ClicksGroupedByUnsigned = (unsigned) ClicksGroupedBy;
HTM_OPTION (HTM_Type_UNSIGNED,&ClicksGroupedByUnsigned,
ClicksGroupedBy == Stats.ClicksGroupedBy,false,
ClicksGroupedBy == Stats->ClicksGroupedBy,false,
"%s",Txt_STAT_CLICKS_GROUPED_BY[ClicksGroupedBy]);
}
HTM_SELECT_End ();
@ -704,11 +721,13 @@ void Sta_SetIniEndDates (void)
void Sta_SeeGblAccesses (void)
{
/***** Show hits *****/
Sta_ShowHits (Sta_SHOW_GLOBAL_ACCESSES);
}
void Sta_SeeCrsAccesses (void)
{
/***** Show hits *****/
Sta_ShowHits (Sta_SHOW_COURSE_ACCESSES);
}
@ -814,7 +833,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
Sco_GetScope ("ScopeSta");
/***** Show form again *****/
Sta_AskShowGblHits ();
Sta_PutFormGblHits (&Stats);
/***** Start results section *****/
HTM_SECTION_Begin (Sta_STAT_RESULTS_SECTION_ID);
@ -857,7 +876,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
Usr_GetListsSelectedEncryptedUsrsCods (&Gbl.Usrs.Selected);
/***** Show the form again *****/
Sta_AskShowCrsHits ();
Sta_PutFormCrsHits (&Stats);
/***** Start results section *****/
HTM_SECTION_Begin (Sta_STAT_RESULTS_SECTION_ID);