mirror of https://github.com/acanas/swad-core.git
Version 15.208.4
This commit is contained in:
parent
521425f05b
commit
d86ac2c531
|
@ -132,18 +132,21 @@
|
|||
// TODO: In listing of courses, teachers column is before than students column. In edition of courses, students column is before teachers column.
|
||||
// TODO: List exam announcement as a list, like assignments. When clicking on an announcement, it will be shown alone, as now.
|
||||
// TODO: Check value returned by setlocale in all calls
|
||||
// TODO: Integrate "Configure" link in tests at top of window, near "Edit" icon.
|
||||
// TODO: Write "Tab > Action" in title of text in most frequent actions
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.208.3 (2016-05-03)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.208.4 (2016-05-05)"
|
||||
#define CSS_FILE "swad15.204.1.css"
|
||||
#define JS_FILE "swad15.197.js"
|
||||
|
||||
// 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
|
||||
/*
|
||||
Version 15.208.4: May 05, 2016 In Statistics > Degrees, show all degrees with students. (201458 lines)
|
||||
Version 15.208.3: May 03, 2016 Fixed bug in sessions database table when no social publishings available. (201446 lines)
|
||||
Version 15.208.2: May 01, 2016 Add default values in some database fields. (201439 lines)
|
||||
1 change necessary in database:
|
||||
|
|
|
@ -232,7 +232,7 @@
|
|||
#define Cfg_PLATFORM_LOGO_SMALL_FILENAME "swad64x64.png" // Logo displayed in the top of the page
|
||||
#define Cfg_PLATFORM_LOGO_SMALL_WIDTH 40
|
||||
#define Cfg_PLATFORM_LOGO_SMALL_HEIGHT 40
|
||||
#define Cfg_PLATFORM_LOGO_BIG_FILENAME "swad212x40.png"
|
||||
#define Cfg_PLATFORM_LOGO_BIG_FILENAME "SWADberry212x40.png"
|
||||
#define Cfg_PLATFORM_LOGO_BIG_WIDTH 212
|
||||
#define Cfg_PLATFORM_LOGO_BIG_HEIGHT 40
|
||||
|
||||
|
@ -286,7 +286,7 @@
|
|||
/* Users */
|
||||
#define Cfg_MAX_USRS_IN_LIST 20000 // If the number of users in a list is greater than this, don't show the list
|
||||
#define Cfg_MIN_NUM_USERS_TO_CONFIRM_SHOW_BIG_LIST 500 // If the number of users in a list is greater than this, ask me for confirmation before showing the list
|
||||
#define Cfg_MIN_PHOTOS_TO_COMPUTE_AVERAGE 10 // If the number of students with photo in a degree is less than this, don't show average photo of the degree
|
||||
#define Cfg_MIN_PHOTOS_TO_SHOW_AVERAGE 10 // If the number of students with photo in a degree is less than this, don't show average photo of the degree
|
||||
#define Cfg_MAX_RECIPIENTS 250 // A student can not send a message to more than this number of recipients
|
||||
#define Cfg_MAX_CONNECTED_SHOWN 15 // Show (in right column) only these connected users with more recent activity
|
||||
|
||||
|
|
85
swad_photo.c
85
swad_photo.c
|
@ -1426,47 +1426,46 @@ static void Pho_ComputeAveragePhoto (long DegCod,Usr_Sex_t Sex,struct ListUsers
|
|||
if (Fil_CheckIfPathExists (PathRelAvgPhoto)) // If file exists
|
||||
unlink (PathRelAvgPhoto);
|
||||
|
||||
if (LstUsrs->NumUsrs >= Cfg_MIN_PHOTOS_TO_COMPUTE_AVERAGE)
|
||||
/***** Build names for text file with photo paths *****/
|
||||
sprintf (FileNamePhotoNames,"%s/%s/%s/%ld.txt",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,Cfg_FOLDER_PHOTO_TMP,DegCod);
|
||||
if ((FilePhotoNames = fopen (FileNamePhotoNames,"wb")) == NULL)
|
||||
Lay_ShowErrorAndExit ("Can not open file to compute average photo.");
|
||||
|
||||
/***** Loop writing file names in text file *****/
|
||||
for (NumUsr = 0;
|
||||
NumUsr < LstUsrs->NumUsrs;
|
||||
NumUsr++)
|
||||
{
|
||||
/***** Build names for text file with photo paths *****/
|
||||
sprintf (FileNamePhotoNames,"%s/%s/%s/%ld.txt",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,Cfg_FOLDER_PHOTO_TMP,DegCod);
|
||||
if ((FilePhotoNames = fopen (FileNamePhotoNames,"wb")) == NULL)
|
||||
Lay_ShowErrorAndExit ("Can not open file to compute average photo.");
|
||||
Gbl.Usrs.Other.UsrDat.Sex = LstUsrs->Lst[NumUsr].Sex;
|
||||
if (Sex == Usr_SEX_ALL || Sex == Gbl.Usrs.Other.UsrDat.Sex)
|
||||
{
|
||||
(*NumStds)++;
|
||||
|
||||
/***** Loop writing file names in text file *****/
|
||||
for (NumUsr = 0;
|
||||
NumUsr < LstUsrs->NumUsrs;
|
||||
NumUsr++)
|
||||
{
|
||||
Gbl.Usrs.Other.UsrDat.Sex = LstUsrs->Lst[NumUsr].Sex;
|
||||
if (Sex == Usr_SEX_ALL || Sex == Gbl.Usrs.Other.UsrDat.Sex)
|
||||
{
|
||||
(*NumStds)++;
|
||||
/***** Add photo to file for average face calculation *****/
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod = LstUsrs->Lst[NumUsr].UsrCod;
|
||||
if (Pho_CheckIfPrivPhotoExists (Gbl.Usrs.Other.UsrDat.UsrCod,PathPrivRelPhoto))
|
||||
{
|
||||
(*NumStdsWithPhoto)++;
|
||||
fprintf (FilePhotoNames,"%s\n",PathPrivRelPhoto);
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose (FilePhotoNames);
|
||||
|
||||
/***** Add photo to file for average face calculation *****/
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod = LstUsrs->Lst[NumUsr].UsrCod;
|
||||
if (Pho_CheckIfPrivPhotoExists (Gbl.Usrs.Other.UsrDat.UsrCod,PathPrivRelPhoto))
|
||||
{
|
||||
(*NumStdsWithPhoto)++;
|
||||
fprintf (FilePhotoNames,"%s\n",PathPrivRelPhoto);
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose (FilePhotoNames);
|
||||
/***** Call to program to calculate average photo *****/
|
||||
if (*NumStdsWithPhoto)
|
||||
{
|
||||
sprintf (StrCallToProgram,"%s %s %s",
|
||||
Pho_StrAvgPhotoPrograms[TypeOfAverage],
|
||||
FileNamePhotoNames,PathRelAvgPhoto);
|
||||
ReturnCode = system (StrCallToProgram);
|
||||
if (ReturnCode == -1)
|
||||
Lay_ShowErrorAndExit ("Error when running program that computes the average photo.");
|
||||
|
||||
/***** Call to program to calculate average photo *****/
|
||||
if (*NumStdsWithPhoto >= Cfg_MIN_PHOTOS_TO_COMPUTE_AVERAGE)
|
||||
{
|
||||
sprintf (StrCallToProgram,"%s %s %s",Pho_StrAvgPhotoPrograms[TypeOfAverage],FileNamePhotoNames,PathRelAvgPhoto);
|
||||
ReturnCode = system (StrCallToProgram);
|
||||
if (ReturnCode == -1)
|
||||
Lay_ShowErrorAndExit ("Error when running program that computes the average photo.");
|
||||
|
||||
/* Write message depending on the return code */
|
||||
if (WEXITSTATUS(ReturnCode))
|
||||
Lay_ShowErrorAndExit ("The average photo has not been computed successfully.");
|
||||
}
|
||||
/* Write message depending on the return code */
|
||||
if (WEXITSTATUS(ReturnCode))
|
||||
Lay_ShowErrorAndExit ("The average photo has not been computed successfully.");
|
||||
}
|
||||
|
||||
/***** Time used to compute the stats of this degree *****/
|
||||
|
@ -1545,7 +1544,9 @@ void Pho_ShowOrPrintPhotoDegree (Pho_AvgPhotoSeeOrPrint_t SeeOrPrint)
|
|||
Pho_PutLinkToCalculateDegreeStats ();
|
||||
}
|
||||
|
||||
/***** Get maximum number of students and maximum number of students with photo in all degrees *****/
|
||||
/***** Get maximum number of students
|
||||
and maximum number of students with photo
|
||||
in all degrees *****/
|
||||
Pho_GetMaxStdsPerDegree ();
|
||||
|
||||
/***** Draw the classphoto/list *****/
|
||||
|
@ -1925,6 +1926,7 @@ static void Pho_ShowOrPrintClassPhotoDegrees (Pho_AvgPhotoSeeOrPrint_t SeeOrPrin
|
|||
unsigned NumDegsNotEmpty;
|
||||
int NumStds;
|
||||
int NumStdsWithPhoto;
|
||||
bool ShowDegPhoto;
|
||||
bool TRIsOpen = false;
|
||||
|
||||
/***** Get degrees from database *****/
|
||||
|
@ -1960,8 +1962,13 @@ static void Pho_ShowOrPrintClassPhotoDegrees (Pho_AvgPhotoSeeOrPrint_t SeeOrPrin
|
|||
|
||||
/* Get number of students and number of students with photo in this degree */
|
||||
Pho_GetNumStdsInDegree (Deg.DegCod,Usr_SEX_ALL,&NumStds,&NumStdsWithPhoto);
|
||||
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||
ShowDegPhoto = (NumStds > 0);
|
||||
else
|
||||
ShowDegPhoto = (NumStds > 0 &&
|
||||
NumStdsWithPhoto >= Cfg_MIN_PHOTOS_TO_SHOW_AVERAGE);
|
||||
|
||||
if (NumStds > 0)
|
||||
if (ShowDegPhoto)
|
||||
{
|
||||
if ((NumDegsNotEmpty % Gbl.Usrs.ClassPhoto.Cols) == 0)
|
||||
{
|
||||
|
|
|
@ -4407,7 +4407,9 @@ void Usr_GetUnorderedStdsCodesInDeg (long DegCod)
|
|||
/***** Get the students in a degree from database *****/
|
||||
sprintf (Query,"SELECT DISTINCT crs_usr.UsrCod,'N',usr_data.Sex"
|
||||
" FROM courses,crs_usr,usr_data"
|
||||
" WHERE courses.DegCod='%ld' AND courses.CrsCod=crs_usr.CrsCod AND crs_usr.Role='%u'"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role='%u'"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod",
|
||||
DegCod,(unsigned) Rol_STUDENT);
|
||||
|
||||
|
|
Loading…
Reference in New Issue