Version 14.80.17

This commit is contained in:
Antonio Cañas Vargas 2015-03-09 12:38:52 +01:00
parent 19e1c78bc3
commit 742db58ffb
3 changed files with 82 additions and 41 deletions

View File

@ -103,11 +103,12 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 14.80.16 (2015/03/09)"
#define Log_PLATFORM_VERSION "SWAD 14.80.17 (2015/03/09)"
// 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 | tail -1
/*
Version 14.80.17: Mar 09, 2015 Scope country for statistic of users. (179480 lines)
Version 14.80.16: Mar 09, 2015 Scope country for statistic of degrees and courses. (179439 lines)
Version 14.80.15: Mar 09, 2015 Scope country for statistic of webs / social networks. (179393 lines)
Version 14.80.14: Mar 09, 2015 Scope country for statistic of OERs. (179379 lines)

View File

@ -3781,6 +3781,46 @@ void Sta_ShowUseOfPlatform (void)
}
}
/*****************************************************************************/
/********************** Show stats about number of users *********************/
/*****************************************************************************/
static void Sta_GetAndShowUsersStats (void)
{
extern const char *Txt_STAT_USE_STAT_TYPES[Sta_NUM_TYPES_USE_STATS];
extern const char *Txt_Users;
extern const char *Txt_No_of_users;
extern const char *Txt_Average_number_of_courses_to_which_a_user_belongs;
extern const char *Txt_Average_number_of_users_belonging_to_a_course;
/***** Number of users *****/
Lay_StartRoundFrameTable10 (NULL,2,Txt_STAT_USE_STAT_TYPES[Sta_USERS]);
fprintf (Gbl.F.Out,"<tr>"
"<th class=\"TIT_TBL\" style=\"text-align:right;\">"
"%s"
"</th>"
"<th class=\"TIT_TBL\" style=\"text-align:right;\">"
"%s"
"</th>"
"<th class=\"TIT_TBL\" style=\"text-align:right;\">"
"%s"
"</th>"
"<th class=\"TIT_TBL\" style=\"text-align:right;\">"
"%s"
"</th>"
"</tr>",
Txt_Users,
Txt_No_of_users,
Txt_Average_number_of_courses_to_which_a_user_belongs,
Txt_Average_number_of_users_belonging_to_a_course);
Usr_GetAndShowNumUsrsInPlatform (Rol_ROLE_STUDENT);
Usr_GetAndShowNumUsrsInPlatform (Rol_ROLE_TEACHER);
Usr_GetAndShowNumUsrsInPlatform (Rol_ROLE_GUEST__); // Users not beloging to any course
Lay_EndRoundFrameTable10 ();
}
/*****************************************************************************/
/*************** Get and show stats about degrees and courses ****************/
/*****************************************************************************/
@ -4485,46 +4525,6 @@ unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role)
return (unsigned) DB_QueryCOUNT (Query,"can not get number of users");
}
/*****************************************************************************/
/********************** Show stats about number of users *********************/
/*****************************************************************************/
static void Sta_GetAndShowUsersStats (void)
{
extern const char *Txt_STAT_USE_STAT_TYPES[Sta_NUM_TYPES_USE_STATS];
extern const char *Txt_Users;
extern const char *Txt_No_of_users;
extern const char *Txt_Average_number_of_courses_to_which_a_user_belongs;
extern const char *Txt_Average_number_of_users_belonging_to_a_course;
/***** Number of users *****/
Lay_StartRoundFrameTable10 (NULL,2,Txt_STAT_USE_STAT_TYPES[Sta_USERS]);
fprintf (Gbl.F.Out,"<tr>"
"<th class=\"TIT_TBL\" style=\"text-align:right;\">"
"%s"
"</th>"
"<th class=\"TIT_TBL\" style=\"text-align:right;\">"
"%s"
"</th>"
"<th class=\"TIT_TBL\" style=\"text-align:right;\">"
"%s"
"</th>"
"<th class=\"TIT_TBL\" style=\"text-align:right;\">"
"%s"
"</th>"
"</tr>",
Txt_Users,
Txt_No_of_users,
Txt_Average_number_of_courses_to_which_a_user_belongs,
Txt_Average_number_of_users_belonging_to_a_course);
Usr_GetAndShowNumUsrsInPlatform (Rol_ROLE_STUDENT);
Usr_GetAndShowNumUsrsInPlatform (Rol_ROLE_TEACHER);
Usr_GetAndShowNumUsrsInPlatform (Rol_ROLE_GUEST__); // Users not beloging to any course
Lay_EndRoundFrameTable10 ();
}
/*****************************************************************************/
/********************* Show stats about exploration trees ********************/
/*****************************************************************************/

View File

@ -7146,6 +7146,18 @@ static unsigned Usr_GetNumUsrsBelongingToAnyCrs (Rol_Role_t Role)
" WHERE Role='%u'",
(unsigned) Role);
break;
case Sco_SCOPE_CTY:
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
" FROM institutions,centres,degrees,courses,crs_usr"
" WHERE institutions.CtyCod='%ld'"
" AND institutions.InsCod=centres.InsCod"
" AND centres.CtrCod=degrees.CtrCod"
" AND degrees.DegCod=courses.DegCod"
" AND courses.CrsCod=crs_usr.CrsCod"
" AND crs_usr.Role='%u'",
Gbl.CurrentCty.Cty.CtyCod,
(unsigned) Role);
break;
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
" FROM centres,degrees,courses,crs_usr"
@ -7212,6 +7224,20 @@ static float Usr_GetNumCrssPerUsr (Rol_Role_t Role)
" WHERE Role='%u' GROUP BY UsrCod) AS NumCrssTable",
(unsigned) Role);
break;
case Sco_SCOPE_CTY:
sprintf (Query,"SELECT AVG(NumCrss) FROM "
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
" FROM institutions,centres,degrees,courses,crs_usr"
" WHERE institutions.CtyCod='%ld'"
" AND institutions.InsCod=centres.InsCod"
" AND centres.CtrCod=degrees.CtrCod"
" AND degrees.DegCod=courses.DegCod"
" AND courses.CrsCod=crs_usr.CrsCod"
" AND crs_usr.Role='%u'"
" GROUP BY crs_usr.UsrCod) AS NumCrssTable",
Gbl.CurrentCty.Cty.CtyCod,
(unsigned) Role);
break;
case Sco_SCOPE_INS:
sprintf (Query,"SELECT AVG(NumCrss) FROM "
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
@ -7287,6 +7313,20 @@ static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role)
" WHERE Role='%u' GROUP BY CrsCod) AS NumUsrsTable",
(unsigned) Role);
break;
case Sco_SCOPE_CTY:
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
" FROM institutions,centres,degrees,courses,crs_usr"
" WHERE institutions.CtyCod='%ld'"
" AND institutions.InsCod=centres.InsCod"
" AND centres.CtrCod=degrees.CtrCod"
" AND degrees.DegCod=courses.DegCod"
" AND courses.CrsCod=crs_usr.CrsCod"
" AND crs_usr.Role='%u'"
" GROUP BY crs_usr.CrsCod) AS NumUsrsTable",
Gbl.CurrentCty.Cty.CtyCod,
(unsigned) Role);
break;
case Sco_SCOPE_INS:
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"