From 719df886c8eb189149225ea367729afba6e4821b Mon Sep 17 00:00:00 2001 From: acanas Date: Sun, 12 Sep 2021 14:20:24 +0200 Subject: [PATCH] =?UTF-8?q?Version=2020.100.5:=20Sep=2012,=202021=20=20Fix?= =?UTF-8?q?ed=20bug=20removing=20all=20students=20in=20a=20course.=20Repor?= =?UTF-8?q?ted=20by=20Jos=C3=A9=20Luis=20Bernier=20Villamor=20and=20Franci?= =?UTF-8?q?sco=20J.=20Pelayo=20Valle.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- swad_admin.c | 29 ----------------------------- swad_changelog.h | 3 ++- swad_enrolment.c | 3 ++- swad_exam_database.c | 1 + swad_institution_database.c | 1 + swad_record.c | 4 ++-- swad_user.c | 3 +-- 7 files changed, 9 insertions(+), 35 deletions(-) diff --git a/swad_admin.c b/swad_admin.c index 1a9589b0e..339f55f4d 100644 --- a/swad_admin.c +++ b/swad_admin.c @@ -25,38 +25,9 @@ /*********************************** Headers *********************************/ /*****************************************************************************/ -// #define _GNU_SOURCE // For asprintf -// #include // For asprintf -// #include // For exit, system, malloc, free, rand, etc. -// #include // For string functions - -// #include "swad_account.h" -// #include "swad_account_database.h" #include "swad_admin.h" #include "swad_admin_database.h" -// #include "swad_announcement.h" -// #include "swad_attendance_database.h" -// #include "swad_box.h" -// #include "swad_database.h" -// #include "swad_duplicate.h" -// #include "swad_enrolment.h" -// #include "swad_enrolment_database.h" -// #include "swad_error.h" -// #include "swad_exam_print.h" -// #include "swad_form.h" #include "swad_global.h" -// #include "swad_hierarchy.h" -// #include "swad_HTML.h" -// #include "swad_ID.h" -// #include "swad_match.h" -// #include "swad_message.h" -// #include "swad_notification.h" -// #include "swad_parameter.h" -// #include "swad_photo.h" -// #include "swad_role.h" -// #include "swad_setting.h" -// #include "swad_test_print.h" -// #include "swad_user.h" /*****************************************************************************/ /****************************** Public constants *****************************/ diff --git a/swad_changelog.h b/swad_changelog.h index 92787d19a..9de562e25 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo. */ -#define Log_PLATFORM_VERSION "SWAD 20.100.4 (2021-09-11)" +#define Log_PLATFORM_VERSION "SWAD 20.100.5 (2021-09-12)" #define CSS_FILE "swad20.45.css" #define JS_FILE "swad20.69.1.js" /* TODO: Rename CENTRE to CENTER in help wiki. TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams + Version 20.100.5: Sep 12, 2021 Fixed bug removing all students in a course. Reported by José Luis Bernier Villamor and Francisco J. Pelayo Valle. (314909 lines) Version 20.100.4: Sep 11, 2021 Queries moved to module swad_timeline_database. (314934 lines) Version 20.100.3: Sep 11, 2021 Queries moved to module swad_file_browser. (314923 lines) Version 20.100.2: Sep 11, 2021 Queries moved to module swad_institution_database. (314919 lines) diff --git a/swad_enrolment.c b/swad_enrolment.c index 8cd7b08c1..8f54e714f 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -1798,7 +1798,7 @@ void Enr_RemAllStdsThisCrs (void) /*****************************************************************************/ /***************** Remove all the students from a given course ***************/ /*****************************************************************************/ -// Returns the numbers of students in the course before deletion +// Returns the numbers of students in list unsigned Enr_RemAllStdsInCrs (struct Crs_Course *Crs) { @@ -1816,6 +1816,7 @@ unsigned Enr_RemAllStdsInCrs (struct Crs_Course *Crs) NumUsr++) { Gbl.Usrs.Other.UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr].UsrCod; + Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs = Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr].RoleInCurrentCrsDB; Enr_EffectivelyRemUsrFromCrs (&Gbl.Usrs.Other.UsrDat,Crs, Enr_REMOVE_USR_PRODUCTION, Cns_QUIET); diff --git a/swad_exam_database.c b/swad_exam_database.c index 9040d3e17..2b514e1df 100644 --- a/swad_exam_database.c +++ b/swad_exam_database.c @@ -27,6 +27,7 @@ #define _GNU_SOURCE // For asprintf #include // For asprintf +#include // For exit, system, malloc, free, rand, etc. #include "swad_database.h" #include "swad_error.h" diff --git a/swad_institution_database.c b/swad_institution_database.c index 73ea672a7..df9dd4afa 100644 --- a/swad_institution_database.c +++ b/swad_institution_database.c @@ -27,6 +27,7 @@ #define _GNU_SOURCE // For asprintf #include // For asprintf +#include // For exit, system, malloc, free, rand, etc. #include "swad_database.h" #include "swad_error.h" diff --git a/swad_record.c b/swad_record.c index 495b602e6..e9ced8b5d 100644 --- a/swad_record.c +++ b/swad_record.c @@ -2071,11 +2071,11 @@ void Rec_ShowFormSignUpInCrsWithMySharedRecord (void) void Rec_ShowFormOtherNewSharedRecord (struct UsrData *UsrDat,Rol_Role_t DefaultRole) { /***** Show the form *****/ - /* In this case UsrDat->Roles.InCurrentCrsDB + /* In this case UsrDat->Roles.InCurrentCrs is not the current role in current course. Instead it is initialized with the preferred role. */ UsrDat->Roles.InCurrentCrs = (Gbl.Hierarchy.Level == HieLvl_CRS) ? DefaultRole : // Course selected - Rol_UNK; // No course selected + Rol_UNK; // No course selected Rec_ShowSharedUsrRecord (Rec_SHA_OTHER_NEW_USR_FORM,UsrDat,NULL); } diff --git a/swad_user.c b/swad_user.c index b20801fe0..3115140f4 100644 --- a/swad_user.c +++ b/swad_user.c @@ -597,13 +597,12 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat, { case Usr_DONT_GET_ROLE_IN_CURRENT_CRS: UsrDat->Roles.InCurrentCrs = Rol_UNK; - UsrDat->Roles.InCrss = -1; + UsrDat->Roles.InCrss = -1; // Force roles to be got from database break; case Usr_GET_ROLE_IN_CURRENT_CRS: UsrDat->Roles.InCurrentCrs = Rol_GetRoleUsrInCrs (UsrDat->UsrCod, Gbl.Hierarchy.Crs.CrsCod); UsrDat->Roles.InCrss = -1; // Force roles to be got from database - // Rol_GetRolesInAllCrss (UsrDat); break; }