diff --git a/icon/iconset/awesome/house-user.svg b/icon/iconset/awesome/house-user.svg
new file mode 100644
index 00000000..548a1723
--- /dev/null
+++ b/icon/iconset/awesome/house-user.svg
@@ -0,0 +1 @@
+
diff --git a/icon/iconset/awesome/user-circle.svg b/icon/iconset/awesome/user-circle.svg
new file mode 100644
index 00000000..093ee6ed
--- /dev/null
+++ b/icon/iconset/awesome/user-circle.svg
@@ -0,0 +1 @@
+
diff --git a/icon/iconset/nuvola/file-contract.svg b/icon/iconset/nuvola/file-contract.svg
new file mode 100644
index 00000000..38384952
--- /dev/null
+++ b/icon/iconset/nuvola/file-contract.svg
@@ -0,0 +1,291 @@
+
+
diff --git a/icon/iconset/nuvola/file-invoice.svg b/icon/iconset/nuvola/file-invoice.svg
new file mode 100644
index 00000000..38384952
--- /dev/null
+++ b/icon/iconset/nuvola/file-invoice.svg
@@ -0,0 +1,291 @@
+
+
diff --git a/icon/iconset/nuvola/house-user.svg b/icon/iconset/nuvola/house-user.svg
new file mode 100644
index 00000000..40af0666
--- /dev/null
+++ b/icon/iconset/nuvola/house-user.svg
@@ -0,0 +1,183 @@
+
+
+
diff --git a/icon/iconset/nuvola/user-circle.svg b/icon/iconset/nuvola/user-circle.svg
new file mode 100644
index 00000000..26f300f4
--- /dev/null
+++ b/icon/iconset/nuvola/user-circle.svg
@@ -0,0 +1,89 @@
+
+
+
diff --git a/icon/user-circle.svg b/icon/user-circle.svg
new file mode 100644
index 00000000..093ee6ed
--- /dev/null
+++ b/icon/user-circle.svg
@@ -0,0 +1 @@
+
diff --git a/sql/swad.sql b/sql/swad.sql
index f72d3a1d..0e0db93a 100644
--- a/sql/swad.sql
+++ b/sql/swad.sql
@@ -538,11 +538,11 @@ CREATE TABLE IF NOT EXISTS exa_results (
CREATE TABLE IF NOT EXISTS exa_sets (
SetCod INT NOT NULL AUTO_INCREMENT,
ExaCod INT NOT NULL,
- SetInd INT NOT NULL DEFAULT 0,
+ SetInd INT NOT NULL,
NumQstsToExam INT NOT NULL DEFAULT 0,
Title VARCHAR(2047) NOT NULL,
UNIQUE INDEX(SetCod),
- INDEX(ExaCod,SetInd));
+ UNIQUE INDEX(ExaCod,SetInd));
--
-- Table exa_times: stores the elapsed time in every question in every exam event
--
@@ -802,7 +802,7 @@ CREATE TABLE IF NOT EXISTS mch_results (
--
CREATE TABLE IF NOT EXISTS gam_questions (
GamCod INT NOT NULL,
- QstInd INT NOT NULL DEFAULT 0,
+ QstInd INT NOT NULL,
QstCod INT NOT NULL,
UNIQUE INDEX(GamCod,QstInd),
UNIQUE INDEX(GamCod,QstCod));
diff --git a/swad_changelog.h b/swad_changelog.h
index c15cbbad..27e3c166 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -544,10 +544,17 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
-#define Log_PLATFORM_VERSION "SWAD 19.199.2 (2020-04-27)"
+#define Log_PLATFORM_VERSION "SWAD 19.199.3 (2020-04-27)"
#define CSS_FILE "swad19.193.1.css"
#define JS_FILE "swad19.193.1.js"
/*
+ Version 19.199.3: Apr 27, 2020 Changes moving sets of questions in an exam up and down. (? lines)
+ 2 changes necessary in database:
+ALTER TABLE gam_questions CHANGE COLUMN QstInd QstInd INT NOT NULL;
+ALTER TABLE exa_sets CHANGE COLUMN SetInd SetInd INT NOT NULL;
+ALTER TABLE exa_sets DROP INDEX ExaCod;
+ALTER TABLE exa_sets ADD UNIQUE INDEX(ExaCod,SetInd);
+
Version 19.199.2: Apr 27, 2020 Changes moving questions in a game up and down. (299345 lines)
4 changes necessary in database:
ALTER TABLE gam_questions CHANGE COLUMN QstInd QstInd INT NOT NULL DEFAULT 0 AFTER GamCod;
diff --git a/swad_database.c b/swad_database.c
index 7fca6766..3f859828 100644
--- a/swad_database.c
+++ b/swad_database.c
@@ -1189,8 +1189,8 @@ mysql> DESCRIBE exa_sets;
| Field | Type | Null | Key | Default | Extra |
+---------------+---------------+------+-----+---------+----------------+
| SetCod | int(11) | NO | PRI | NULL | auto_increment |
-| ExaCod | int(11) | NO | MUL | NULL | |
-| SetInd | int(11) | NO | | 0 | |
+| ExaCod | int(11) | NO | | NULL | |
+| SetInd | int(11) | NO | | NULL | |
| NumQstsToExam | int(11) | NO | | 0 | |
| Title | varchar(2047) | NO | | NULL | |
+---------------+---------------+------+-----+---------+----------------+
@@ -1199,11 +1199,11 @@ mysql> DESCRIBE exa_sets;
DB_CreateTable ("CREATE TABLE IF NOT EXISTS exa_sets ("
"SetCod INT NOT NULL AUTO_INCREMENT,"
"ExaCod INT NOT NULL,"
- "SetInd INT NOT NULL DEFAULT 0,"
+ "SetInd INT NOT NULL,"
"NumQstsToExam INT NOT NULL DEFAULT 0,"
"Title VARCHAR(2047) NOT NULL," // ExaSet_MAX_BYTES_TITLE
"UNIQUE INDEX(SetCod),"
- "INDEX(ExaCod,SetInd))");
+ "UNIQUE INDEX(ExaCod,SetInd))");
/***** Table exa_times *****/
/*
@@ -1587,14 +1587,14 @@ mysql> DESCRIBE gam_questions;
| Field | Type | Null | Key | Default | Extra |
+--------+---------+------+-----+---------+-------+
| GamCod | int(11) | NO | PRI | NULL | |
-| QstInd | int(11) | NO | PRI | 0 | |
+| QstInd | int(11) | NO | PRI | NULL | |
| QstCod | int(11) | NO | | NULL | |
+--------+---------+------+-----+---------+-------+
3 rows in set (0.00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS gam_questions ("
"GamCod INT NOT NULL,"
- "QstInd INT NOT NULL DEFAULT 0,"
+ "QstInd INT NOT NULL,"
"QstCod INT NOT NULL,"
"UNIQUE INDEX(GamCod,QstInd),"
"UNIQUE INDEX(GamCod,QstCod))");
diff --git a/swad_exam.c b/swad_exam.c
index a8fb7abc..e9e87c42 100644
--- a/swad_exam.c
+++ b/swad_exam.c
@@ -3687,25 +3687,36 @@ static void ExaSet_ExchangeSets (long ExaCod,
Example:
SetIndTop = 1; SetCodTop = 218
SetIndBottom = 2; SetCodBottom = 220
- +--------+--------+ +--------+--------+ +--------+--------+
- | SetInd | SetCod | | SetInd | SetCod | | SetInd | SetCod |
- +--------+--------+ +--------+--------+ +--------+--------+
- | 1 | 218 | -----> | 2 | 218 | = | 1 | 220 |
- | 2 | 220 | | 1 | 220 | | 2 | 218 |
- | 3 | 232 | | 3 | 232 | | 3 | 232 |
- +--------+--------+ +--------+--------+ +--------+--------+
- */
+ Step 1 Step 2 Step 3
++--------+--------+ +--------+--------+ +--------+--------+ +--------+--------+
+| SetInd | SetCod | | SetInd | SetCod | | SetInd | SetCod | | SetInd | SetCod |
++--------+--------+ +--------+--------+ +--------+--------+ +--------+--------+
+| 1 | 218 |>| -2 | 218 |>| -2 | 218 |>| 2 | 218 |
+| 2 | 220 | | 2 | 220 | | 1 | 220 | | 1 | 220 |
+| 3 | 232 | | 3 | 232 | | 3 | 232 | | 3 | 232 |
++--------+--------+ +--------+--------+ +--------+--------+ +--------+--------+
+ */
+ /* Step 1: change temporarily top index to minus bottom index
+ in order to not repeat unique index (ExaCod,SetInd) */
DB_QueryUPDATE ("can not exchange indexes of sets",
- "UPDATE exa_sets SET SetInd=%u"
+ "UPDATE exa_sets SET SetInd=-%u"
" WHERE ExaCod=%ld AND SetCod=%ld",
- SetIndBottom,
- ExaCod,SetCodTop);
+ SetIndBottom,
+ ExaCod,SetCodTop);
+ /* Step 2: change bottom index to old top index */
DB_QueryUPDATE ("can not exchange indexes of sets",
"UPDATE exa_sets SET SetInd=%u"
" WHERE ExaCod=%ld AND SetCod=%ld",
- SetIndTop,
- ExaCod,SetCodBottom);
+ SetIndTop,
+ ExaCod,SetCodBottom);
+
+ /* Step 3: change top index to old bottom index */
+ DB_QueryUPDATE ("can not exchange indexes of sets",
+ "UPDATE exa_sets SET SetInd=%u"
+ " WHERE ExaCod=%ld AND SetCod=%ld",
+ SetIndBottom,
+ ExaCod,SetCodTop);
/***** Unlock table *****/
Gbl.DB.LockedTables = false; // Set to false before the following unlock...
diff --git a/swad_game.c b/swad_game.c
index 11ee3d6e..2fa7be68 100644
--- a/swad_game.c
+++ b/swad_game.c
@@ -2589,14 +2589,14 @@ static void Gam_ExchangeQuestions (long GamCod,
Example:
QstIndTop = 1; QstCodTop = 218
QstIndBottom = 2; QstCodBottom = 220
- Step 1 Step 2 Step 3
- +--------+--------+ +--------+--------+ +--------+--------+ +--------+--------+
- | QstInd | QstCod | | QstInd | QstCod | | QstInd | QstCod | | QstInd | QstCod |
- +--------+--------+ +--------+--------+ +--------+--------+ +--------+--------+
- | 1 | 218 |-->| -2 | 218 |-->| -2 | 218 |-->| 2 | 218 |
- | 2 | 220 | | 2 | 220 | | 1 | 220 | | 1 | 220 |
- | 3 | 232 | | 3 | 232 | | 3 | 232 | | 3 | 232 |
- +--------+--------+ +--------+--------+ +--------+--------+ +--------+--------+
+ Step 1 Step 2 Step 3
++--------+--------+ +--------+--------+ +--------+--------+ +--------+--------+
+| QstInd | QstCod | | QstInd | QstCod | | QstInd | QstCod | | QstInd | QstCod |
++--------+--------+ +--------+--------+ +--------+--------+ +--------+--------+
+| 1 | 218 |>| -2 | 218 |>| -2 | 218 |>| 2 | 218 |
+| 2 | 220 | | 2 | 220 | | 1 | 220 | | 1 | 220 |
+| 3 | 232 | | 3 | 232 | | 3 | 232 | | 3 | 232 |
++--------+--------+ +--------+--------+ +--------+--------+ +--------+--------+
*/
/* Step 1: change temporarily top index to minus bottom index
in order to not repeat unique index (GamCod,QstInd) */