Version 16.45.1

This commit is contained in:
Antonio Cañas Vargas 2016-10-27 19:57:02 +02:00
parent 5db755900c
commit 902437f326
5 changed files with 14 additions and 17 deletions

View File

@ -11679,7 +11679,7 @@ UPDATE surveys SET Cod=CrsCod WHERE Scope='Crs';
DROP INDEX DegCod ON surveys; DROP INDEX DegCod ON surveys;
ALTER TABLE surveys ADD PRIMARY KEY(SvyCod); ALTER TABLE surveys ADD PRIMARY KEY(SvyCod);
DROP INDEX SvyCod ON surveys; DROP INDEX SvyCod ON surveys;
ALTER TABLE surveys ADD UNIQUE INDEX(SvyCod,Scope,Cod,Hidden),ADD INDEX(Scope,Cod,Hidden); ALTER TABLE surveys ADD UNIQUE INDEX(Scope,Cod);
----- TODO: Eliminar columnas sin uso en futuras versiones ----- ----- TODO: Eliminar columnas sin uso en futuras versiones -----

View File

@ -989,8 +989,8 @@ CREATE TABLE IF NOT EXISTS sta_notif (
-- --
CREATE TABLE IF NOT EXISTS surveys ( CREATE TABLE IF NOT EXISTS surveys (
SvyCod INT NOT NULL AUTO_INCREMENT, SvyCod INT NOT NULL AUTO_INCREMENT,
DegCod INT NOT NULL DEFAULT -1, Scope ENUM('Sys','Cty','Ins','Ctr','Deg','Crs') NOT NULL DEFAULT 'Sys',
CrsCod INT NOT NULL DEFAULT -1, Cod INT NOT NULL DEFAULT -1,
Hidden ENUM('N','Y') NOT NULL DEFAULT 'N', Hidden ENUM('N','Y') NOT NULL DEFAULT 'N',
NumNotif INT NOT NULL DEFAULT 0, NumNotif INT NOT NULL DEFAULT 0,
Roles INT NOT NULL DEFAULT 0, Roles INT NOT NULL DEFAULT 0,
@ -1000,7 +1000,7 @@ CREATE TABLE IF NOT EXISTS surveys (
Title VARCHAR(255) NOT NULL, Title VARCHAR(255) NOT NULL,
Txt TEXT NOT NULL, Txt TEXT NOT NULL,
UNIQUE INDEX(SvyCod), UNIQUE INDEX(SvyCod),
INDEX(DegCod,CrsCod,Hidden)); INDEX(Scope,Cod));
-- --
-- Table svy_answers: stores the answers to the surveys -- Table svy_answers: stores the answers to the surveys
-- --

View File

@ -154,15 +154,16 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.45 (2016-10-27)" #define Log_PLATFORM_VERSION "SWAD 16.45.1 (2016-10-27)"
#define CSS_FILE "swad16.32.1.css" #define CSS_FILE "swad16.32.1.css"
#define JS_FILE "swad15.238.1.js" #define JS_FILE "swad15.238.1.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // 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 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
/* /*
Version 16.45.1: Oct 27, 2016 Fixed bugs in surveys. (? lines)
Version 16.45: Oct 27, 2016 Changes in database table for surveys. Not finished. (205927 lines) Version 16.45: Oct 27, 2016 Changes in database table for surveys. Not finished. (205927 lines)
12 changes necessary in database: 10 changes necessary in database:
ALTER TABLE surveys ADD COLUMN Scope ENUM('Sys','Cty','Ins','Ctr','Deg','Crs') NOT NULL DEFAULT 'Sys' AFTER SvyCod; ALTER TABLE surveys ADD COLUMN Scope ENUM('Sys','Cty','Ins','Ctr','Deg','Crs') NOT NULL DEFAULT 'Sys' AFTER SvyCod;
ALTER TABLE surveys ADD COLUMN Cod INT NOT NULL DEFAULT -1 AFTER Scope; ALTER TABLE surveys ADD COLUMN Cod INT NOT NULL DEFAULT -1 AFTER Scope;
@ -175,9 +176,7 @@ UPDATE surveys SET Cod=DegCod WHERE Scope='Deg';
UPDATE surveys SET Cod=CrsCod WHERE Scope='Crs'; UPDATE surveys SET Cod=CrsCod WHERE Scope='Crs';
DROP INDEX DegCod ON surveys; DROP INDEX DegCod ON surveys;
ALTER TABLE surveys ADD PRIMARY KEY(SvyCod); ALTER TABLE surveys ADD INDEX(Scope,Cod);
DROP INDEX SvyCod ON surveys;
ALTER TABLE surveys ADD UNIQUE INDEX(SvyCod,Scope,Cod,Hidden),ADD INDEX(Scope,Cod,Hidden);
Version 16.44: Oct 27, 2016 New scopes (centre, institution, country) of surveys. Not finished. (205826 lines) Version 16.44: Oct 27, 2016 New scopes (centre, institution, country) of surveys. Not finished. (205826 lines)
Version 16.43: Oct 26, 2016 Fixed bugs and code refactoring in scope of surveys. (205537 lines) Version 16.43: Oct 26, 2016 Fixed bugs and code refactoring in scope of surveys. (205537 lines)

View File

@ -2109,8 +2109,6 @@ mysql> DESCRIBE surveys;
"SvyCod INT NOT NULL AUTO_INCREMENT," "SvyCod INT NOT NULL AUTO_INCREMENT,"
"Scope ENUM('Sys','Cty','Ins','Ctr','Deg','Crs') NOT NULL DEFAULT 'Sys'," "Scope ENUM('Sys','Cty','Ins','Ctr','Deg','Crs') NOT NULL DEFAULT 'Sys',"
"Cod INT NOT NULL DEFAULT -1," "Cod INT NOT NULL DEFAULT -1,"
"DegCod INT NOT NULL DEFAULT -1," // TODO: DROP COLUMN
"CrsCod INT NOT NULL DEFAULT -1," // TODO: DROP COLUMN
"Hidden ENUM('N','Y') NOT NULL DEFAULT 'N'," "Hidden ENUM('N','Y') NOT NULL DEFAULT 'N',"
"NumNotif INT NOT NULL DEFAULT 0," "NumNotif INT NOT NULL DEFAULT 0,"
"Roles INT NOT NULL DEFAULT 0," "Roles INT NOT NULL DEFAULT 0,"
@ -2119,9 +2117,8 @@ mysql> DESCRIBE surveys;
"EndTime DATETIME NOT NULL," "EndTime DATETIME NOT NULL,"
"Title VARCHAR(255) NOT NULL," "Title VARCHAR(255) NOT NULL,"
"Txt TEXT NOT NULL," "Txt TEXT NOT NULL,"
"PRIMARY KEY(SvyCod)," "UNIQUE INDEX(SvyCod),"
"UNIQUE INDEX(SvyCod,Scope,Cod,Hidden)," "INDEX(Scope,Cod)");
"INDEX(Scope,Cod,Hidden))");
/***** Table svy_answers *****/ /***** Table svy_answers *****/
/* /*

View File

@ -843,6 +843,7 @@ static void Svy_PutParams (void)
void Svy_GetListSurveys (void) void Svy_GetListSurveys (void)
{ {
extern const char *Sco_ScopeDB[Sco_NUM_SCOPES];
char SubQuery[Sco_NUM_SCOPES][128]; char SubQuery[Sco_NUM_SCOPES][128];
char OrderBySubQuery[256]; char OrderBySubQuery[256];
char Query[2048]; char Query[2048];
@ -872,14 +873,14 @@ void Svy_GetListSurveys (void)
Cods[Sco_SCOPE_CRS] = Gbl.CurrentCrs.Crs.CrsCod; // Course Cods[Sco_SCOPE_CRS] = Gbl.CurrentCrs.Crs.CrsCod; // Course
for (Scope = Sco_SCOPE_SYS, SubQueryFilled = false; for (Scope = Sco_SCOPE_SYS, SubQueryFilled = false;
Scope < Sco_SCOPE_CRS; Scope <= Sco_SCOPE_CRS;
Scope++) Scope++)
if (ScopesAllowed & 1 << Scope) if (ScopesAllowed & 1 << Scope)
{ {
sprintf (SubQuery[Scope],"%s(Scope='%u' AND Cod='%ld'%s)", sprintf (SubQuery[Scope],"%s(Scope='%s' AND Cod='%ld'%s)",
SubQueryFilled ? " OR " : SubQueryFilled ? " OR " :
"", "",
(unsigned) Scope,Cods[Scope], Sco_ScopeDB[Scope],Cods[Scope],
(ScopesAllowed & 1 << Sco_SCOPE_SYS) ? "" : (ScopesAllowed & 1 << Sco_SCOPE_SYS) ? "" :
" AND Hidden='N'"); " AND Hidden='N'");
SubQueryFilled = true; SubQueryFilled = true;