diff --git a/Makefile b/Makefile
index e1a130d1..74fb67da 100644
--- a/Makefile
+++ b/Makefile
@@ -72,7 +72,7 @@ CC = gcc
# LIBS when using MariaDB (also valid with MySQL):
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
diff --git a/swad_changelog.h b/swad_changelog.h
index b08e803c..34d4e91e 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -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.131.1 (2020-02-24)"
+#define Log_PLATFORM_VERSION "SWAD 19.132 (2020-02-24)"
#define CSS_FILE "swad19.118.css"
#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: 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: 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: Feb 24, 2020 Code refactoring in API. (281350 lines)
Version 19.130.2: Feb 24, 2020 Fixed bugs in usage report. (281259 lines)
diff --git a/swad_figure.c b/swad_figure.c
index 2527b852..9dd62691 100644
--- a/swad_figure.c
+++ b/swad_figure.c
@@ -47,6 +47,7 @@
#include "swad_notice.h"
#include "swad_privacy.h"
#include "swad_profile.h"
+#include "swad_program.h"
#include "swad_role.h"
/*****************************************************************************/
@@ -317,7 +318,7 @@ void Fig_ShowFigures (void)
[Fig_DEGREE_TYPES ] = Fig_GetAndShowDegreeTypesStats,
[Fig_FOLDERS_AND_FILES] = Fig_GetAndShowFileBrowsersStats,
[Fig_OER ] = Fig_GetAndShowOERsStats,
- [Fig_COURSE_PROGRAM ] = Fig_GetAndShowCourseProgramStats,
+ [Fig_COURSE_PROGRAMS ] = Fig_GetAndShowCourseProgramStats,
[Fig_ASSIGNMENTS ] = Fig_GetAndShowAssignmentsStats,
[Fig_PROJECTS ] = Fig_GetAndShowProjectsStats,
[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
{
- 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_Number_of_BR_assignments;
- extern const char *Txt_Number_of_BR_courses_with_BR_assignments;
- extern const char *Txt_Average_number_BR_of_ASSIG_BR_per_course;
- extern const char *Txt_Number_of_BR_notifications;
- unsigned NumAssignments;
- unsigned NumNotif;
- unsigned NumCoursesWithAssignments = 0;
- double NumAssignmentsPerCourse = 0.0;
+ extern const char *Txt_Number_of_BR_program_items;
+ extern const char *Txt_Number_of_BR_courses_with_BR_program_items;
+ extern const char *Txt_Average_number_BR_of_items_BR_per_course;
+ unsigned NumPrgItems;
+ unsigned NumCoursesWithPrgItems = 0;
+ double NumPrgItemsPerCourse = 0.0;
- /***** Get the number of assignments from this location *****/
- if ((NumAssignments = Asg_GetNumAssignments (Gbl.Scope.Current,&NumNotif)))
- if ((NumCoursesWithAssignments = Asg_GetNumCoursesWithAssignments (Gbl.Scope.Current)) != 0)
- NumAssignmentsPerCourse = (double) NumAssignments /
- (double) NumCoursesWithAssignments;
+ /***** Get the number of program items from this location *****/
+ if ((NumPrgItems = Prg_GetNumPrgItems (Gbl.Scope.Current)))
+ if ((NumCoursesWithPrgItems = Prg_GetNumCoursesWithPrgItems (Gbl.Scope.Current)) != 0)
+ NumPrgItemsPerCourse = (double) NumPrgItems /
+ (double) NumCoursesWithPrgItems;
/***** Begin box and table *****/
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 *****/
HTM_TR_Begin (NULL);
- HTM_TH (1,1,"RM",Txt_Number_of_BR_assignments);
- HTM_TH (1,1,"RM",Txt_Number_of_BR_courses_with_BR_assignments);
- HTM_TH (1,1,"RM",Txt_Average_number_BR_of_ASSIG_BR_per_course);
- HTM_TH (1,1,"RM",Txt_Number_of_BR_notifications);
+ HTM_TH (1,1,"RM",Txt_Number_of_BR_program_items);
+ HTM_TH (1,1,"RM",Txt_Number_of_BR_courses_with_BR_program_items);
+ HTM_TH (1,1,"RM",Txt_Average_number_BR_of_items_BR_per_course);
HTM_TR_End ();
@@ -2980,19 +2978,15 @@ static void Fig_GetAndShowCourseProgramStats (void) // TODO: Change function fro
HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"DAT RM\"");
- HTM_Unsigned (NumAssignments);
+ HTM_Unsigned (NumPrgItems);
HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT RM\"");
- HTM_Unsigned (NumCoursesWithAssignments);
+ HTM_Unsigned (NumCoursesWithPrgItems);
HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT RM\"");
- HTM_Double2Decimals (NumAssignmentsPerCourse);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"DAT RM\"");
- HTM_Unsigned (NumNotif);
+ HTM_Double2Decimals (NumPrgItemsPerCourse);
HTM_TD_End ();
HTM_TR_End ();
diff --git a/swad_figure.h b/swad_figure.h
index 73aeadd8..ef71e3fb 100644
--- a/swad_figure.h
+++ b/swad_figure.h
@@ -41,7 +41,7 @@ typedef enum
Fig_DEGREE_TYPES, // Number of degrees in each type of degree
Fig_FOLDERS_AND_FILES, // Number of folders and files
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_PROJECTS, // Number of projects
Fig_TESTS, // Number of test questions
diff --git a/swad_help_URL.c b/swad_help_URL.c
index ba1f904d..c7b984f0 100644
--- a/swad_help_URL.c
+++ b/swad_help_URL.c
@@ -2763,6 +2763,27 @@ const char *Hlp_ANALYTICS_Figures_open_educational_resources_oer =
"ANALYTICS.Figures.en#open-educational-resources-oer";
#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 =
#if L==1
"ANALYTICS.Figures.es#actividades";
diff --git a/swad_program.c b/swad_program.c
index 2a123a1e..5472e177 100644
--- a/swad_program.c
+++ b/swad_program.c
@@ -255,7 +255,7 @@ static void Prg_PutIconsListPrgItems (void)
Prg_PutIconToCreateNewPrgItem ();
/***** Put icon to show a figure *****/
- Gbl.Figures.FigureType = Fig_COURSE_PROGRAM;
+ Gbl.Figures.FigureType = Fig_COURSE_PROGRAMS;
Fig_PutIconToShowFigure ();
}
@@ -1612,10 +1612,9 @@ unsigned Prg_GetNumCoursesWithPrgItems (Hie_Level_t Scope)
/*****************************************************************************/
/************************ Get number of program items ************************/
/*****************************************************************************/
-// Returns the number of program items
-// in this location (all the platform, current degree or current course)
+// Returns the number of program items in a hierarchy scope
-unsigned Prg_GetNumPrgItems (Hie_Level_t Scope,unsigned *NumNotif)
+unsigned Prg_GetNumPrgItems (Hie_Level_t Scope)
{
MYSQL_RES *mysql_res;
MYSQL_ROW row;
@@ -1626,13 +1625,13 @@ unsigned Prg_GetNumPrgItems (Hie_Level_t Scope,unsigned *NumNotif)
{
case Hie_SYS:
DB_QuerySELECT (&mysql_res,"can not get number of program items",
- "SELECT COUNT(*),SUM(NumNotif)"
+ "SELECT COUNT(*)"
" FROM prg_items"
" WHERE CrsCod>0");
break;
case Hie_CTY:
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"
" WHERE institutions.CtyCod=%ld"
" AND institutions.InsCod=centres.InsCod"
@@ -1643,7 +1642,7 @@ unsigned Prg_GetNumPrgItems (Hie_Level_t Scope,unsigned *NumNotif)
break;
case Hie_INS:
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"
" WHERE centres.InsCod=%ld"
" AND centres.CtrCod=degrees.CtrCod"
@@ -1653,7 +1652,7 @@ unsigned Prg_GetNumPrgItems (Hie_Level_t Scope,unsigned *NumNotif)
break;
case Hie_CTR:
DB_QuerySELECT (&mysql_res,"can not get number of program items",
- "SELECT COUNT(*),SUM(prg_items.NumNotif)"
+ "SELECT COUNT(*)"
" FROM degrees,courses,prg_items"
" WHERE degrees.CtrCod=%ld"
" AND degrees.DegCod=courses.DegCod"
@@ -1662,7 +1661,7 @@ unsigned Prg_GetNumPrgItems (Hie_Level_t Scope,unsigned *NumNotif)
break;
case Hie_DEG:
DB_QuerySELECT (&mysql_res,"can not get number of program items",
- "SELECT COUNT(*),SUM(prg_items.NumNotif)"
+ "SELECT COUNT(*)"
" FROM courses,prg_items"
" WHERE courses.DegCod=%ld"
" AND courses.CrsCod=prg_items.CrsCod",
@@ -1670,7 +1669,7 @@ unsigned Prg_GetNumPrgItems (Hie_Level_t Scope,unsigned *NumNotif)
break;
case Hie_CRS:
DB_QuerySELECT (&mysql_res,"can not get number of program items",
- "SELECT COUNT(*),SUM(NumNotif)"
+ "SELECT COUNT(*)"
" FROM prg_items"
" WHERE CrsCod=%ld",
Gbl.Hierarchy.Crs.CrsCod);
@@ -1685,15 +1684,6 @@ unsigned Prg_GetNumPrgItems (Hie_Level_t Scope,unsigned *NumNotif)
if (sscanf (row[0],"%u",&NumPrgItems) != 1)
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 *****/
DB_FreeMySQLResult (&mysql_res);
diff --git a/swad_program.h b/swad_program.h
index 02999fd8..18017688 100644
--- a/swad_program.h
+++ b/swad_program.h
@@ -85,6 +85,6 @@ void Prg_RemoveCrsPrgItems (long CrsCod);
unsigned Prg_GetNumPrgItemsInCrs(long CrsCod);
unsigned Prg_GetNumCoursesWithPrgItems (Hie_Level_t Scope);
-unsigned Prg_GetNumPrgItems (Hie_Level_t Scope,unsigned *NumNotif);
+unsigned Prg_GetNumPrgItems (Hie_Level_t Scope);
#endif
diff --git a/swad_text.c b/swad_text.c
index c8b8ceae..8eb158e8 100644
--- a/swad_text.c
+++ b/swad_text.c
@@ -2457,6 +2457,27 @@ const char *Txt_Average_number_BR_of_games_BR_per_course =
"Nº medio
de jogos
por disciplina";
#endif
+const char *Txt_Average_number_BR_of_items_BR_per_course =
+#if L==1 // ca
+ "Nombre mitj´
d'items
per assignatura";
+#elif L==2 // de
+ "Durchschnittliche Anzahl
von Programmelemente
pro Kurs";
+#elif L==3 // en
+ "Average number
of items
per course";
+#elif L==4 // es
+ "Nº medio
de items
por asignatura";
+#elif L==5 // fr
+ "Nombre moyen
d'éléments
par matière";
+#elif L==6 // gn
+ "Nº medio
de items
por asignatura"; // Okoteve traducción
+#elif L==7 // it
+ "Numero medio
di elementi
per corso";
+#elif L==8 // pl
+ "Średnia liczba
pozycji
na kurs";
+#elif L==9 // pt
+ "Nº medio
de itens
por disciplina";
+#endif
+
const char *Txt_Average_number_BR_of_projects_BR_per_course =
#if L==1 // ca
"Nombre mitj´
de projectes
per assignatura";
@@ -25682,17 +25703,17 @@ const char *Txt_No_items =
#if L==1 // ca
"No hi ha items";
#elif L==2 // de
- "Keine Artikel";
+ "Keine Programmelement";
#elif L==3 // en
"No items";
#elif L==4 // es
"No hay items";
#elif L==5 // fr
- "Il n'y a pas d'articles";
+ "Il n'y a pas d'éléments";
#elif L==6 // gn
"No hay items"; // Okoteve traducción
#elif L==7 // it
- "Non ci sono articoli";
+ "Non ci sono elementi";
#elif L==8 // pl
"Brak przedmiotów";
#elif L==9 // pt
@@ -26119,6 +26140,27 @@ const char *Txt_No_of_threads_BR_per_forum =
"Nº de discussões
por fórum";
#endif
+const char *Txt_Number_of_BR_program_items =
+#if L==1 // ca
+ "Nombre d'elements
de programes";
+#elif L==2 // de
+ "Anzahl der Programmelemente";
+#elif L==3 // en
+ "Number of
program items";
+#elif L==4 // es
+ "Nº de
items en programas";
+#elif L==5 // fr
+ "Nombre d'éléments
de programme";
+#elif L==6 // gn
+ "Nº de
items en programas"; // Okoteve traducción
+#elif L==7 // it
+ "Numero di elementi
di programmi";
+#elif L==8 // pl
+ "Liczba
pozycji programu";
+#elif L==9 // pt
+ "Nº de
itens de programas";
+#endif
+
const char *Txt_Number_of_BR_times_that_BR_questions_BR_have_been_BR_responded =
#if L==1 // ca
"Nº de
veces
que se ha
respondido"; // Necessita traduccio
@@ -28207,6 +28249,27 @@ const char *Txt_Number_of_BR_courses_with_BR_games =
"Nº de
disciplinas
com jogos";
#endif
+const char *Txt_Number_of_BR_courses_with_BR_program_items =
+#if L==1 // ca
+ "Nombre
d'assignatures amb
elements de programes";
+#elif L==2 // de
+ "Anzahl der
Kursen mit
Programmelemente";
+#elif L==3 // en
+ "Number of
courses with
program items";
+#elif L==4 // es
+ "Nº de
asignaturas con
items de programas";
+#elif L==5 // fr
+ "Nombre de
matières avec
d'éléments de programme";
+#elif L==6 // gn
+ "Nº de
asignaturas con
items de programas"; // Okoteve traducción
+#elif L==7 // it
+ "Numero di
corsi con
elementi di programmi";
+#elif L==8 // pl
+ "Liczba
kursów z
pozycji programu";
+#elif L==9 // pt
+ "Nº de
disciplinas com
itens de programas";
+#endif
+
const char *Txt_Number_of_BR_courses_with_BR_projects =
#if L==1 // ca
"Nombre
d'assignatures
amb projectes";
@@ -41893,7 +41956,7 @@ const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES] =
"Recursos Educacionais Abertos (OER)"
#endif
,
- [Fig_COURSE_PROGRAM] =
+ [Fig_COURSE_PROGRAMS] =
#if L==1 // ca
"Programa"
#elif L==2 // de