Version 23.26: Oct 04, 2023 Code refactoring in forum stats.

This commit is contained in:
acanas 2023-10-04 10:15:12 +02:00
parent 7d7a5ce980
commit 404b44356e
6 changed files with 149 additions and 219 deletions

View File

@ -632,11 +632,12 @@ TODO: Francisco Javier Fern
Me sale este error, no si por no recordar yo la sintaxis apropiada para mandar a varios destinatarios. ¿No era así?
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
*/
#define Log_PLATFORM_VERSION "SWAD 23.25.4 (2023-10-03)"
#define Log_PLATFORM_VERSION "SWAD 23.26 (2023-10-04)"
#define CSS_FILE "swad23.25.2.css"
#define JS_FILE "swad22.49.js"
/*
Version 23.25.4: Oct 03, 2023 Code refactoring. (336222 lines)
Version 23.26: Oct 04, 2023 Code refactoring in forum stats. (335965 lines)
Version 23.25.4: Oct 03, 2023 Code refactoring. (336036 lines)
Version 23.25.3: Oct 03, 2023 Code refactoring in user's hierarchy. (336222 lines)
Version 23.25.2: Oct 03, 2023 Changes in my courses. (336230 lines)
Version 23.25.1: Oct 03, 2023 Fixed recent bug in user's roles. (336225 lines)

View File

@ -384,16 +384,10 @@ unsigned Enr_DB_GetNumUsrsInCrssOfAUsr (long UsrCod,Rol_Role_t UsrRole,
switch (UsrRole)
{
case Rol_STD: // Student
sprintf (SubQueryRole," AND Role=%u",
(unsigned) Rol_STD);
break;
case Rol_NET: // Non-editing teacher
case Rol_TCH: // Teacher
sprintf (SubQueryRole," AND Role=%u",
(unsigned) Rol_NET);
break;
case Rol_TCH: // or teacher
sprintf (SubQueryRole," AND Role=%u",
(unsigned) Rol_TCH);
(unsigned) UsrRole);
break;
default:
SubQueryRole[0] = '\0';

View File

@ -158,8 +158,7 @@ void ExaSes_ListSessions (struct Exa_Exams *Exams,
if (Gbl.Crs.Grps.NumGrps)
{
Set_BeginSettingsHead ();
Grp_ShowFormToSelWhichGrps (ActSeeOneExa,
Exa_PutPars,Exams);
Grp_ShowFormToSelWhichGrps (ActSeeOneExa,Exa_PutPars,Exams);
Set_EndSettingsHead ();
}
break;

View File

@ -383,10 +383,10 @@ static bool For_CheckIfICanMoveThreads (void);
static void For_InsertThrInClipboard (long ThrCod);
static void For_ShowStatOfAForumType (For_ForumType_t ForumType,
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod,
long HieCod[Hie_NUM_LEVELS],
struct For_FiguresForum *FiguresForum);
static void For_WriteForumTitleAndStats (For_ForumType_t ForumType,
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod,
long HieCod[Hie_NUM_LEVELS],
const char *Icon,struct For_FiguresForum *FiguresForum,
const char *ForumName1,const char *ForumName2);
static void For_WriteForumTotalStats (struct For_FiguresForum *FiguresForum);
@ -3246,6 +3246,18 @@ void For_GetAndShowForumStats (void)
extern const char *Txt_Number_of_posts_BR_per_thread;
extern const char *Txt_Number_of_posts_BR_per_forum;
struct For_FiguresForum FiguresForum;
long HieCod[Hie_NUM_LEVELS] =
{
[Hie_UNK] = -1L,
[Hie_SYS] = -1L,
[Hie_CTY] = -1L,
[Hie_INS] = -1L,
[Hie_CTR] = -1L,
[Hie_DEG] = -1L,
[Hie_CRS] = -1L,
};
HieCod[Gbl.Scope.Current] = Gbl.Hierarchy.Node[Gbl.Scope.Current].HieCod;
/***** Reset total stats *****/
FiguresForum.NumForums = 0;
@ -3277,56 +3289,31 @@ void For_GetAndShowForumStats (void)
switch (Gbl.Scope.Current)
{
case Hie_SYS:
For_ShowStatOfAForumType (For_FORUM_GLOBAL_USRS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_GLOBAL_TCHS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM__SWAD__USRS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM__SWAD__TCHS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_INSTIT_USRS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_INSTIT_TCHS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_CENTER_USRS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_CENTER_TCHS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_DEGREE_USRS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_DEGREE_TCHS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
break;
For_ShowStatOfAForumType (For_FORUM_GLOBAL_USRS,HieCod,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_GLOBAL_TCHS,HieCod,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM__SWAD__USRS,HieCod,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM__SWAD__TCHS,HieCod,&FiguresForum);
/* falls through */
/* no break */
case Hie_CTY:
For_ShowStatOfAForumType (For_FORUM_INSTIT_USRS,Gbl.Hierarchy.Node[Hie_CTY].HieCod,-1L,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_INSTIT_TCHS,Gbl.Hierarchy.Node[Hie_CTY].HieCod,-1L,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_CENTER_USRS,Gbl.Hierarchy.Node[Hie_CTY].HieCod,-1L,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_CENTER_TCHS,Gbl.Hierarchy.Node[Hie_CTY].HieCod,-1L,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_DEGREE_USRS,Gbl.Hierarchy.Node[Hie_CTY].HieCod,-1L,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_DEGREE_TCHS,Gbl.Hierarchy.Node[Hie_CTY].HieCod,-1L,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_COURSE_USRS,Gbl.Hierarchy.Node[Hie_CTY].HieCod,-1L,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,Gbl.Hierarchy.Node[Hie_CTY].HieCod,-1L,-1L,-1L,-1L,&FiguresForum);
break;
case Hie_INS:
For_ShowStatOfAForumType (For_FORUM_INSTIT_USRS,-1L,Gbl.Hierarchy.Node[Hie_INS].HieCod,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_INSTIT_TCHS,-1L,Gbl.Hierarchy.Node[Hie_INS].HieCod,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_CENTER_USRS,-1L,Gbl.Hierarchy.Node[Hie_INS].HieCod,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_CENTER_TCHS,-1L,Gbl.Hierarchy.Node[Hie_INS].HieCod,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_DEGREE_USRS,-1L,Gbl.Hierarchy.Node[Hie_INS].HieCod,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_DEGREE_TCHS,-1L,Gbl.Hierarchy.Node[Hie_INS].HieCod,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_COURSE_USRS,-1L,Gbl.Hierarchy.Node[Hie_INS].HieCod,-1L,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,-1L,Gbl.Hierarchy.Node[Hie_INS].HieCod,-1L,-1L,-1L,&FiguresForum);
break;
For_ShowStatOfAForumType (For_FORUM_INSTIT_USRS,HieCod,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_INSTIT_TCHS,HieCod,&FiguresForum);
/* falls through */
/* no break */
case Hie_CTR:
For_ShowStatOfAForumType (For_FORUM_CENTER_USRS,-1L,-1L,Gbl.Hierarchy.Node[Hie_CTR].HieCod,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_CENTER_TCHS,-1L,-1L,Gbl.Hierarchy.Node[Hie_CTR].HieCod,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_DEGREE_USRS,-1L,-1L,Gbl.Hierarchy.Node[Hie_CTR].HieCod,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_DEGREE_TCHS,-1L,-1L,Gbl.Hierarchy.Node[Hie_CTR].HieCod,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_COURSE_USRS,-1L,-1L,Gbl.Hierarchy.Node[Hie_CTR].HieCod,-1L,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,-1L,-1L,Gbl.Hierarchy.Node[Hie_CTR].HieCod,-1L,-1L,&FiguresForum);
break;
For_ShowStatOfAForumType (For_FORUM_CENTER_USRS,HieCod,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_CENTER_TCHS,HieCod,&FiguresForum);
/* falls through */
/* no break */
case Hie_DEG:
For_ShowStatOfAForumType (For_FORUM_DEGREE_USRS,-1L,-1L,-1L,Gbl.Hierarchy.Node[Hie_DEG].HieCod,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_DEGREE_TCHS,-1L,-1L,-1L,Gbl.Hierarchy.Node[Hie_DEG].HieCod,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,Gbl.Hierarchy.Node[Hie_DEG].HieCod,-1L,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,-1L,-1L,-1L,Gbl.Hierarchy.Node[Hie_DEG].HieCod,-1L,&FiguresForum);
break;
For_ShowStatOfAForumType (For_FORUM_DEGREE_USRS,HieCod,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_DEGREE_TCHS,HieCod,&FiguresForum);
/* falls through */
/* no break */
case Hie_CRS:
For_ShowStatOfAForumType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,-1L,Gbl.Hierarchy.Node[Hie_CRS].HieCod,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,-1L,-1L,-1L,-1L,Gbl.Hierarchy.Node[Hie_CRS].HieCod,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_COURSE_USRS,HieCod,&FiguresForum);
For_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,HieCod,&FiguresForum);
break;
default:
Err_WrongHierarchyLevelExit ();
@ -3344,7 +3331,7 @@ void For_GetAndShowForumStats (void)
/*****************************************************************************/
static void For_ShowStatOfAForumType (For_ForumType_t ForumType,
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod,
long HieCod[Hie_NUM_LEVELS],
struct For_FiguresForum *FiguresForum)
{
extern const char *Txt_Courses;
@ -3377,7 +3364,7 @@ static void For_ShowStatOfAForumType (For_ForumType_t ForumType,
};
if (Pars[ForumType].Icon)
For_WriteForumTitleAndStats (ForumType,CtyCod,InsCod,CtrCod,DegCod,CrsCod,
For_WriteForumTitleAndStats (ForumType,HieCod,
Pars[ForumType].Icon,FiguresForum,
*Pars[ForumType].ForumName1,
*Pars[ForumType].ForumName2);
@ -3388,7 +3375,7 @@ static void For_ShowStatOfAForumType (For_ForumType_t ForumType,
/*****************************************************************************/
static void For_WriteForumTitleAndStats (For_ForumType_t ForumType,
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod,
long HieCod[Hie_NUM_LEVELS],
const char *Icon,struct For_FiguresForum *FiguresForum,
const char *ForumName1,const char *ForumName2)
{
@ -3402,9 +3389,9 @@ static void For_WriteForumTitleAndStats (For_ForumType_t ForumType,
char *ForumName;
/***** Compute number of forums, number of threads and number of posts *****/
NumForums = For_DB_GetNumTotalForumsOfType (ForumType,CtyCod,InsCod,CtrCod,DegCod,CrsCod);
NumThreads = For_DB_GetNumTotalThrsInForumsOfType (ForumType,CtyCod,InsCod,CtrCod,DegCod,CrsCod);
NumPosts = For_DB_GetNumTotalPstsInForumsOfType (ForumType,CtyCod,InsCod,CtrCod,DegCod,CrsCod,&NumUsrsToBeNotifiedByEMail);
NumForums = For_DB_GetNumTotalForumsOfType (ForumType,HieCod);
NumThreads = For_DB_GetNumTotalThrsInForumsOfType (ForumType,HieCod);
NumPosts = For_DB_GetNumTotalPstsInForumsOfType (ForumType,HieCod,&NumUsrsToBeNotifiedByEMail);
/***** Compute number of threads per forum, number of posts per forum and number of posts per thread *****/
NumThrsPerForum = (NumForums ? (double) NumThreads / (double) NumForums :

View File

@ -1018,11 +1018,7 @@ void For_DB_RemoveDisabledPstsInThread (long ThrCod)
/*****************************************************************************/
unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
long CtyCod,
long InsCod,
long CtrCod,
long DegCod,
long CrsCod)
long HieCod[Hie_NUM_LEVELS])
{
/***** Get number of forums of a type from database *****/
switch (ForumType)
@ -1034,8 +1030,7 @@ unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
return 1; // Only one forum
case For_FORUM_INSTIT_USRS:
case For_FORUM_INSTIT_TCHS:
if (InsCod > 0)
// InsCod > 0 ==> 0 <= number of institutions forums for an institution <= 1
if (HieCod[Hie_INS] > 0) // Number of institutions forums for an institution <= 1
return (unsigned)
DB_QueryCOUNT ("can not get number of forums of a type",
"SELECT COUNT(DISTINCT HieCod)"
@ -1043,10 +1038,9 @@ unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
" WHERE ForumType=%u"
" AND HieCod=%ld",
(unsigned) ForumType,
InsCod);
HieCod[Hie_INS]);
if (CtyCod > 0)
// InsCod <= 0 && CtyCod > 0 ==> Number of institution forums for a country
if (HieCod[Hie_CTY] > 0) // Number of institution forums for a country
return (unsigned)
DB_QueryCOUNT ("can not get number of forums of a type",
"SELECT COUNT(DISTINCT for_threads.HieCod)"
@ -1056,9 +1050,9 @@ unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
" AND for_threads.HieCod=ins_instits.InsCod"
" AND ins_instits.CtyCod=%ld",
(unsigned) ForumType,
CtyCod);
HieCod[Hie_CTY]);
// CtyCod <= 0 ==> Number of institutions forums for the whole platform
// Number of institutions forums for the whole platform
return (unsigned)
DB_QueryCOUNT ("can not get number of forums of a type",
"SELECT COUNT(DISTINCT HieCod)"
@ -1067,8 +1061,7 @@ unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
(unsigned) ForumType);
case For_FORUM_CENTER_USRS:
case For_FORUM_CENTER_TCHS:
if (CtrCod > 0)
// CtrCod > 0 ==> 0 <= number of center forums for a center <= 1
if (HieCod[Hie_CTR] > 0) // Number of center forums for a center <= 1
return (unsigned)
DB_QueryCOUNT ("can not get number of forums of a type",
"SELECT COUNT(DISTINCT HieCod)"
@ -1076,10 +1069,9 @@ unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
" WHERE ForumType=%u"
" AND HieCod=%ld",
(unsigned) ForumType,
CtrCod);
HieCod[Hie_CTR]);
if (InsCod > 0)
// CtrCod <= 0 && InsCod > 0 ==> Number of center forums for an institution
if (HieCod[Hie_INS] > 0) // Number of center forums for an institution
return (unsigned)
DB_QueryCOUNT ("can not get number of forums of a type",
"SELECT COUNT(DISTINCT for_threads.HieCod)"
@ -1089,10 +1081,9 @@ unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
" AND for_threads.HieCod=ctr_centers.CtrCod"
" AND ctr_centers.InsCod=%ld",
(unsigned) ForumType,
InsCod);
HieCod[Hie_INS]);
if (CtyCod > 0)
// InsCod <= 0 && CtyCod > 0 ==> Number of center forums for a country
if (HieCod[Hie_CTY] > 0) // Number of center forums for a country
return (unsigned)
DB_QueryCOUNT ("can not get number of forums of a type",
"SELECT COUNT(DISTINCT for_threads.HieCod)"
@ -1104,9 +1095,9 @@ unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
" AND ctr_centers.InsCod=ins_instits.InsCod"
" AND ins_instits.CtyCod=%ld",
(unsigned) ForumType,
CtyCod);
HieCod[Hie_CTY]);
// InsCod <= 0 ==> Number of center forums for the whole platform
// Number of center forums for the whole platform
return (unsigned)
DB_QueryCOUNT ("can not get number of forums of a type",
"SELECT COUNT(DISTINCT HieCod)"
@ -1115,8 +1106,7 @@ unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
(unsigned) ForumType);
case For_FORUM_DEGREE_USRS:
case For_FORUM_DEGREE_TCHS:
if (DegCod > 0)
// DegCod > 0 ==> 0 <= number of degree forums for a degree <= 1
if (HieCod[Hie_DEG] > 0) // Number of degree forums for a degree <= 1
return (unsigned)
DB_QueryCOUNT ("can not get number of forums of a type",
"SELECT COUNT(DISTINCT HieCod)"
@ -1124,10 +1114,9 @@ unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
" WHERE ForumType=%u"
" AND HieCod=%ld",
(unsigned) ForumType,
DegCod);
HieCod[Hie_DEG]);
if (CtrCod > 0)
// DegCod <= 0 && CtrCod > 0 ==> Number of degree forums for a center
if (HieCod[Hie_CTR] > 0) // Number of degree forums for a center
return (unsigned)
DB_QueryCOUNT ("can not get number of forums of a type",
"SELECT COUNT(DISTINCT for_threads.HieCod)"
@ -1137,10 +1126,9 @@ unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
" AND for_threads.HieCod=deg_degrees.DegCod"
" AND deg_degrees.CtrCod=%ld",
(unsigned) ForumType,
CtrCod);
HieCod[Hie_CTR]);
if (InsCod > 0)
// CtrCod <= 0 && InsCod > 0 ==> Number of degree forums for an institution
if (HieCod[Hie_INS] > 0) // Number of degree forums for an institution
return (unsigned)
DB_QueryCOUNT ("can not get number of forums of a type",
"SELECT COUNT(DISTINCT for_threads.HieCod)"
@ -1152,10 +1140,9 @@ unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
" AND ctr_centers.InsCod=%ld",
(unsigned) ForumType,
InsCod);
HieCod[Hie_INS]);
if (CtyCod > 0)
// InsCod <= 0 && CtyCod > 0 ==> Number of degree forums for a country
if (HieCod[Hie_CTY] > 0) // Number of degree forums for a country
return (unsigned)
DB_QueryCOUNT ("can not get number of forums of a type",
"SELECT COUNT(DISTINCT for_threads.HieCod)"
@ -1169,9 +1156,9 @@ unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
" AND ctr_centers.InsCod=ins_instits.InsCod"
" AND ins_instits.CtyCod=%ld",
(unsigned) ForumType,
CtyCod);
HieCod[Hie_CTY]);
// InsCod <= 0 ==> Number of degree forums for the whole platform
// Number of degree forums for the whole platform
return (unsigned)
DB_QueryCOUNT ("can not get number of forums of a type",
"SELECT COUNT(DISTINCT HieCod)"
@ -1180,8 +1167,7 @@ unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
(unsigned) ForumType);
case For_FORUM_COURSE_USRS:
case For_FORUM_COURSE_TCHS:
if (CrsCod > 0)
// CrsCod > 0 ==> 0 <= number of course forums for a course <= 1
if (HieCod[Hie_CRS] > 0) // Number of course forums for a course <= 1
return (unsigned)
DB_QueryCOUNT ("can not get number of forums of a type",
"SELECT COUNT(DISTINCT HieCod)"
@ -1189,10 +1175,9 @@ unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
" WHERE ForumType=%u"
" AND HieCod=%ld",
(unsigned) ForumType,
CrsCod);
HieCod[Hie_CRS]);
if (DegCod > 0)
// CrsCod <= 0 && DegCod > 0 ==> Number of course forums for a degree
if (HieCod[Hie_DEG] > 0) // Number of course forums for a degree
return (unsigned)
DB_QueryCOUNT ("can not get number of forums of a type",
"SELECT COUNT(DISTINCT for_threads.HieCod)"
@ -1202,10 +1187,9 @@ unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
" AND for_threads.HieCod=crs_courses.CrsCod"
" AND crs_courses.DegCod=%ld",
(unsigned) ForumType,
DegCod);
HieCod[Hie_DEG]);
if (CtrCod > 0)
// DegCod <= 0 && CtrCod > 0 ==> Number of course forums for a center
if (HieCod[Hie_CTR] > 0) // Number of course forums for a center
return (unsigned)
DB_QueryCOUNT ("can not get number of forums of a type",
"SELECT COUNT(DISTINCT for_threads.HieCod)"
@ -1217,10 +1201,9 @@ unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
" AND crs_courses.DegCod=deg_degrees.DegCod"
" AND deg_degrees.CtrCod=%ld",
(unsigned) ForumType,
CtrCod);
HieCod[Hie_CTR]);
if (InsCod > 0)
// CtrCod <= 0 && InsCod > 0 ==> Number of course forums for an institution
if (HieCod[Hie_INS] > 0) // Number of course forums for an institution
return (unsigned)
DB_QueryCOUNT ("can not get number of forums of a type",
"SELECT COUNT(DISTINCT for_threads.HieCod)"
@ -1234,10 +1217,9 @@ unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
" AND ctr_centers.InsCod=%ld",
(unsigned) ForumType,
InsCod);
HieCod[Hie_INS]);
if (CtyCod > 0)
// InsCod <= 0 && CtyCod > 0 ==> Number of course forums for a country
if (HieCod[Hie_CTY] > 0) // Number of course forums for a country
return (unsigned)
DB_QueryCOUNT ("can not get number of forums of a type",
"SELECT COUNT(DISTINCT for_threads.HieCod)"
@ -1253,9 +1235,9 @@ unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
" AND ctr_centers.InsCod=ins_instits.InsCod"
" AND ins_instits.CtyCod=%ld",
(unsigned) ForumType,
CtyCod);
HieCod[Hie_CTY]);
// InsCod <= 0 ==> Number of course forums for the whole platform
// Number of course forums for the whole platform
return (unsigned)
DB_QueryCOUNT ("can not get number of forums of a type",
"SELECT COUNT(DISTINCT HieCod)"
@ -1272,11 +1254,7 @@ unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
/*****************************************************************************/
unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
long CtyCod,
long InsCod,
long CtrCod,
long DegCod,
long CrsCod)
long HieCod[Hie_NUM_LEVELS])
{
/***** Get total number of threads in forums of this type from database *****/
switch (ForumType)
@ -1285,7 +1263,7 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
case For_FORUM_GLOBAL_TCHS:
case For_FORUM__SWAD__USRS:
case For_FORUM__SWAD__TCHS:
// Total number of threads in forums of this type
// Total number of threads in forums of this type
return (unsigned)
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
"SELECT COUNT(*)"
@ -1294,8 +1272,7 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
(unsigned) ForumType);
case For_FORUM_INSTIT_USRS:
case For_FORUM_INSTIT_TCHS:
if (InsCod > 0)
// InsCod > 0 ==> Number of threads in institution forums for an institution
if (HieCod[Hie_INS] > 0) // Number of threads in institution forums for an institution
return (unsigned)
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
"SELECT COUNT(*)"
@ -1303,10 +1280,9 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
" WHERE ForumType=%u"
" AND HieCod=%ld",
(unsigned) ForumType,
InsCod);
HieCod[Hie_INS]);
if (CtyCod > 0)
// InsCod <= 0 && CtyCod > 0 ==> Number of threads in institution forums for a country
if (HieCod[Hie_CTY] > 0) // Number of threads in institution forums for a country
return (unsigned)
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
"SELECT COUNT(*)"
@ -1316,9 +1292,9 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
" AND for_threads.HieCod=ins_instits.InsCod"
" AND ins_instits.CtyCod=%ld",
(unsigned) ForumType,
CtyCod);
HieCod[Hie_CTY]);
// InsCod <= 0 ==> Number of threads in institution forums for the whole platform
// Number of threads in institution forums for the whole platform
return (unsigned)
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
"SELECT COUNT(*)"
@ -1327,8 +1303,7 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
(unsigned) ForumType);
case For_FORUM_CENTER_USRS:
case For_FORUM_CENTER_TCHS:
if (CtrCod > 0)
// CtrCod > 0 ==> 0 <= Number of threads in center forums for a center <= 1
if (HieCod[Hie_CTR] > 0) // Number of threads in center forums for a center <= 1
return (unsigned)
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
"SELECT COUNT(*)"
@ -1336,10 +1311,9 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
" WHERE ForumType=%u"
" AND HieCod=%ld",
(unsigned) ForumType,
CtrCod);
HieCod[Hie_CTR]);
if (InsCod > 0)
// CtrCod <= 0 && InsCod > 0 ==> Number of threads in center forums for an institution
if (HieCod[Hie_INS] > 0) // Number of threads in center forums for an institution
return (unsigned)
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
"SELECT COUNT(*)"
@ -1349,10 +1323,9 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
" AND for_threads.HieCod=ctr_centers.CtrCod"
" AND ctr_centers.InsCod=%ld",
(unsigned) ForumType,
InsCod);
HieCod[Hie_INS]);
if (CtyCod > 0)
// InsCod <= 0 && CtyCod > 0 ==> Number of threads in center forums for a country
if (HieCod[Hie_CTY] > 0) // Number of threads in center forums for a country
return (unsigned)
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
"SELECT COUNT(*)"
@ -1364,9 +1337,9 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
" AND ctr_centers.InsCod=ins_instits.InsCod"
" AND ins_instits.CtyCod=%ld",
(unsigned) ForumType,
CtyCod);
HieCod[Hie_CTY]);
// InsCod <= 0 ==> Number of threads in center forums for the whole platform
// Number of threads in center forums for the whole platform
return (unsigned)
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
"SELECT COUNT(*)"
@ -1375,8 +1348,7 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
(unsigned) ForumType);
case For_FORUM_DEGREE_USRS:
case For_FORUM_DEGREE_TCHS:
if (DegCod > 0)
// DegCod > 0 ==> Number of threads in degree forums for a degree
if (HieCod[Hie_DEG] > 0) // Number of threads in degree forums for a degree
return (unsigned)
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
"SELECT COUNT(*)"
@ -1384,10 +1356,9 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
" WHERE ForumType=%u"
" AND HieCod=%ld",
(unsigned) ForumType,
DegCod);
HieCod[Hie_DEG]);
if (CtrCod > 0)
// DegCod <= 0 && CtrCod > 0 ==> Number of threads in degree forums for a center
if (HieCod[Hie_CTR] > 0) // Number of threads in degree forums for a center
return (unsigned)
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
"SELECT COUNT(*)"
@ -1397,10 +1368,9 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
" AND for_threads.HieCod=deg_degrees.DegCod"
" AND deg_degrees.CtrCod=%ld",
(unsigned) ForumType,
CtrCod);
HieCod[Hie_CTR]);
if (InsCod > 0)
// CtrCod <= 0 && InsCod > 0 ==> Number of threads in degree forums for an institution
if (HieCod[Hie_INS] > 0) // Number of threads in degree forums for an institution
return (unsigned)
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
"SELECT COUNT(*)"
@ -1412,9 +1382,9 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
" AND ctr_centers.InsCod=%ld",
(unsigned) ForumType,
InsCod);
HieCod[Hie_INS]);
if (CtyCod > 0) // InsCod <= 0 && CtyCod > 0 ==> Number of threads in degree forums for a country
if (HieCod[Hie_CTY] > 0) // Number of threads in degree forums for a country
return (unsigned)
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
"SELECT COUNT(*)"
@ -1428,9 +1398,9 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
" AND ctr_centers.InsCod=ins_instits.InsCod"
" AND ins_instits.CtyCod=%ld",
(unsigned) ForumType,
CtyCod);
HieCod[Hie_CTY]);
// InsCod <= 0 ==> Number of threads in degree forums for the whole platform
// Number of threads in degree forums for the whole platform
return (unsigned)
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
"SELECT COUNT(*)"
@ -1439,8 +1409,7 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
(unsigned) ForumType);
case For_FORUM_COURSE_USRS:
case For_FORUM_COURSE_TCHS:
if (CrsCod > 0)
// CrsCod > 0 ==> 0 <= Number of threads in course forums for a course
if (HieCod[Hie_CRS] > 0) // Number of threads in course forums for a course
return (unsigned)
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
"SELECT COUNT(*)"
@ -1448,10 +1417,9 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
" WHERE ForumType=%u"
" AND HieCod=%ld",
(unsigned) ForumType,
CrsCod);
HieCod[Hie_CRS]);
if (DegCod > 0)
// CrsCod <= 0 && DegCod > 0 ==> Number of threads in course forums for a degree
if (HieCod[Hie_DEG] > 0) // Number of threads in course forums for a degree
return (unsigned)
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
"SELECT COUNT(*)"
@ -1461,10 +1429,9 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
" AND for_threads.HieCod=crs_courses.CrsCod"
" AND crs_courses.DegCod=%ld",
(unsigned) ForumType,
DegCod);
HieCod[Hie_DEG]);
if (CtrCod > 0)
// DegCod <= 0 && CtrCod > 0 ==> Number of threads in course forums for a center
if (HieCod[Hie_CTR] > 0) // Number of threads in course forums for a center
return (unsigned)
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
"SELECT COUNT(*)"
@ -1476,10 +1443,9 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
" AND crs_courses.DegCod=deg_degrees.DegCod"
" AND deg_degrees.CtrCod=%ld",
(unsigned) ForumType,
CtrCod);
HieCod[Hie_CTR]);
if (InsCod > 0)
// CtrCod <= 0 && InsCod > 0 ==> Number of threads in course forums for an institution
if (HieCod[Hie_INS] > 0) // Number of threads in course forums for an institution
return (unsigned)
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
"SELECT COUNT(*)"
@ -1493,10 +1459,9 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
" AND ctr_centers.InsCod=%ld",
(unsigned) ForumType,
InsCod);
HieCod[Hie_INS]);
if (CtyCod > 0)
// InsCod <= 0 && CtyCod > 0 ==> Number of threads in course forums for a country
if (HieCod[Hie_CTY] > 0) // Number of threads in course forums for a country
return (unsigned)
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
"SELECT COUNT(*)"
@ -1512,9 +1477,9 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
" AND ctr_centers.InsCod=ins_instits.InsCod"
" AND ins_instits.CtyCod=%ld",
(unsigned) ForumType,
CtyCod);
HieCod[Hie_CTY]);
// InsCod <= 0 ==> Number of threads in course forums for the whole platform
// Number of threads in course forums for the whole platform
return (unsigned)
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
"SELECT COUNT(*)"
@ -1531,11 +1496,7 @@ unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
/*****************************************************************************/
unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
long CtyCod,
long InsCod,
long CtrCod,
long DegCod,
long CrsCod,
long HieCod[Hie_NUM_LEVELS],
unsigned *NumUsrsToBeNotifiedByEMail)
{
MYSQL_RES *mysql_res;
@ -1561,7 +1522,7 @@ unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
(unsigned) ForumType);
break;
case For_FORUM_INSTIT_USRS: case For_FORUM_INSTIT_TCHS:
if (InsCod > 0) // InsCod > 0 ==> Number of posts in institutions forums for an institution
if (HieCod[Hie_INS] > 0) // Number of posts in institutions forums for an institution
DB_QuerySELECT (&mysql_res,"can not get the total number"
" of forums of a type",
"SELECT COUNT(*)," // row[0]
@ -1572,8 +1533,8 @@ unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
" AND for_threads.HieCod=%ld"
" AND for_threads.ThrCod=for_posts.ThrCod",
(unsigned) ForumType,
InsCod);
else if (CtyCod > 0) // InsCod <= 0 && CtyCod > 0 ==> Number of posts in institutions forums for a country
HieCod[Hie_INS]);
else if (HieCod[Hie_CTY] > 0) // Number of posts in institutions forums for a country
DB_QuerySELECT (&mysql_res,"can not get the total number"
" of forums of a type",
"SELECT COUNT(*)," // row[0]
@ -1586,8 +1547,8 @@ unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
" AND ins_instits.CtyCod=%ld"
" AND for_threads.ThrCod=for_posts.ThrCod",
(unsigned) ForumType,
CtyCod);
else // InsCod <= 0 ==> Number of posts in institution forums for the whole platform
HieCod[Hie_CTY]);
else // Number of posts in institution forums for the whole platform
DB_QuerySELECT (&mysql_res,"can not get the total number"
" of forums of a type",
"SELECT COUNT(*)," // row[0]
@ -1600,7 +1561,7 @@ unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
break;
case For_FORUM_CENTER_USRS:
case For_FORUM_CENTER_TCHS:
if (CtrCod > 0) // CtrCod > 0 ==> Number of posts in center forums for a center
if (HieCod[Hie_CTR] > 0) // Number of posts in center forums for a center
DB_QuerySELECT (&mysql_res,"can not get the total number"
" of forums of a type",
"SELECT COUNT(*)," // row[0]
@ -1611,8 +1572,8 @@ unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
" AND for_threads.HieCod=%ld"
" AND for_threads.ThrCod=for_posts.ThrCod",
(unsigned) ForumType,
CtrCod);
else if (InsCod > 0) // CtrCod <= 0 && InsCod > 0 ==> Number of posts in center forums for an institution
HieCod[Hie_CTR]);
else if (HieCod[Hie_INS] > 0) // Number of posts in center forums for an institution
DB_QuerySELECT (&mysql_res,"can not get the total number"
" of forums of a type",
"SELECT COUNT(*)," // row[0]
@ -1625,8 +1586,8 @@ unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
" AND ctr_centers.InsCod=%ld"
" AND for_threads.ThrCod=for_posts.ThrCod",
(unsigned) ForumType,
InsCod);
else if (CtyCod > 0) // InsCod <= 0 && CtyCod > 0 ==> Number of posts in center forums for a country
HieCod[Hie_INS]);
else if (HieCod[Hie_CTY] > 0) // Number of posts in center forums for a country
DB_QuerySELECT (&mysql_res,"can not get the total number"
" of forums of a type",
"SELECT COUNT(*)," // row[0]
@ -1641,8 +1602,8 @@ unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
" AND ins_instits.CtyCod=%ld"
" AND for_threads.ThrCod=for_posts.ThrCod",
(unsigned) ForumType,
CtyCod);
else // InsCod <= 0 ==> Number of posts in center forums for the whole platform
HieCod[Hie_CTY]);
else // Number of posts in center forums for the whole platform
DB_QuerySELECT (&mysql_res,"can not get the total number"
" of forums of a type",
"SELECT COUNT(*)," // row[0]
@ -1655,7 +1616,7 @@ unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
break;
case For_FORUM_DEGREE_USRS:
case For_FORUM_DEGREE_TCHS:
if (DegCod > 0) // DegCod > 0 ==> Number of posts in degree forums for a degree
if (HieCod[Hie_DEG] > 0) // Number of posts in degree forums for a degree
DB_QuerySELECT (&mysql_res,"can not get the total number"
" of forums of a type",
"SELECT COUNT(*)," // row[0]
@ -1666,8 +1627,8 @@ unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
" AND for_threads.HieCod=%ld"
" AND for_threads.ThrCod=for_posts.ThrCod",
(unsigned) ForumType,
DegCod);
else if (CtrCod > 0) // DegCod <= 0 && CtrCod > 0 ==> Number of posts in degree forums for a center
HieCod[Hie_DEG]);
else if (HieCod[Hie_CTR] > 0) // Number of posts in degree forums for a center
DB_QuerySELECT (&mysql_res,"can not get the total number"
" of forums of a type",
"SELECT COUNT(*)," // row[0]
@ -1680,8 +1641,8 @@ unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
" AND deg_degrees.CtrCod=%ld"
" AND for_threads.ThrCod=for_posts.ThrCod",
(unsigned) ForumType,
CtrCod);
else if (InsCod > 0) // CtrCod <= 0 && InsCod > 0 ==> Number of posts in degree forums for an institution
HieCod[Hie_CTR]);
else if (HieCod[Hie_INS] > 0) // Number of posts in degree forums for an institution
DB_QuerySELECT (&mysql_res,"can not get the total number"
" of forums of a type",
"SELECT COUNT(*)," // row[0]
@ -1696,8 +1657,8 @@ unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
" AND ctr_centers.InsCod=%ld"
" AND for_threads.ThrCod=for_posts.ThrCod",
(unsigned) ForumType,
InsCod);
else if (CtyCod > 0) // InsCod <= 0 && CtyCod > 0 ==> Number of posts in degree forums for a country
HieCod[Hie_INS]);
else if (HieCod[Hie_CTY] > 0) // Number of posts in degree forums for a country
DB_QuerySELECT (&mysql_res,"can not get the total number"
" of forums of a type",
"SELECT COUNT(*)," // row[0]
@ -1714,8 +1675,8 @@ unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
" AND ins_instits.CtyCod=%ld"
" AND for_threads.ThrCod=for_posts.ThrCod",
(unsigned) ForumType,
CtyCod);
else // InsCod <= 0 ==> Number of posts in degree forums for the whole platform
HieCod[Hie_CTY]);
else // Number of posts in degree forums for the whole platform
DB_QuerySELECT (&mysql_res,"can not get the total number"
" of forums of a type",
"SELECT COUNT(*)," // row[0]
@ -1728,7 +1689,7 @@ unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
break;
case For_FORUM_COURSE_USRS:
case For_FORUM_COURSE_TCHS:
if (CrsCod > 0) // CrsCod > 0 ==> 0 <= number of posts in course forums for a course
if (HieCod[Hie_CRS] > 0) // Number of posts in course forums for a course
DB_QuerySELECT (&mysql_res,"can not get the total number"
" of forums of a type",
"SELECT COUNT(*)," // row[0]
@ -1739,8 +1700,8 @@ unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
" AND for_threads.HieCod=%ld"
" AND for_threads.ThrCod=for_posts.ThrCod",
(unsigned) ForumType,
CrsCod);
else if (DegCod > 0) // CrsCod <= 0 && DegCod > 0 ==> Number of posts in course forums for a degree
HieCod[Hie_CRS]);
else if (HieCod[Hie_DEG] > 0) // Number of posts in course forums for a degree
DB_QuerySELECT (&mysql_res,"can not get the total number"
" of forums of a type",
"SELECT COUNT(*)," // row[0]
@ -1753,8 +1714,8 @@ unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
" AND crs_courses.DegCod=%ld"
" AND for_threads.ThrCod=for_posts.ThrCod",
(unsigned) ForumType,
DegCod);
else if (CtrCod > 0) // DegCod <= 0 && CtrCod > 0 ==> Number of posts in course forums for a center
HieCod[Hie_DEG]);
else if (HieCod[Hie_CTR] > 0) // Number of posts in course forums for a center
DB_QuerySELECT (&mysql_res,"can not get the total number"
" of forums of a type",
"SELECT COUNT(*)," // row[0]
@ -1769,8 +1730,8 @@ unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
" AND deg_degrees.CtrCod=%ld"
" AND for_threads.ThrCod=for_posts.ThrCod",
(unsigned) ForumType,
CtrCod);
else if (InsCod > 0) // CtrCod <= 0 && InsCod > 0 ==> Number of posts in course forums for an institution
HieCod[Hie_CTR]);
else if (HieCod[Hie_INS] > 0) // Number of posts in course forums for an institution
DB_QuerySELECT (&mysql_res,"can not get the total number"
" of forums of a type",
"SELECT COUNT(*)," // row[0]
@ -1787,8 +1748,8 @@ unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
" AND ctr_centers.InsCod=%ld"
" AND for_threads.ThrCod=for_posts.ThrCod",
(unsigned) ForumType,
InsCod);
else if (CtyCod > 0) // InsCod <= 0 && CtyCod > 0 ==> Number of posts in course forums for a country
HieCod[Hie_INS]);
else if (HieCod[Hie_CTY] > 0) // Number of posts in course forums for a country
DB_QuerySELECT (&mysql_res,"can not get the total number"
" of forums of a type",
"SELECT COUNT(*)," // row[0]
@ -1807,8 +1768,8 @@ unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
" AND ins_instits.CtyCod=%ld"
" AND for_threads.ThrCod=for_posts.ThrCod",
(unsigned) ForumType,
CtyCod);
else // CrsCod <= 0 && DegCod <= 0 && CtrCod <= 0 ==> Number of posts in course forums for the whole platform
HieCod[Hie_CTY]);
else // Number of posts in course forums for the whole platform
DB_QuerySELECT (&mysql_res,"can not get the total number"
" of forums of a type",
"SELECT COUNT(*)," // row[0]

View File

@ -104,23 +104,11 @@ void For_DB_RemoveDisabledPstsInThread (long ThrCod);
//----------------------------- Statistics ------------------------------------
unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
long CtyCod,
long InsCod,
long CtrCod,
long DegCod,
long CrsCod);
long HieCod[Hie_NUM_LEVELS]);
unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
long CtyCod,
long InsCod,
long CtrCod,
long DegCod,
long CrsCod);
long HieCod[Hie_NUM_LEVELS]);
unsigned For_DB_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
long CtyCod,
long InsCod,
long CtrCod,
long DegCod,
long CrsCod,
long HieCod[Hie_NUM_LEVELS],
unsigned *NumUsrsToBeNotifiedByEMail);
#endif