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 = -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

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.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)

View File

@ -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 ();

View File

@ -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

View File

@ -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";

View File

@ -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);

View File

@ -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

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";
#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 =
#if L==1 // ca
"Nombre mitj&acute;<br />de projectes<br />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'&eacute;l&eacute;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&oacute;w";
#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";
#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 =
#if L==1 // ca
"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";
#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 =
#if L==1 // ca
"Nombre<br />d'assignatures<br />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