mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-01 06:15:31 +02:00
Version 21.9.1: Sep 20, 2021 Queries moved to module swad_browser_database.
This commit is contained in:
parent
9be6a88866
commit
92d5644eca
|
@ -368,6 +368,98 @@ unsigned Brw_DB_GetNumFilesUsr (long UsrCod)
|
||||||
(unsigned) Brw_IS_UNKNOWN); // Unknown entries are counted as files
|
(unsigned) Brw_IS_UNKNOWN); // Unknown entries are counted as files
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*********** Get the number of files in document zones of a course ***********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
unsigned Brw_DB_GetNumFilesInDocumZonesOfCrs (long CrsCod)
|
||||||
|
{
|
||||||
|
extern const Brw_FileBrowser_t Brw_DB_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER];
|
||||||
|
|
||||||
|
/***** Get number of files in document zones of a course from database *****/
|
||||||
|
return DB_QuerySELECTUnsigned ("can not get the number of files",
|
||||||
|
"SELECT"
|
||||||
|
" (SELECT COALESCE(SUM(NumFiles),0)"
|
||||||
|
" FROM brw_sizes"
|
||||||
|
" WHERE FileBrowser=%u AND Cod=%ld) +"
|
||||||
|
" (SELECT COALESCE(SUM(brw_sizes.NumFiles),0)"
|
||||||
|
" FROM grp_types,"
|
||||||
|
"grp_groups,"
|
||||||
|
"brw_sizes"
|
||||||
|
" WHERE grp_types.CrsCod=%ld"
|
||||||
|
" AND grp_types.GrpTypCod=grp_groups.GrpTypCod"
|
||||||
|
" AND brw_sizes.FileBrowser=%u"
|
||||||
|
" AND brw_sizes.Cod=grp_groups.GrpCod)",
|
||||||
|
(unsigned) Brw_DB_FileBrowserForDB_files[Brw_ADMI_DOC_CRS],
|
||||||
|
CrsCod,
|
||||||
|
CrsCod,
|
||||||
|
(unsigned) Brw_DB_FileBrowserForDB_files[Brw_ADMI_DOC_GRP]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*********** Get the number of files in shared zones of a course ***********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
unsigned Brw_DB_GetNumFilesInShareZonesOfCrs (long CrsCod)
|
||||||
|
{
|
||||||
|
extern const Brw_FileBrowser_t Brw_DB_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER];
|
||||||
|
|
||||||
|
/***** Get number of files in document zones of a course from database *****/
|
||||||
|
return DB_QuerySELECTUnsigned ("can not get the number of files",
|
||||||
|
"SELECT"
|
||||||
|
" (SELECT COALESCE(SUM(NumFiles),0)"
|
||||||
|
" FROM brw_sizes"
|
||||||
|
" WHERE FileBrowser=%u AND Cod=%ld) +"
|
||||||
|
" (SELECT COALESCE(SUM(brw_sizes.NumFiles),0)"
|
||||||
|
" FROM grp_types,"
|
||||||
|
"grp_groups,"
|
||||||
|
"brw_sizes"
|
||||||
|
" WHERE grp_types.CrsCod=%ld"
|
||||||
|
" AND grp_types.GrpTypCod=grp_groups.GrpTypCod"
|
||||||
|
" AND brw_sizes.FileBrowser=%u"
|
||||||
|
" AND brw_sizes.Cod=grp_groups.GrpCod)",
|
||||||
|
(unsigned) Brw_DB_FileBrowserForDB_files[Brw_ADMI_SHR_CRS],
|
||||||
|
CrsCod,
|
||||||
|
CrsCod,
|
||||||
|
(unsigned) Brw_DB_FileBrowserForDB_files[Brw_ADMI_SHR_GRP]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********* Get the number of files in assignment zones of a course ***********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
unsigned Brw_DB_GetNumFilesInAssigZonesOfCrs (long CrsCod)
|
||||||
|
{
|
||||||
|
extern const Brw_FileBrowser_t Brw_DB_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER];
|
||||||
|
|
||||||
|
/***** Get number of files in document zones of a course from database *****/
|
||||||
|
return DB_QuerySELECTUnsigned ("can not get the number of files",
|
||||||
|
"SELECT COALESCE(SUM(NumFiles),0)"
|
||||||
|
" FROM brw_sizes"
|
||||||
|
" WHERE FileBrowser=%u"
|
||||||
|
" AND Cod=%ld",
|
||||||
|
(unsigned) Brw_DB_FileBrowserForDB_files[Brw_ADMI_ASG_USR],
|
||||||
|
CrsCod);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************* Get the number of files in works zones of a course ************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
unsigned Brw_DB_GetNumFilesInWorksZonesOfCrs (long CrsCod)
|
||||||
|
{
|
||||||
|
extern const Brw_FileBrowser_t Brw_DB_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER];
|
||||||
|
|
||||||
|
/***** Get number of files in document zones of a course from database *****/
|
||||||
|
return DB_QuerySELECTUnsigned ("can not get the number of files",
|
||||||
|
"SELECT COALESCE(SUM(NumFiles),0)"
|
||||||
|
" FROM brw_sizes"
|
||||||
|
" WHERE FileBrowser=%u"
|
||||||
|
" AND Cod=%ld",
|
||||||
|
(unsigned) Brw_DB_FileBrowserForDB_files[Brw_ADMI_WRK_USR],
|
||||||
|
CrsCod);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**************** Remove a file or folder from the database ******************/
|
/**************** Remove a file or folder from the database ******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -55,6 +55,10 @@ unsigned Brw_DB_GetFileMetadataByPath (MYSQL_RES **mysql_res,const char *Path);
|
||||||
unsigned Brw_DB_GetFileMetadataByCod (MYSQL_RES **mysql_res,long FilCod);
|
unsigned Brw_DB_GetFileMetadataByCod (MYSQL_RES **mysql_res,long FilCod);
|
||||||
long Brw_DB_GetPublisherOfSubtree (const char *Path);
|
long Brw_DB_GetPublisherOfSubtree (const char *Path);
|
||||||
unsigned Brw_DB_GetNumFilesUsr (long UsrCod);
|
unsigned Brw_DB_GetNumFilesUsr (long UsrCod);
|
||||||
|
unsigned Brw_DB_GetNumFilesInDocumZonesOfCrs (long CrsCod);
|
||||||
|
unsigned Brw_DB_GetNumFilesInShareZonesOfCrs (long CrsCod);
|
||||||
|
unsigned Brw_DB_GetNumFilesInAssigZonesOfCrs (long CrsCod);
|
||||||
|
unsigned Brw_DB_GetNumFilesInWorksZonesOfCrs (long CrsCod);
|
||||||
void Brw_DB_RemoveOneFileOrFolder (const char Path[PATH_MAX + 1]);
|
void Brw_DB_RemoveOneFileOrFolder (const char Path[PATH_MAX + 1]);
|
||||||
void Brw_DB_RemoveChildrenOfFolder (const char Path[PATH_MAX + 1]);
|
void Brw_DB_RemoveChildrenOfFolder (const char Path[PATH_MAX + 1]);
|
||||||
void Brw_DB_RemoveInsFiles (long InsCod);
|
void Brw_DB_RemoveInsFiles (long InsCod);
|
||||||
|
|
|
@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par
|
||||||
|
|
||||||
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 21.9 (2021-09-20)"
|
#define Log_PLATFORM_VERSION "SWAD 21.9.1 (2021-09-20)"
|
||||||
#define CSS_FILE "swad20.45.css"
|
#define CSS_FILE "swad20.45.css"
|
||||||
#define JS_FILE "swad20.69.1.js"
|
#define JS_FILE "swad20.69.1.js"
|
||||||
/*
|
/*
|
||||||
TODO: Rename CENTRE to CENTER in help wiki.
|
TODO: Rename CENTRE to CENTER in help wiki.
|
||||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||||
|
|
||||||
|
Version 21.9.1: Sep 20, 2021 Queries moved to module swad_browser_database. (316023 lines)
|
||||||
Version 21.9: Sep 20, 2021 New module swad_ID_database for database queries related to user's IDs. (316021 lines)
|
Version 21.9: Sep 20, 2021 New module swad_ID_database for database queries related to user's IDs. (316021 lines)
|
||||||
Version 21.8.1: Sep 20, 2021 Queries moved to module swad_holiday_database. (315927 lines)
|
Version 21.8.1: Sep 20, 2021 Queries moved to module swad_holiday_database. (315927 lines)
|
||||||
Version 21.8: Sep 20, 2021 New module swad_holiday_database for database queries related to holidays. (315883 lines)
|
Version 21.8: Sep 20, 2021 New module swad_holiday_database for database queries related to holidays. (315883 lines)
|
||||||
|
|
111
swad_indicator.c
111
swad_indicator.c
|
@ -31,6 +31,7 @@
|
||||||
#include "swad_action.h"
|
#include "swad_action.h"
|
||||||
#include "swad_assignment_database.h"
|
#include "swad_assignment_database.h"
|
||||||
#include "swad_box.h"
|
#include "swad_box.h"
|
||||||
|
#include "swad_browser_database.h"
|
||||||
#include "swad_database.h"
|
#include "swad_database.h"
|
||||||
#include "swad_department.h"
|
#include "swad_department.h"
|
||||||
#include "swad_error.h"
|
#include "swad_error.h"
|
||||||
|
@ -70,7 +71,7 @@ typedef enum
|
||||||
|
|
||||||
static void Ind_GetParamsIndicators (struct Ind_Indicators *Indicators);
|
static void Ind_GetParamsIndicators (struct Ind_Indicators *Indicators);
|
||||||
static void Ind_GetParamNumIndicators (struct Ind_Indicators *Indicators);
|
static void Ind_GetParamNumIndicators (struct Ind_Indicators *Indicators);
|
||||||
static unsigned Ind_GetTableOfCourses (const struct Ind_Indicators *Indicators,
|
static unsigned Ind_DB_GetTableOfCourses (const struct Ind_Indicators *Indicators,
|
||||||
MYSQL_RES **mysql_res);
|
MYSQL_RES **mysql_res);
|
||||||
static bool Ind_GetIfShowBigList (struct Ind_Indicators *Indicators,
|
static bool Ind_GetIfShowBigList (struct Ind_Indicators *Indicators,
|
||||||
unsigned NumCrss);
|
unsigned NumCrss);
|
||||||
|
@ -87,11 +88,7 @@ static void Ind_ShowTableOfCoursesWithIndicators (const struct Ind_Indicators *I
|
||||||
Ind_IndicatorsLayout_t IndicatorsLayout,
|
Ind_IndicatorsLayout_t IndicatorsLayout,
|
||||||
unsigned NumCrss,MYSQL_RES *mysql_res);
|
unsigned NumCrss,MYSQL_RES *mysql_res);
|
||||||
static unsigned Ind_GetAndUpdateNumIndicatorsCrs (long CrsCod);
|
static unsigned Ind_GetAndUpdateNumIndicatorsCrs (long CrsCod);
|
||||||
static void Ind_StoreIndicatorsCrsIntoDB (long CrsCod,unsigned NumIndicators);
|
static void Ind_DB_StoreIndicatorsCrs (long CrsCod,unsigned NumIndicators);
|
||||||
static unsigned Brw_DB_GetNumFilesInDocumZonesOfCrs (long CrsCod);
|
|
||||||
static unsigned Brw_DB_GetNumFilesInShareZonesOfCrs (long CrsCod);
|
|
||||||
static unsigned Brw_DB_GetNumFilesInAssigZonesOfCrs (long CrsCod);
|
|
||||||
static unsigned Brw_DB_GetNumFilesInWorksZonesOfCrs (long CrsCod);
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************* Request showing statistics of courses *******************/
|
/******************* Request showing statistics of courses *******************/
|
||||||
|
@ -182,7 +179,7 @@ void Ind_ReqIndicatorsCourses (void)
|
||||||
If Indicators.NumIndicators >= 0 ==> only those courses in result
|
If Indicators.NumIndicators >= 0 ==> only those courses in result
|
||||||
with Indicators.NumIndicators set to yes
|
with Indicators.NumIndicators set to yes
|
||||||
will be listed */
|
will be listed */
|
||||||
NumCrss = Ind_GetTableOfCourses (&Indicators,&mysql_res);
|
NumCrss = Ind_DB_GetTableOfCourses (&Indicators,&mysql_res);
|
||||||
|
|
||||||
/***** Get vector with numbers of courses with 0, 1, 2... indicators set to yes *****/
|
/***** Get vector with numbers of courses with 0, 1, 2... indicators set to yes *****/
|
||||||
Ind_GetNumCoursesWithIndicators (NumCrssWithIndicatorYes,NumCrss,mysql_res);
|
Ind_GetNumCoursesWithIndicators (NumCrssWithIndicatorYes,NumCrss,mysql_res);
|
||||||
|
@ -276,7 +273,7 @@ void Ind_ShowIndicatorsCourses (void)
|
||||||
Ind_GetParamsIndicators (&Indicators);
|
Ind_GetParamsIndicators (&Indicators);
|
||||||
|
|
||||||
/***** Get courses from database *****/
|
/***** Get courses from database *****/
|
||||||
NumCrss = Ind_GetTableOfCourses (&Indicators,&mysql_res);
|
NumCrss = Ind_DB_GetTableOfCourses (&Indicators,&mysql_res);
|
||||||
|
|
||||||
/***** Get vector with numbers of courses with 0, 1, 2... indicators set to yes *****/
|
/***** Get vector with numbers of courses with 0, 1, 2... indicators set to yes *****/
|
||||||
Ind_GetNumCoursesWithIndicators (NumCrssWithIndicatorYes,NumCrss,mysql_res);
|
Ind_GetNumCoursesWithIndicators (NumCrssWithIndicatorYes,NumCrss,mysql_res);
|
||||||
|
@ -344,7 +341,7 @@ static void Ind_GetParamNumIndicators (struct Ind_Indicators *Indicators)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Return the number of courses found
|
// Return the number of courses found
|
||||||
|
|
||||||
static unsigned Ind_GetTableOfCourses (const struct Ind_Indicators *Indicators,
|
static unsigned Ind_DB_GetTableOfCourses (const struct Ind_Indicators *Indicators,
|
||||||
MYSQL_RES **mysql_res)
|
MYSQL_RES **mysql_res)
|
||||||
{
|
{
|
||||||
unsigned NumCrss = 0; // Initialized to avoid warning
|
unsigned NumCrss = 0; // Initialized to avoid warning
|
||||||
|
@ -1401,7 +1398,7 @@ int Ind_GetNumIndicatorsCrsFromDB (long CrsCod)
|
||||||
/************ Store number of indicators of a course in database *************/
|
/************ Store number of indicators of a course in database *************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Ind_StoreIndicatorsCrsIntoDB (long CrsCod,unsigned NumIndicators)
|
static void Ind_DB_StoreIndicatorsCrs (long CrsCod,unsigned NumIndicators)
|
||||||
{
|
{
|
||||||
/***** Store number of indicators of a course in database *****/
|
/***** Store number of indicators of a course in database *****/
|
||||||
DB_QueryUPDATE ("can not store number of indicators of a course",
|
DB_QueryUPDATE ("can not store number of indicators of a course",
|
||||||
|
@ -1481,97 +1478,5 @@ void Ind_ComputeAndStoreIndicatorsCrs (long CrsCod,int NumIndicatorsFromDB,
|
||||||
/***** Update number of indicators into database
|
/***** Update number of indicators into database
|
||||||
if different to the stored one *****/
|
if different to the stored one *****/
|
||||||
if (NumIndicatorsFromDB != (int) IndicatorsCrs->NumIndicators)
|
if (NumIndicatorsFromDB != (int) IndicatorsCrs->NumIndicators)
|
||||||
Ind_StoreIndicatorsCrsIntoDB (CrsCod,IndicatorsCrs->NumIndicators);
|
Ind_DB_StoreIndicatorsCrs (CrsCod,IndicatorsCrs->NumIndicators);
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*********** Get the number of files in document zones of a course ***********/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static unsigned Brw_DB_GetNumFilesInDocumZonesOfCrs (long CrsCod)
|
|
||||||
{
|
|
||||||
extern const Brw_FileBrowser_t Brw_DB_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER];
|
|
||||||
|
|
||||||
/***** Get number of files in document zones of a course from database *****/
|
|
||||||
return DB_QuerySELECTUnsigned ("can not get the number of files",
|
|
||||||
"SELECT"
|
|
||||||
" (SELECT COALESCE(SUM(NumFiles),0)"
|
|
||||||
" FROM brw_sizes"
|
|
||||||
" WHERE FileBrowser=%u AND Cod=%ld) +"
|
|
||||||
" (SELECT COALESCE(SUM(brw_sizes.NumFiles),0)"
|
|
||||||
" FROM grp_types,"
|
|
||||||
"grp_groups,"
|
|
||||||
"brw_sizes"
|
|
||||||
" WHERE grp_types.CrsCod=%ld"
|
|
||||||
" AND grp_types.GrpTypCod=grp_groups.GrpTypCod"
|
|
||||||
" AND brw_sizes.FileBrowser=%u"
|
|
||||||
" AND brw_sizes.Cod=grp_groups.GrpCod)",
|
|
||||||
(unsigned) Brw_DB_FileBrowserForDB_files[Brw_ADMI_DOC_CRS],
|
|
||||||
CrsCod,
|
|
||||||
CrsCod,
|
|
||||||
(unsigned) Brw_DB_FileBrowserForDB_files[Brw_ADMI_DOC_GRP]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*********** Get the number of files in shared zones of a course ***********/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static unsigned Brw_DB_GetNumFilesInShareZonesOfCrs (long CrsCod)
|
|
||||||
{
|
|
||||||
extern const Brw_FileBrowser_t Brw_DB_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER];
|
|
||||||
|
|
||||||
/***** Get number of files in document zones of a course from database *****/
|
|
||||||
return DB_QuerySELECTUnsigned ("can not get the number of files",
|
|
||||||
"SELECT"
|
|
||||||
" (SELECT COALESCE(SUM(NumFiles),0)"
|
|
||||||
" FROM brw_sizes"
|
|
||||||
" WHERE FileBrowser=%u AND Cod=%ld) +"
|
|
||||||
" (SELECT COALESCE(SUM(brw_sizes.NumFiles),0)"
|
|
||||||
" FROM grp_types,"
|
|
||||||
"grp_groups,"
|
|
||||||
"brw_sizes"
|
|
||||||
" WHERE grp_types.CrsCod=%ld"
|
|
||||||
" AND grp_types.GrpTypCod=grp_groups.GrpTypCod"
|
|
||||||
" AND brw_sizes.FileBrowser=%u"
|
|
||||||
" AND brw_sizes.Cod=grp_groups.GrpCod)",
|
|
||||||
(unsigned) Brw_DB_FileBrowserForDB_files[Brw_ADMI_SHR_CRS],
|
|
||||||
CrsCod,
|
|
||||||
CrsCod,
|
|
||||||
(unsigned) Brw_DB_FileBrowserForDB_files[Brw_ADMI_SHR_GRP]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/********* Get the number of files in assignment zones of a course ***********/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static unsigned Brw_DB_GetNumFilesInAssigZonesOfCrs (long CrsCod)
|
|
||||||
{
|
|
||||||
extern const Brw_FileBrowser_t Brw_DB_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER];
|
|
||||||
|
|
||||||
/***** Get number of files in document zones of a course from database *****/
|
|
||||||
return DB_QuerySELECTUnsigned ("can not get the number of files",
|
|
||||||
"SELECT COALESCE(SUM(NumFiles),0)"
|
|
||||||
" FROM brw_sizes"
|
|
||||||
" WHERE FileBrowser=%u"
|
|
||||||
" AND Cod=%ld",
|
|
||||||
(unsigned) Brw_DB_FileBrowserForDB_files[Brw_ADMI_ASG_USR],
|
|
||||||
CrsCod);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************* Get the number of files in works zones of a course ************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static unsigned Brw_DB_GetNumFilesInWorksZonesOfCrs (long CrsCod)
|
|
||||||
{
|
|
||||||
extern const Brw_FileBrowser_t Brw_DB_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER];
|
|
||||||
|
|
||||||
/***** Get number of files in document zones of a course from database *****/
|
|
||||||
return DB_QuerySELECTUnsigned ("can not get the number of files",
|
|
||||||
"SELECT COALESCE(SUM(NumFiles),0)"
|
|
||||||
" FROM brw_sizes"
|
|
||||||
" WHERE FileBrowser=%u"
|
|
||||||
" AND Cod=%ld",
|
|
||||||
(unsigned) Brw_DB_FileBrowserForDB_files[Brw_ADMI_WRK_USR],
|
|
||||||
CrsCod);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user