From 8bb17ae3ae4b82cafe15317129bb92ca4707608f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Tue, 26 Jul 2016 02:41:31 +0200 Subject: [PATCH] Version 15.246.1 --- swad_attendance.c | 15 ++++++------ swad_changelog.h | 3 ++- swad_mail.c | 59 ++++++++++++++++++++++++----------------------- 3 files changed, 40 insertions(+), 37 deletions(-) diff --git a/swad_attendance.c b/swad_attendance.c index 372763e10..7adf141da 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -1923,12 +1923,13 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att) NumStd < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs; NumStd++) { - UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].UsrCod; - if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // If user's data exist... - { - UsrDat.Accepted = Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].Accepted; - Att_WriteRowStdToCallTheRoll (NumStd + 1,&UsrDat,Att); - } + /* Copy user's basic data from list */ + Usr_CopyBasicUsrDataFromList (&UsrDat,&Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd]); + + /* Get list of user's IDs */ + ID_GetListIDsFromUsrCod (&UsrDat); + + Att_WriteRowStdToCallTheRoll (NumStd + 1,&UsrDat,Att); } /* Send button and end frame */ @@ -2226,7 +2227,7 @@ void Att_RegisterStudentsInAttEvent (void) { Par_GetNextStrUntilSeparParamMult (&Ptr,UsrData.EncryptedUsrCod,Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64); Usr_GetUsrCodFromEncryptedUsrCod (&UsrData); - if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrData)) // Get student's data from the database + if (UsrData.UsrCod > 0) // Student exists in database /***** Mark student to not be removed *****/ for (NumStd = 0; NumStd < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs; diff --git a/swad_changelog.h b/swad_changelog.h index fee6b39c5..4a5e769a3 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -136,13 +136,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.246 (2016-07-26)" +#define Log_PLATFORM_VERSION "SWAD 15.246.1 (2016-07-26)" #define CSS_FILE "swad15.229.css" #define JS_FILE "swad15.238.1.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.246.1: Jul 26, 2016 Attendance of users and e-mail to users use the list filled instead of querying database a second time to get all user's data. (204093 lines) Version 15.246: Jul 26, 2016 Classphoto of users uses the list filled instead of querying database a second time to get all user's data. Origin place is removed from classphoto. (204094 lines) Version 15.245.5: Jul 26, 2016 Fixed bug in user's data. (204116 lines) diff --git a/swad_mail.c b/swad_mail.c index 077122c38..40eff61ad 100644 --- a/swad_mail.c +++ b/swad_mail.c @@ -815,37 +815,38 @@ void Mai_ListEMails (void) NumUsr < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs; NumUsr++) { - UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumUsr].UsrCod; - if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // If user's data exist... - { - UsrDat.Accepted = Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumUsr].Accepted; - if (UsrDat.Email[0]) - { - NumStdsWithEmail++; - if (UsrDat.Accepted) // If student has e-mail and has accepted - { - if (NumAcceptedStdsWithEmail > 0) - { - fprintf (Gbl.F.Out,", "); - LengthStrAddr += 2; - if (LengthStrAddr <= Mai_MAX_LENGTH_STR_ADDR) - strcat (StrAddresses,","); - else - Lay_ShowErrorAndExit ("The space allocated to store e-mail addresses is full."); - } - LengthStrAddr += strlen (UsrDat.Email); - if (LengthStrAddr <= Mai_MAX_LENGTH_STR_ADDR) - strcat (StrAddresses,UsrDat.Email); - else - Lay_ShowErrorAndExit ("The space allocated to store e-mail addresses is full."); + /* Copy user's basic data from list */ + Usr_CopyBasicUsrDataFromList (&UsrDat,&Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumUsr]); - fprintf (Gbl.F.Out,"%s", - UsrDat.Email,Gbl.CurrentCrs.Crs.FullName,UsrDat.Email); + /* Get user's e-mail */ + Mai_GetEmailFromUsrCod (&UsrDat); - NumAcceptedStdsWithEmail++; - } - } - } + if (UsrDat.Email[0]) + { + NumStdsWithEmail++; + if (UsrDat.Accepted) // If student has e-mail and has accepted + { + if (NumAcceptedStdsWithEmail > 0) + { + fprintf (Gbl.F.Out,", "); + LengthStrAddr += 2; + if (LengthStrAddr <= Mai_MAX_LENGTH_STR_ADDR) + strcat (StrAddresses,","); + else + Lay_ShowErrorAndExit ("The space allocated to store e-mail addresses is full."); + } + LengthStrAddr += strlen (UsrDat.Email); + if (LengthStrAddr <= Mai_MAX_LENGTH_STR_ADDR) + strcat (StrAddresses,UsrDat.Email); + else + Lay_ShowErrorAndExit ("The space allocated to store e-mail addresses is full."); + + fprintf (Gbl.F.Out,"%s", + UsrDat.Email,Gbl.CurrentCrs.Crs.FullName,UsrDat.Email); + + NumAcceptedStdsWithEmail++; + } + } } fprintf (Gbl.F.Out,"" "");