Version19.132

This commit is contained in:
Antonio Cañas Vargas 2020-02-24 22:47:34 +01:00
parent 12dc58a525
commit d1071d54e8
8 changed files with 123 additions and 55 deletions

View File

@ -72,7 +72,7 @@ CC = gcc
# LIBS when using MariaDB (also valid with MySQL): # LIBS when using MariaDB (also valid with MySQL):
LIBS = -lssl -lcrypto -lpthread -lrt -lmysqlclient -lz -L/usr/lib64/mysql -lm -lgsoap LIBS = -lssl -lcrypto -lpthread -lrt -lmysqlclient -lz -L/usr/lib64/mysql -lm -lgsoap
CFLAGS = -Wall -Wextra -mtune=native -O2 CFLAGS = -Wall -Wextra -mtune=native -O2 -s
all: swad_ca swad_de swad_en swad_es swad_fr swad_gn swad_it swad_pl swad_pt all: swad_ca swad_de swad_en swad_es swad_fr swad_gn swad_it swad_pl swad_pt

View File

@ -497,7 +497,7 @@ 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.131.1 (2020-02-24)" #define Log_PLATFORM_VERSION "SWAD 19.132 (2020-02-24)"
#define CSS_FILE "swad19.118.css" #define CSS_FILE "swad19.118.css"
#define JS_FILE "swad19.91.1.js" #define JS_FILE "swad19.91.1.js"
/* /*
@ -522,8 +522,8 @@ Param
// TODO: En la lista de conectados central, poner el logo de la institución a la que pertenece el usuario // TODO: En la lista de conectados central, poner el logo de la institución a la que pertenece el usuario
// TODO: Miguel Damas: por defecto, marcar "Permitir que los profesores..." en los test (que ya esté marcado en lugar de desmarcado) // TODO: Miguel Damas: por defecto, marcar "Permitir que los profesores..." en los test (que ya esté marcado en lugar de desmarcado)
// TODO: Si el alumno ha marcado "Permitir que los profesores...", entonces pedir confirmación al pulsar el botón azul, para evitar que se envíe por error antes de tiempo // TODO: Si el alumno ha marcado "Permitir que los profesores...", entonces pedir confirmación al pulsar el botón azul, para evitar que se envíe por error antes de tiempo
// TODO: Fig_GetAndShowCourseProgramStats
Version 19.132: Feb 24, 2020 Stats on course program items. (281426 lines)
Version 19.131.1: Feb 24, 2020 Fixed bug in API. (281360 lines) Version 19.131.1: Feb 24, 2020 Fixed bug in API. (281360 lines)
Version 19.131: Feb 24, 2020 Code refactoring in API. (281350 lines) Version 19.131: Feb 24, 2020 Code refactoring in API. (281350 lines)
Version 19.130.2: Feb 24, 2020 Fixed bugs in usage report. (281259 lines) Version 19.130.2: Feb 24, 2020 Fixed bugs in usage report. (281259 lines)

View File

@ -47,6 +47,7 @@
#include "swad_notice.h" #include "swad_notice.h"
#include "swad_privacy.h" #include "swad_privacy.h"
#include "swad_profile.h" #include "swad_profile.h"
#include "swad_program.h"
#include "swad_role.h" #include "swad_role.h"
/*****************************************************************************/ /*****************************************************************************/
@ -317,7 +318,7 @@ void Fig_ShowFigures (void)
[Fig_DEGREE_TYPES ] = Fig_GetAndShowDegreeTypesStats, [Fig_DEGREE_TYPES ] = Fig_GetAndShowDegreeTypesStats,
[Fig_FOLDERS_AND_FILES] = Fig_GetAndShowFileBrowsersStats, [Fig_FOLDERS_AND_FILES] = Fig_GetAndShowFileBrowsersStats,
[Fig_OER ] = Fig_GetAndShowOERsStats, [Fig_OER ] = Fig_GetAndShowOERsStats,
[Fig_COURSE_PROGRAM ] = Fig_GetAndShowCourseProgramStats, [Fig_COURSE_PROGRAMS ] = Fig_GetAndShowCourseProgramStats,
[Fig_ASSIGNMENTS ] = Fig_GetAndShowAssignmentsStats, [Fig_ASSIGNMENTS ] = Fig_GetAndShowAssignmentsStats,
[Fig_PROJECTS ] = Fig_GetAndShowProjectsStats, [Fig_PROJECTS ] = Fig_GetAndShowProjectsStats,
[Fig_TESTS ] = Fig_GetAndShowTestsStats, [Fig_TESTS ] = Fig_GetAndShowTestsStats,
@ -2945,34 +2946,31 @@ static void Fig_GetNumberOfOERsFromDB (Hie_Level_t Scope,Brw_License_t License,u
static void Fig_GetAndShowCourseProgramStats (void) // TODO: Change function from assignments to course program items static void Fig_GetAndShowCourseProgramStats (void) // TODO: Change function from assignments to course program items
{ {
extern const char *Hlp_ANALYTICS_Figures_assignments; extern const char *Hlp_ANALYTICS_Figures_course_programs;
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES]; extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Number_of_BR_assignments; extern const char *Txt_Number_of_BR_program_items;
extern const char *Txt_Number_of_BR_courses_with_BR_assignments; extern const char *Txt_Number_of_BR_courses_with_BR_program_items;
extern const char *Txt_Average_number_BR_of_ASSIG_BR_per_course; extern const char *Txt_Average_number_BR_of_items_BR_per_course;
extern const char *Txt_Number_of_BR_notifications; unsigned NumPrgItems;
unsigned NumAssignments; unsigned NumCoursesWithPrgItems = 0;
unsigned NumNotif; double NumPrgItemsPerCourse = 0.0;
unsigned NumCoursesWithAssignments = 0;
double NumAssignmentsPerCourse = 0.0;
/***** Get the number of assignments from this location *****/ /***** Get the number of program items from this location *****/
if ((NumAssignments = Asg_GetNumAssignments (Gbl.Scope.Current,&NumNotif))) if ((NumPrgItems = Prg_GetNumPrgItems (Gbl.Scope.Current)))
if ((NumCoursesWithAssignments = Asg_GetNumCoursesWithAssignments (Gbl.Scope.Current)) != 0) if ((NumCoursesWithPrgItems = Prg_GetNumCoursesWithPrgItems (Gbl.Scope.Current)) != 0)
NumAssignmentsPerCourse = (double) NumAssignments / NumPrgItemsPerCourse = (double) NumPrgItems /
(double) NumCoursesWithAssignments; (double) NumCoursesWithPrgItems;
/***** Begin box and table *****/ /***** Begin box and table *****/
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_ASSIGNMENTS],NULL, Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_ASSIGNMENTS],NULL,
Hlp_ANALYTICS_Figures_assignments,Box_NOT_CLOSABLE,2); Hlp_ANALYTICS_Figures_course_programs,Box_NOT_CLOSABLE,2);
/***** Write table heading *****/ /***** Write table heading *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TH (1,1,"RM",Txt_Number_of_BR_assignments); HTM_TH (1,1,"RM",Txt_Number_of_BR_program_items);
HTM_TH (1,1,"RM",Txt_Number_of_BR_courses_with_BR_assignments); HTM_TH (1,1,"RM",Txt_Number_of_BR_courses_with_BR_program_items);
HTM_TH (1,1,"RM",Txt_Average_number_BR_of_ASSIG_BR_per_course); HTM_TH (1,1,"RM",Txt_Average_number_BR_of_items_BR_per_course);
HTM_TH (1,1,"RM",Txt_Number_of_BR_notifications);
HTM_TR_End (); HTM_TR_End ();
@ -2980,19 +2978,15 @@ static void Fig_GetAndShowCourseProgramStats (void) // TODO: Change function fro
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"DAT RM\""); HTM_TD_Begin ("class=\"DAT RM\"");
HTM_Unsigned (NumAssignments); HTM_Unsigned (NumPrgItems);
HTM_TD_End (); HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT RM\""); HTM_TD_Begin ("class=\"DAT RM\"");
HTM_Unsigned (NumCoursesWithAssignments); HTM_Unsigned (NumCoursesWithPrgItems);
HTM_TD_End (); HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT RM\""); HTM_TD_Begin ("class=\"DAT RM\"");
HTM_Double2Decimals (NumAssignmentsPerCourse); HTM_Double2Decimals (NumPrgItemsPerCourse);
HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT RM\"");
HTM_Unsigned (NumNotif);
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();

View File

@ -41,7 +41,7 @@ typedef enum
Fig_DEGREE_TYPES, // Number of degrees in each type of degree Fig_DEGREE_TYPES, // Number of degrees in each type of degree
Fig_FOLDERS_AND_FILES, // Number of folders and files Fig_FOLDERS_AND_FILES, // Number of folders and files
Fig_OER, // Number of OERs (Open Educational Resources) Fig_OER, // Number of OERs (Open Educational Resources)
Fig_COURSE_PROGRAM, // Number of program items Fig_COURSE_PROGRAMS, // Number of program items
Fig_ASSIGNMENTS, // Number of assignments Fig_ASSIGNMENTS, // Number of assignments
Fig_PROJECTS, // Number of projects Fig_PROJECTS, // Number of projects
Fig_TESTS, // Number of test questions Fig_TESTS, // Number of test questions

View File

@ -2763,6 +2763,27 @@ const char *Hlp_ANALYTICS_Figures_open_educational_resources_oer =
"ANALYTICS.Figures.en#open-educational-resources-oer"; "ANALYTICS.Figures.en#open-educational-resources-oer";
#endif #endif
const char *Hlp_ANALYTICS_Figures_course_programs =
#if L==1
"ANALYTICS.Figures.es#programas-de-asignaturas";
#elif L==2
"ANALYTICS.Figures.en#course-programs";
#elif L==3
"ANALYTICS.Figures.en#course-programs";
#elif L==4
"ANALYTICS.Figures.es#programas-de-asignaturas";
#elif L==5
"ANALYTICS.Figures.en#course-programs";
#elif L==6
"ANALYTICS.Figures.es#programas-de-asignaturas";
#elif L==7
"ANALYTICS.Figures.en#course-programs";
#elif L==8
"ANALYTICS.Figures.en#course-programs";
#elif L==9
"ANALYTICS.Figures.en#course-programs";
#endif
const char *Hlp_ANALYTICS_Figures_assignments = const char *Hlp_ANALYTICS_Figures_assignments =
#if L==1 #if L==1
"ANALYTICS.Figures.es#actividades"; "ANALYTICS.Figures.es#actividades";

View File

@ -255,7 +255,7 @@ static void Prg_PutIconsListPrgItems (void)
Prg_PutIconToCreateNewPrgItem (); Prg_PutIconToCreateNewPrgItem ();
/***** Put icon to show a figure *****/ /***** Put icon to show a figure *****/
Gbl.Figures.FigureType = Fig_COURSE_PROGRAM; Gbl.Figures.FigureType = Fig_COURSE_PROGRAMS;
Fig_PutIconToShowFigure (); Fig_PutIconToShowFigure ();
} }
@ -1612,10 +1612,9 @@ unsigned Prg_GetNumCoursesWithPrgItems (Hie_Level_t Scope)
/*****************************************************************************/ /*****************************************************************************/
/************************ Get number of program items ************************/ /************************ Get number of program items ************************/
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of program items // Returns the number of program items in a hierarchy scope
// in this location (all the platform, current degree or current course)
unsigned Prg_GetNumPrgItems (Hie_Level_t Scope,unsigned *NumNotif) unsigned Prg_GetNumPrgItems (Hie_Level_t Scope)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -1626,13 +1625,13 @@ unsigned Prg_GetNumPrgItems (Hie_Level_t Scope,unsigned *NumNotif)
{ {
case Hie_SYS: case Hie_SYS:
DB_QuerySELECT (&mysql_res,"can not get number of program items", DB_QuerySELECT (&mysql_res,"can not get number of program items",
"SELECT COUNT(*),SUM(NumNotif)" "SELECT COUNT(*)"
" FROM prg_items" " FROM prg_items"
" WHERE CrsCod>0"); " WHERE CrsCod>0");
break; break;
case Hie_CTY: case Hie_CTY:
DB_QuerySELECT (&mysql_res,"can not get number of program items", DB_QuerySELECT (&mysql_res,"can not get number of program items",
"SELECT COUNT(*),SUM(prg_items.NumNotif)" "SELECT COUNT(*)"
" FROM institutions,centres,degrees,courses,prg_items" " FROM institutions,centres,degrees,courses,prg_items"
" WHERE institutions.CtyCod=%ld" " WHERE institutions.CtyCod=%ld"
" AND institutions.InsCod=centres.InsCod" " AND institutions.InsCod=centres.InsCod"
@ -1643,7 +1642,7 @@ unsigned Prg_GetNumPrgItems (Hie_Level_t Scope,unsigned *NumNotif)
break; break;
case Hie_INS: case Hie_INS:
DB_QuerySELECT (&mysql_res,"can not get number of program items", DB_QuerySELECT (&mysql_res,"can not get number of program items",
"SELECT COUNT(*),SUM(prg_items.NumNotif)" "SELECT COUNT(*)"
" FROM centres,degrees,courses,prg_items" " FROM centres,degrees,courses,prg_items"
" WHERE centres.InsCod=%ld" " WHERE centres.InsCod=%ld"
" AND centres.CtrCod=degrees.CtrCod" " AND centres.CtrCod=degrees.CtrCod"
@ -1653,7 +1652,7 @@ unsigned Prg_GetNumPrgItems (Hie_Level_t Scope,unsigned *NumNotif)
break; break;
case Hie_CTR: case Hie_CTR:
DB_QuerySELECT (&mysql_res,"can not get number of program items", DB_QuerySELECT (&mysql_res,"can not get number of program items",
"SELECT COUNT(*),SUM(prg_items.NumNotif)" "SELECT COUNT(*)"
" FROM degrees,courses,prg_items" " FROM degrees,courses,prg_items"
" WHERE degrees.CtrCod=%ld" " WHERE degrees.CtrCod=%ld"
" AND degrees.DegCod=courses.DegCod" " AND degrees.DegCod=courses.DegCod"
@ -1662,7 +1661,7 @@ unsigned Prg_GetNumPrgItems (Hie_Level_t Scope,unsigned *NumNotif)
break; break;
case Hie_DEG: case Hie_DEG:
DB_QuerySELECT (&mysql_res,"can not get number of program items", DB_QuerySELECT (&mysql_res,"can not get number of program items",
"SELECT COUNT(*),SUM(prg_items.NumNotif)" "SELECT COUNT(*)"
" FROM courses,prg_items" " FROM courses,prg_items"
" WHERE courses.DegCod=%ld" " WHERE courses.DegCod=%ld"
" AND courses.CrsCod=prg_items.CrsCod", " AND courses.CrsCod=prg_items.CrsCod",
@ -1670,7 +1669,7 @@ unsigned Prg_GetNumPrgItems (Hie_Level_t Scope,unsigned *NumNotif)
break; break;
case Hie_CRS: case Hie_CRS:
DB_QuerySELECT (&mysql_res,"can not get number of program items", DB_QuerySELECT (&mysql_res,"can not get number of program items",
"SELECT COUNT(*),SUM(NumNotif)" "SELECT COUNT(*)"
" FROM prg_items" " FROM prg_items"
" WHERE CrsCod=%ld", " WHERE CrsCod=%ld",
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
@ -1685,15 +1684,6 @@ unsigned Prg_GetNumPrgItems (Hie_Level_t Scope,unsigned *NumNotif)
if (sscanf (row[0],"%u",&NumPrgItems) != 1) if (sscanf (row[0],"%u",&NumPrgItems) != 1)
Lay_ShowErrorAndExit ("Error when getting number of program items."); Lay_ShowErrorAndExit ("Error when getting number of program items.");
/***** Get number of notifications by email *****/
if (row[1])
{
if (sscanf (row[1],"%u",NumNotif) != 1)
Lay_ShowErrorAndExit ("Error when getting number of notifications of program items.");
}
else
*NumNotif = 0;
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);

View File

@ -85,6 +85,6 @@ void Prg_RemoveCrsPrgItems (long CrsCod);
unsigned Prg_GetNumPrgItemsInCrs(long CrsCod); unsigned Prg_GetNumPrgItemsInCrs(long CrsCod);
unsigned Prg_GetNumCoursesWithPrgItems (Hie_Level_t Scope); unsigned Prg_GetNumCoursesWithPrgItems (Hie_Level_t Scope);
unsigned Prg_GetNumPrgItems (Hie_Level_t Scope,unsigned *NumNotif); unsigned Prg_GetNumPrgItems (Hie_Level_t Scope);
#endif #endif

View File

@ -2457,6 +2457,27 @@ const char *Txt_Average_number_BR_of_games_BR_per_course =
"N&ordm; medio<br />de jogos<br />por disciplina"; "N&ordm; medio<br />de jogos<br />por disciplina";
#endif #endif
const char *Txt_Average_number_BR_of_items_BR_per_course =
#if L==1 // ca
"Nombre mitj&acute;<br />d'items<br />per assignatura";
#elif L==2 // de
"Durchschnittliche Anzahl<br />von Programmelemente<br />pro Kurs";
#elif L==3 // en
"Average number<br />of items<br />per course";
#elif L==4 // es
"N&ordm; medio<br />de items<br />por asignatura";
#elif L==5 // fr
"Nombre moyen<br />d'&eacute;l&eacute;ments<br />par mati&egrave;re";
#elif L==6 // gn
"N&ordm; medio<br />de items<br />por asignatura"; // Okoteve traducción
#elif L==7 // it
"Numero medio<br />di elementi<br />per corso";
#elif L==8 // pl
"&Sacute;rednia liczba<br />pozycji<br />na kurs";
#elif L==9 // pt
"N&ordm; medio<br />de itens<br />por disciplina";
#endif
const char *Txt_Average_number_BR_of_projects_BR_per_course = const char *Txt_Average_number_BR_of_projects_BR_per_course =
#if L==1 // ca #if L==1 // ca
"Nombre mitj&acute;<br />de projectes<br />per assignatura"; "Nombre mitj&acute;<br />de projectes<br />per assignatura";
@ -25682,17 +25703,17 @@ const char *Txt_No_items =
#if L==1 // ca #if L==1 // ca
"No hi ha items"; "No hi ha items";
#elif L==2 // de #elif L==2 // de
"Keine Artikel"; "Keine Programmelement";
#elif L==3 // en #elif L==3 // en
"No items"; "No items";
#elif L==4 // es #elif L==4 // es
"No hay items"; "No hay items";
#elif L==5 // fr #elif L==5 // fr
"Il n'y a pas d'articles"; "Il n'y a pas d'&eacute;l&eacute;ments";
#elif L==6 // gn #elif L==6 // gn
"No hay items"; // Okoteve traducción "No hay items"; // Okoteve traducción
#elif L==7 // it #elif L==7 // it
"Non ci sono articoli"; "Non ci sono elementi";
#elif L==8 // pl #elif L==8 // pl
"Brak przedmiot&oacute;w"; "Brak przedmiot&oacute;w";
#elif L==9 // pt #elif L==9 // pt
@ -26119,6 +26140,27 @@ const char *Txt_No_of_threads_BR_per_forum =
"N&ordm; de discuss&otilde;es<br />por f&oacute;rum"; "N&ordm; de discuss&otilde;es<br />por f&oacute;rum";
#endif #endif
const char *Txt_Number_of_BR_program_items =
#if L==1 // ca
"Nombre d'elements<br />de programes";
#elif L==2 // de
"Anzahl der Programmelemente";
#elif L==3 // en
"Number of<br />program items";
#elif L==4 // es
"N&ordm; de<br />items en programas";
#elif L==5 // fr
"Nombre d'&eacute;l&eacute;ments<br />de programme";
#elif L==6 // gn
"N&ordm; de<br />items en programas"; // Okoteve traducción
#elif L==7 // it
"Numero di elementi<br />di programmi";
#elif L==8 // pl
"Liczba<br />pozycji programu";
#elif L==9 // pt
"N&ordm; de<br />itens de programas";
#endif
const char *Txt_Number_of_BR_times_that_BR_questions_BR_have_been_BR_responded = const char *Txt_Number_of_BR_times_that_BR_questions_BR_have_been_BR_responded =
#if L==1 // ca #if L==1 // ca
"N&ordm; de<br />veces<br />que se ha<br />respondido"; // Necessita traduccio "N&ordm; de<br />veces<br />que se ha<br />respondido"; // Necessita traduccio
@ -28207,6 +28249,27 @@ const char *Txt_Number_of_BR_courses_with_BR_games =
"N&ordm; de<br />disciplinas<br />com jogos"; "N&ordm; de<br />disciplinas<br />com jogos";
#endif #endif
const char *Txt_Number_of_BR_courses_with_BR_program_items =
#if L==1 // ca
"Nombre<br />d'assignatures amb<br />elements de programes";
#elif L==2 // de
"Anzahl der<br />Kursen mit<br />Programmelemente";
#elif L==3 // en
"Number of<br />courses with<br />program items";
#elif L==4 // es
"N&ordm; de<br />asignaturas con<br />items de programas";
#elif L==5 // fr
"Nombre de<br />mati&egrave;res avec<br />d'&eacute;l&eacute;ments de programme";
#elif L==6 // gn
"N&ordm; de<br />asignaturas con<br />items de programas"; // Okoteve traducción
#elif L==7 // it
"Numero di<br />corsi con<br />elementi di programmi";
#elif L==8 // pl
"Liczba<br />kurs&oacute;w z<br />pozycji programu";
#elif L==9 // pt
"N&ordm; de<br />disciplinas com<br />itens de programas";
#endif
const char *Txt_Number_of_BR_courses_with_BR_projects = const char *Txt_Number_of_BR_courses_with_BR_projects =
#if L==1 // ca #if L==1 // ca
"Nombre<br />d'assignatures<br />amb projectes"; "Nombre<br />d'assignatures<br />amb projectes";
@ -41893,7 +41956,7 @@ const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES] =
"Recursos Educacionais Abertos (OER)" "Recursos Educacionais Abertos (OER)"
#endif #endif
, ,
[Fig_COURSE_PROGRAM] = [Fig_COURSE_PROGRAMS] =
#if L==1 // ca #if L==1 // ca
"Programa" "Programa"
#elif L==2 // de #elif L==2 // de