diff --git a/swad_changelog.h b/swad_changelog.h index e80ebe29d..eaf8ca84d 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -139,13 +139,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.208.4 (2016-05-05)" +#define Log_PLATFORM_VERSION "SWAD 15.208.5 (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.5: May 05, 2016 Changes in Statistics > Degrees. (201469 lines) 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) diff --git a/swad_photo.c b/swad_photo.c index f9d035852..cda0635dd 100644 --- a/swad_photo.c +++ b/swad_photo.c @@ -121,7 +121,10 @@ static void Pho_BuildQueryOfDegrees (char *Query); static void Pho_GetNumStdsInDegree (long DegCod,Usr_Sex_t Sex,int *NumStds,int *NumStdsWithPhoto); static void Pho_UpdateDegStats (long DegCod,Usr_Sex_t Sex,unsigned NumStds,unsigned NumStdsWithPhoto,long TimeToComputeAvgPhoto); static void Pho_ShowDegreeStat (int NumStds,int NumStdsWithPhoto); -static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg,Pho_AvgPhotoSeeOrPrint_t SeeOrPrint,Usr_Sex_t Sex,int NumStds,int NumStdsWithPhoto); +static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg, + Pho_AvgPhotoSeeOrPrint_t SeeOrPrint, + Usr_Sex_t Sex, + int NumStds,int NumStdsWithPhoto); static void Pho_ComputePhotoSize (int NumStds,int NumStdsWithPhoto,unsigned *PhotoWidth,unsigned *PhotoHeight); /*****************************************************************************/ @@ -1926,7 +1929,6 @@ static void Pho_ShowOrPrintClassPhotoDegrees (Pho_AvgPhotoSeeOrPrint_t SeeOrPrin unsigned NumDegsNotEmpty; int NumStds; int NumStdsWithPhoto; - bool ShowDegPhoto; bool TRIsOpen = false; /***** Get degrees from database *****/ @@ -1962,13 +1964,8 @@ 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 (ShowDegPhoto) + if (NumStds > 0) { if ((NumDegsNotEmpty % Gbl.Usrs.ClassPhoto.Cols) == 0) { @@ -2239,7 +2236,10 @@ static void Pho_ShowDegreeStat (int NumStds,int NumStdsWithPhoto) /******************* Show the average photo of a degree **********************/ /*****************************************************************************/ -static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg,Pho_AvgPhotoSeeOrPrint_t SeeOrPrint,Usr_Sex_t Sex,int NumStds,int NumStdsWithPhoto) +static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg, + Pho_AvgPhotoSeeOrPrint_t SeeOrPrint, + Usr_Sex_t Sex, + int NumStds,int NumStdsWithPhoto) { extern const char *Usr_StringsSexDB[Usr_NUM_SEXS]; extern const char *Txt_students_ABBREVIATION; @@ -2251,6 +2251,7 @@ static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg,Pho_AvgPhotoSeeOrP char PhotoURL[PATH_MAX+1]; char CopyOfDegShortName[Deg_MAX_LENGTH_DEGREE_SHORT_NAME+1]; // Short name of degree char PhotoCaption[512]; + bool ShowDegPhoto; /***** Compute photo width and height to be proportional to number of students *****/ Pho_ComputePhotoSize (NumStds,NumStdsWithPhoto,&PhotoWidth,&PhotoHeight); @@ -2262,12 +2263,21 @@ static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg,Pho_AvgPhotoSeeOrP SeeOrPrint == Pho_DEGREES_SEE ? 10 : 15); + /***** Put link to degree *****/ if (SeeOrPrint == Pho_DEGREES_SEE) fprintf (Gbl.F.Out,"", Deg->WWW,Deg->FullName); - fprintf (Gbl.F.Out," 0); + else + ShowDegPhoto = (NumStds > 0 && + NumStdsWithPhoto >= Cfg_MIN_PHOTOS_TO_SHOW_AVERAGE); + + /***** Show photo *****/ + fprintf (Gbl.F.Out,"\"%s\"", Deg->ShortName, Deg->FullName); + + /***** Caption *****/ if (SeeOrPrint == Pho_DEGREES_PRINT) fprintf (Gbl.F.Out,""); fprintf (Gbl.F.Out,"
%s
%d %s
%d %s
(%d%%)",