Version 21.1.1: Sep 14, 2021 Queries moved to module swad_enrolment_database.

This commit is contained in:
acanas 2021-09-14 13:00:57 +02:00
parent 60a9c2ab2b
commit b8b10a000f
4 changed files with 26 additions and 22 deletions

View File

@ -42,6 +42,7 @@
#include "swad_browser.h"
#include "swad_config.h"
#include "swad_database.h"
#include "swad_enrolment_database.h"
#include "swad_error.h"
#include "swad_figure.h"
#include "swad_file_extension.h"
@ -2680,13 +2681,8 @@ bool Brw_CheckIfExistsFolderAssigmentForAnyUsr (const char *FolderName)
char PathFolder[PATH_MAX * 2 + 128];
bool FolderExists = false;
/***** Get all the users belonging to current course from database *****/
NumUsrs = (unsigned)
DB_QuerySELECT (&mysql_res,"can not get users from current course",
"SELECT UsrCod"
" FROM crs_users"
" WHERE CrsCod=%ld",
Gbl.Hierarchy.Crs.CrsCod);
/***** Get all users belonging to current course *****/
NumUsrs = Enr_DB_GetUsrsFromCurrentCrs (&mysql_res);
/***** Check folders *****/
for (NumUsr = 0;
@ -2796,13 +2792,8 @@ bool Brw_UpdateFoldersAssigmentsIfExistForAllUsrs (const char *OldFolderName,con
unsigned NumUsrsError = 0;
unsigned NumUsrsSuccess = 0;
/***** Get all the users belonging to current course from database *****/
NumUsrs = (unsigned)
DB_QuerySELECT (&mysql_res,"can not get users from current course",
"SELECT UsrCod" // row[0]
" FROM crs_users"
" WHERE CrsCod=%ld",
Gbl.Hierarchy.Crs.CrsCod);
/***** Get all users belonging to current course *****/
NumUsrs = Enr_DB_GetUsrsFromCurrentCrs (&mysql_res);
/***** Check if there exist folders with the new name *****/
for (NumUsr = 0;
@ -2913,13 +2904,8 @@ void Brw_RemoveFoldersAssignmentsIfExistForAllUsrs (const char *FolderName)
long UsrCod;
char PathFolder[PATH_MAX * 2 + 128];
/***** Get all the users belonging to current course from database *****/
NumUsrs = (unsigned)
DB_QuerySELECT (&mysql_res,"can not get users from current course",
"SELECT UsrCod" // row[0]
" FROM crs_users"
" WHERE CrsCod=%ld",
Gbl.Hierarchy.Crs.CrsCod);
/***** Get all users belonging to current course *****/
NumUsrs = Enr_DB_GetUsrsFromCurrentCrs (&mysql_res);
/***** Remove folders *****/
for (NumUsr = 0;

View File

@ -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.
*/
#define Log_PLATFORM_VERSION "SWAD 21.1 (2021-09-13)"
#define Log_PLATFORM_VERSION "SWAD 21.1.1 (2021-09-14)"
#define CSS_FILE "swad20.45.css"
#define JS_FILE "swad20.69.1.js"
/*
TODO: Rename CENTRE to CENTER in help wiki.
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
Version 21.1.1: Sep 14, 2021 Queries moved to module swad_enrolment_database. (315050 lines)
Version 21.1: Sep 13, 2021 New module swad_browser_database for database queries related to file browsers. (315050 lines)
Version 21.0.2: Sep 13, 2021 Queries moved to module swad_notification. (314927 lines)
Version 21.0.1: Sep 13, 2021 Queries moved to module swad_follow_database. (314910 lines)

View File

@ -92,6 +92,20 @@ void Enr_DB_AcceptUsrInCrs (long UsrCod,long CrsCod)
UsrCod);
}
/*****************************************************************************/
/*********** Get all user codes belonging to the current course **************/
/*****************************************************************************/
unsigned Enr_DB_GetUsrsFromCurrentCrs (MYSQL_RES **mysql_res)
{
return (unsigned)
DB_QuerySELECT (mysql_res,"can not get users from current course",
"SELECT UsrCod"
" FROM crs_users"
" WHERE CrsCod=%ld",
Gbl.Hierarchy.Crs.CrsCod);
}
/*****************************************************************************/
/************************** Remove user from course **************************/
/*****************************************************************************/

View File

@ -45,6 +45,9 @@
void Enr_DB_InsertUsrInCurrentCrs (long UsrCod,long CrsCod,Rol_Role_t NewRole,
Enr_KeepOrSetAccepted_t KeepOrSetAccepted);
void Enr_DB_AcceptUsrInCrs (long UsrCod,long CrsCod);
unsigned Enr_DB_GetUsrsFromCurrentCrs (MYSQL_RES **mysql_res);
void Enr_DB_RemUsrFromCrs (long UsrCod,long CrsCod);
void Enr_DB_RemUsrFromAllCrss (long UsrCod);
void Enr_DB_RemAllUsrsFromCrs (long CrsCod);