mirror of https://github.com/acanas/swad-core.git
Version 21.28.1: Oct 10, 2021 Code refactoring in projects.
This commit is contained in:
parent
e7020b8a21
commit
07931f57db
|
@ -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 21.28 (2021-10-09)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 21.28.1 (2021-10-10)"
|
||||
#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 21.28.1: Oct 10, 2021 Code refactoring in projects. (318975 lines)
|
||||
Version 21.28: Oct 09, 2021 New module swad_program_database for database queries related to course program. (319013 lines)
|
||||
Version 21.27.1: Oct 07, 2021 Queries moved to module swad_profile_database. (318855 lines)
|
||||
Version 21.27: Oct 07, 2021 New module swad_profile_database for database queries related to user's public profile. (318846 lines)
|
||||
|
|
|
@ -1928,8 +1928,8 @@ static void Fig_GetAndShowProjectsStats (void)
|
|||
double NumProjectsPerCourse = 0.0;
|
||||
|
||||
/***** Get the number of projects from this location *****/
|
||||
if ((NumProjects = Prj_GetNumProjects (Gbl.Scope.Current)))
|
||||
if ((NumCoursesWithProjects = Prj_GetNumCoursesWithProjects (Gbl.Scope.Current)) != 0)
|
||||
if ((NumProjects = Prj_DB_GetNumProjects (Gbl.Scope.Current)))
|
||||
if ((NumCoursesWithProjects = Prj_DB_GetNumCoursesWithProjects (Gbl.Scope.Current)) != 0)
|
||||
NumProjectsPerCourse = (double) NumProjects /
|
||||
(double) NumCoursesWithProjects;
|
||||
|
||||
|
|
|
@ -1360,51 +1360,19 @@ Bottom.End: | 49| 222|-->|-->-49| 222| | -49| 222|-->|--> 26| 2
|
|||
*/
|
||||
/* Step 1: Change all indexes involved to negative,
|
||||
necessary to preserve unique index (CrsCod,ItmInd) */
|
||||
Prg_DB_UpdateIndexRange ( (long) 0 ,
|
||||
(long) Top.Begin ,
|
||||
(long) Bottom.End ); // All indexes in both parts
|
||||
/*
|
||||
DB_QueryUPDATE ("can not exchange indexes of items",
|
||||
"UPDATE prg_items"
|
||||
" SET ItmInd=-ItmInd"
|
||||
" WHERE CrsCod=%ld"
|
||||
" AND ItmInd>=%u"
|
||||
" AND ItmInd<=%u",
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
Top.Begin,
|
||||
Bottom.End); // All indexes in both parts */
|
||||
Prg_DB_UpdateIndexRange ( (long) 0 , // ItmInd=-ItmInd
|
||||
(long) Top.Begin ,
|
||||
(long) Bottom.End ); // All indexes in both parts
|
||||
|
||||
/* Step 2: Increase top indexes */
|
||||
Prg_DB_UpdateIndexRange ( (long) DiffEnd ,
|
||||
-((long) Top.End ),
|
||||
-((long) Top.Begin)); // All indexes in top part
|
||||
/*
|
||||
DB_QueryUPDATE ("can not exchange indexes of items",
|
||||
"UPDATE prg_items"
|
||||
" SET ItmInd=-ItmInd+%u"
|
||||
" WHERE CrsCod=%ld"
|
||||
" AND ItmInd>=-%u"
|
||||
" AND ItmInd<=-%u",
|
||||
DiffEnd,
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
Top.End,
|
||||
Top.Begin); // All indexes in top part */
|
||||
Prg_DB_UpdateIndexRange ( (long) DiffEnd , // ItmInd=-ItmInd+DiffEnd
|
||||
-((long) Top.End ),
|
||||
-((long) Top.Begin )); // All indexes in top part
|
||||
|
||||
/* Step 3: Decrease bottom indexes */
|
||||
Prg_DB_UpdateIndexRange (-((long) DiffBegin ),
|
||||
Prg_DB_UpdateIndexRange (-((long) DiffBegin ), // ItmInd=-ItmInd-DiffBegin
|
||||
-((long) Bottom.End ),
|
||||
-((long) Bottom.Begin)); // All indexes in bottom part
|
||||
/*
|
||||
DB_QueryUPDATE ("can not exchange indexes of items",
|
||||
"UPDATE prg_items"
|
||||
" SET ItmInd=-ItmInd-%u"
|
||||
" WHERE CrsCod=%ld"
|
||||
" AND ItmInd>=-%u"
|
||||
" AND ItmInd<=-%u",
|
||||
DiffBegin,
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
Bottom.End,
|
||||
Bottom.Begin); // All indexes in bottom part */
|
||||
|
||||
/***** Unlock table *****/
|
||||
Prg_DB_UnlockTable ();
|
||||
|
|
1063
swad_project.c
1063
swad_project.c
File diff suppressed because it is too large
Load Diff
|
@ -238,7 +238,7 @@ void Prj_UnloProjectEdition (void);
|
|||
void Prj_RemoveCrsProjects (long CrsCod);
|
||||
void Prj_RemoveUsrFromProjects (long UsrCod);
|
||||
|
||||
unsigned Prj_GetNumCoursesWithProjects (HieLvl_Level_t Scope);
|
||||
unsigned Prj_GetNumProjects (HieLvl_Level_t Scope);
|
||||
unsigned Prj_DB_GetNumCoursesWithProjects (HieLvl_Level_t Scope);
|
||||
unsigned Prj_DB_GetNumProjects (HieLvl_Level_t Scope);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue