Version 15.225.13

This commit is contained in:
Antonio Cañas Vargas 2016-06-16 18:05:23 +02:00
parent 8dcb6aed49
commit 917d519886
4 changed files with 44 additions and 4 deletions

View File

@ -128,13 +128,15 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.225.12 (2016-06-16)" #define Log_PLATFORM_VERSION "SWAD 15.225.14 (2016-06-16)"
#define CSS_FILE "swad15.225.11.css" #define CSS_FILE "swad15.225.11.css"
#define JS_FILE "swad15.216.js" #define JS_FILE "swad15.216.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
/* /*
Version 15.225.14:Jun 16, 2016 Button in possible duplicate user to show similar users. (? lines)
Version 15.225.13:Jun 16, 2016 Check if a user in listing of possible duplicate users has accepted all his/her courses. (? lines)
Version 15.225.12:Jun 16, 2016 New module swad_duplicate for possible duplicate users. (202758 lines) Version 15.225.12:Jun 16, 2016 New module swad_duplicate for possible duplicate users. (202758 lines)
Version 15.225.11:Jun 16, 2016 Listing possible duplicate users. (202667 lines) Version 15.225.11:Jun 16, 2016 Listing possible duplicate users. (202667 lines)
Version 15.225.10:Jun 15, 2016 Listing possible duplicate users. (202626 lines) Version 15.225.10:Jun 15, 2016 Listing possible duplicate users. (202626 lines)

View File

@ -180,7 +180,10 @@ void Dup_ListDuplicateUsrs (void)
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]); UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat))
{ {
UsrDat.Accepted = false; // TODO: Get this from database if (Usr_GetNumCrssOfUsr (UsrDat.UsrCod) != 0)
UsrDat.Accepted = (Usr_GetNumCrssOfUsrNotAccepted (UsrDat.UsrCod) == 0);
else
UsrDat.Accepted = false;
/* Write data of this user */ /* Write data of this user */
Usr_WriteRowUsrMainData (NumUsrs - NumUsr,&UsrDat,false); Usr_WriteRowUsrMainData (NumUsrs - NumUsr,&UsrDat,false);

View File

@ -786,6 +786,36 @@ bool Usr_CheckIfUsrIsSuperuser (long UsrCod)
return (DB_QueryCOUNT (Query,"can not check if a user is superuser") != 0); return (DB_QueryCOUNT (Query,"can not check if a user is superuser") != 0);
} }
/*****************************************************************************/
/********************* Get number of courses of a user ***********************/
/*****************************************************************************/
unsigned Usr_GetNumCrssOfUsr (long UsrCod)
{
char Query[128];
/***** Get the number of courses of a user from database ******/
sprintf (Query,"SELECT COUNT(*) FROM crs_usr"
" WHERE UsrCod='%ld'",
UsrCod);
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of courses of a user");
}
/*****************************************************************************/
/*************** Get number of courses of a user not accepted ****************/
/*****************************************************************************/
unsigned Usr_GetNumCrssOfUsrNotAccepted (long UsrCod)
{
char Query[256];
/***** Get the number of courses of a user not accepted from database ******/
sprintf (Query,"SELECT COUNT(*) FROM crs_usr"
" WHERE UsrCod='%ld' AND Accepted='N'",
UsrCod);
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of courses of a user not accepted");
}
/*****************************************************************************/ /*****************************************************************************/
/********* Get number of courses in with a user have a given role ************/ /********* Get number of courses in with a user have a given role ************/
/*****************************************************************************/ /*****************************************************************************/
@ -794,7 +824,7 @@ unsigned Usr_GetNumCrssOfUsrWithARole (long UsrCod,Rol_Role_t Role)
{ {
char Query[128]; char Query[128];
/***** Get the number of teachers in a course from database ******/ /***** Get the number of courses of a user with a role from database ******/
sprintf (Query,"SELECT COUNT(*) FROM crs_usr" sprintf (Query,"SELECT COUNT(*) FROM crs_usr"
" WHERE UsrCod='%ld' AND Role='%u'", " WHERE UsrCod='%ld' AND Role='%u'",
UsrCod,(unsigned) Role); UsrCod,(unsigned) Role);
@ -6117,7 +6147,8 @@ static void Usr_GetMyUsrListTypeFromDB (void)
Usr_ShowUsrsType_t ListType; Usr_ShowUsrsType_t ListType;
/***** Get type of listing of users from database *****/ /***** Get type of listing of users from database *****/
sprintf (Query,"SELECT UsrListType FROM crs_usr WHERE CrsCod='%ld' AND UsrCod='%ld'", sprintf (Query,"SELECT UsrListType FROM crs_usr"
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get type of listing of users"); NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get type of listing of users");

View File

@ -216,6 +216,9 @@ void Usr_RestrictLengthAndWriteName (const struct UsrData *UsrDat,unsigned MaxCh
bool Usr_CheckIfUsrIsAdm (long UsrCod,Sco_Scope_t Scope,long Cod); bool Usr_CheckIfUsrIsAdm (long UsrCod,Sco_Scope_t Scope,long Cod);
bool Usr_CheckIfUsrIsSuperuser (long UsrCod); bool Usr_CheckIfUsrIsSuperuser (long UsrCod);
unsigned Usr_GetNumCrssOfUsr (long UsrCod);
unsigned Usr_GetNumCrssOfUsrNotAccepted (long UsrCod);
unsigned Usr_GetNumCrssOfUsrWithARole (long UsrCod,Rol_Role_t Role); unsigned Usr_GetNumCrssOfUsrWithARole (long UsrCod,Rol_Role_t Role);
unsigned Usr_GetNumUsrsInCrssOfAUsr (long UsrCod,Rol_Role_t UsrRole, unsigned Usr_GetNumUsrsInCrssOfAUsr (long UsrCod,Rol_Role_t UsrRole,
Rol_Role_t OthersRole); Rol_Role_t OthersRole);
@ -241,6 +244,7 @@ bool Usr_CheckIfIBelongToIns (long InsCod);
bool Usr_CheckIfIBelongToCtr (long CtrCod); bool Usr_CheckIfIBelongToCtr (long CtrCod);
bool Usr_CheckIfIBelongToDeg (long DegCod); bool Usr_CheckIfIBelongToDeg (long DegCod);
bool Usr_CheckIfIBelongToCrs (long CrsCod); bool Usr_CheckIfIBelongToCrs (long CrsCod);
unsigned Usr_GetCtysFromUsr (long UsrCod,MYSQL_RES **mysql_res); unsigned Usr_GetCtysFromUsr (long UsrCod,MYSQL_RES **mysql_res);
unsigned long Usr_GetInssFromUsr (long UsrCod,long CtyCod,MYSQL_RES **mysql_res); unsigned long Usr_GetInssFromUsr (long UsrCod,long CtyCod,MYSQL_RES **mysql_res);
unsigned long Usr_GetCtrsFromUsr (long UsrCod,long InsCod,MYSQL_RES **mysql_res); unsigned long Usr_GetCtrsFromUsr (long UsrCod,long InsCod,MYSQL_RES **mysql_res);