From 30966b4471ca2cdabc54a5acbb9d0ce657a49089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sat, 29 Feb 2020 11:38:50 +0100 Subject: [PATCH] Version19.136.1 --- swad_changelog.h | 3 ++- swad_program.c | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 2226e2206..4c4c0137e 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -497,7 +497,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.136 (2020-02-27)" +#define Log_PLATFORM_VERSION "SWAD 19.136.1 (2020-02-29)" #define CSS_FILE "swad19.136.css" #define JS_FILE "swad19.91.1.js" /* @@ -523,6 +523,7 @@ Param // TODO: Miguel Damas: por defecto, marcar "Permitir que los profesores..." en los test (que ya esté marcado en lugar de desmarcado) // TODO: Si el alumno ha marcado "Permitir que los profesores...", entonces pedir confirmación al pulsar el botón azul, para evitar que se envíe por error antes de tiempo + Version 19.136.1: Feb 29, 2020 Fixed bugs in course program. (282301 lines) Version 19.136: Feb 27, 2020 Indent items in course program. (282292 lines) 3 changes necessary in database: DROP INDEX CrsCod ON prg_items; diff --git a/swad_program.c b/swad_program.c index 20855dafe..5fa3059cf 100644 --- a/swad_program.c +++ b/swad_program.c @@ -1345,12 +1345,20 @@ static unsigned Prg_GetNextIndexNotChild (const struct ProgramItem *Item) static void Prg_MoveItemAndChildrenToRight (unsigned Index,unsigned NextIndex) { - DB_QueryUPDATE ("can not update items", - "UPDATE prg_items SET Level=Level+1" - " WHERE CrsCod=%ld" - " AND ItmInd>=%u AND ItmInd<%u", - Gbl.Hierarchy.Crs.CrsCod, - Index,NextIndex); + if (NextIndex == 0) // At the end, no more not-children items + DB_QueryUPDATE ("can not move to right (ident)", + "UPDATE prg_items SET Level=Level+1" + " WHERE CrsCod=%ld" + " AND ItmInd>=%u", + Gbl.Hierarchy.Crs.CrsCod, + Index); + else + DB_QueryUPDATE ("can not move to right (ident)", + "UPDATE prg_items SET Level=Level+1" + " WHERE CrsCod=%ld" + " AND ItmInd>=%u AND ItmInd<%u", + Gbl.Hierarchy.Crs.CrsCod, + Index,NextIndex); } /*****************************************************************************/