diff --git a/swad_changelog.h b/swad_changelog.h index 1df174d59..8d3367348 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -264,13 +264,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 17.26.1 (2017-11-10)" +#define Log_PLATFORM_VERSION "SWAD 17.26.2 (2017-11-12)" #define CSS_FILE "swad17.25.4.css" #define JS_FILE "swad17.17.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 17.26.2: Nov 12, 2017 Fixed bug in marks, reported by Francisco Ocaņa Lara. (234383 lines) Version 17.26.1: Nov 10, 2017 Default theme is white. (234380 lines) Version 17.26: Nov 08, 2017 Tables converted to MyISAM. Cleaning database. (234379 lines) diff --git a/swad_mark.c b/swad_mark.c index 118c5c44d..1d071d18b 100644 --- a/swad_mark.c +++ b/swad_mark.c @@ -193,10 +193,14 @@ static void Mrk_GetNumRowsHeaderAndFooter (struct MarksProperties *Marks) unsigned long NumRows; /***** Get number of rows of header and footer from database *****/ + /* There should be a single file in database. + If, due to an error, there is more than one file, + get the number of rows of the more recent file. */ sprintf (Query,"SELECT marks_properties.%s,marks_properties.%s" " FROM files,marks_properties" " WHERE files.FileBrowser=%u AND files.Cod=%ld AND files.Path='%s'" - " AND files.FilCod=marks_properties.FilCod", + " AND files.FilCod=marks_properties.FilCod" + " ORDER BY files.FilCod DESC LIMIT 1", // On duplicate entries, get the more recent Mrk_HeadOrFootStr[Brw_HEADER], Mrk_HeadOrFootStr[Brw_FOOTER], (unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type], @@ -218,11 +222,9 @@ static void Mrk_GetNumRowsHeaderAndFooter (struct MarksProperties *Marks) if (sscanf (row[1],"%u",&(Marks->Footer)) != 1) Lay_ShowErrorAndExit ("Wrong number of footer rows."); } - else if (NumRows == 0) // Unknown numbers of header and footer rows + else // Unknown numbers of header and footer rows Marks->Header = Marks->Footer = 0; - else // Number of entries in database > 1 - Lay_ShowErrorAndExit ("Error when getting the number of rows in header and footer."); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res);