From 3941c8e7916fea8d30801adfed8e7671cd4c6508 Mon Sep 17 00:00:00 2001 From: acanas Date: Sun, 17 May 2020 02:28:30 +0200 Subject: [PATCH] Version19.233 --- Makefile | 3 +- sql/swad.sql | 16 +- swad_action.c | 20 +- swad_changelog.h | 30 +- swad_database.c | 72 +- swad_exam.c | 94 +- swad_exam.h | 11 +- swad_exam_print.c | 73 +- swad_exam_print.h | 8 +- swad_exam_result.c | 318 +++--- swad_exam_event.c => swad_exam_session.c | 1151 +++++++++++----------- swad_exam_event.h => swad_exam_session.h | 72 +- swad_exam_set.c | 4 +- swad_exam_type.h | 20 +- swad_group.c | 4 +- swad_help_URL.c | 2 +- swad_layout.c | 8 +- swad_layout.h | 2 +- swad_match_result.c | 4 +- swad_test.c | 6 +- swad_test_print.c | 4 +- swad_text.c | 233 +++-- 22 files changed, 1091 insertions(+), 1064 deletions(-) rename swad_exam_event.c => swad_exam_session.c (52%) rename swad_exam_event.h => swad_exam_session.h (51%) diff --git a/Makefile b/Makefile index ed1762bd..b016ec41 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,8 @@ OBJS = swad_account.o swad_action.o swad_agenda.o swad_alert.o \ swad_database.o swad_date.o swad_degree.o swad_degree_config.o \ swad_degree_type.o swad_department.o swad_duplicate.o \ swad_enrolment.o swad_exam.o swad_exam_announcement.o \ - swad_exam_event.o swad_exam_print.o swad_exam_result.o swad_exam_set.o \ + swad_exam_print.o swad_exam_result.o swad_exam_session.o \ + swad_exam_set.o \ swad_figure.o swad_figure_cache.o swad_file.o swad_file_browser.o \ swad_file_extension.o swad_file_MIME.o swad_firewall.o swad_follow.o \ swad_form.o swad_forum.o \ diff --git a/sql/swad.sql b/sql/swad.sql index 03590f25..a7ac0c5d 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -453,21 +453,21 @@ CREATE TABLE IF NOT EXISTS departments ( -- Table exa_groups: stores the groups associated to each event in an exam -- CREATE TABLE IF NOT EXISTS exa_groups ( - EvtCod INT NOT NULL, + SesCod INT NOT NULL, GrpCod INT NOT NULL, - UNIQUE INDEX(EvtCod,GrpCod)); + UNIQUE INDEX(SesCod,GrpCod)); -- --- Table exa_events: stores the events (exams instances) that have already taken place +-- Table exa_sessions: stores the exam sessions that have already taken place -- -CREATE TABLE IF NOT EXISTS exa_events ( - EvtCod INT NOT NULL AUTO_INCREMENT, +CREATE TABLE IF NOT EXISTS exa_sessions ( + SesCod INT NOT NULL AUTO_INCREMENT, ExaCod INT NOT NULL, Hidden ENUM('N','Y') NOT NULL DEFAULT 'N', UsrCod INT NOT NULL, StartTime DATETIME NOT NULL, EndTime DATETIME NOT NULL, Title VARCHAR(2047) NOT NULL, - UNIQUE INDEX(EvtCod), + UNIQUE INDEX(SesCod), INDEX(ExaCod)); -- -- Table exa_exams: stores the exams @@ -500,7 +500,7 @@ CREATE TABLE IF NOT EXISTS exa_print_questions ( -- CREATE TABLE IF NOT EXISTS exa_prints ( PrnCod INT NOT NULL AUTO_INCREMENT, - EvtCod INT NOT NULL, + SesCod INT NOT NULL, UsrCod INT NOT NULL, StartTime DATETIME NOT NULL, EndTime DATETIME NOT NULL, @@ -509,7 +509,7 @@ CREATE TABLE IF NOT EXISTS exa_prints ( Sent ENUM('N','Y') NOT NULL DEFAULT 'N', Score DOUBLE PRECISION NOT NULL DEFAULT 0, UNIQUE INDEX(PrnCod), - UNIQUE INDEX(EvtCod,UsrCod)); + UNIQUE INDEX(SesCod,UsrCod)); -- -- Table exa_set_answers: stores the answers of questions in exam sets -- diff --git a/swad_action.c b/swad_action.c index 9caa8f56..cdb99728 100644 --- a/swad_action.c +++ b/swad_action.c @@ -48,9 +48,9 @@ #include "swad_duplicate.h" #include "swad_exam.h" #include "swad_exam_announcement.h" -#include "swad_exam_event.h" #include "swad_exam_print.h" #include "swad_exam_result.h" +#include "swad_exam_session.h" #include "swad_exam_set.h" #include "swad_enrolment.h" #include "swad_figure.h" @@ -679,14 +679,14 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = [ActSeeExa ] = {1849,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_SeeOneExam ,NULL}, - [ActReqNewExaEvt ] = {1852,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaEvt_RequestCreatOrEditEvent ,NULL}, - [ActEdiOneExaEvt ] = {1902,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaEvt_RequestCreatOrEditEvent ,NULL}, - [ActNewExaEvt ] = {1853,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaEvt_ReceiveFormEvent ,NULL}, - [ActChgExaEvt ] = {1903,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaEvt_ReceiveFormEvent ,NULL}, - [ActReqRemExaEvt ] = {1850,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaEvt_RequestRemoveEvent ,NULL}, - [ActRemExaEvt ] = {1851,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaEvt_RemoveEvent ,NULL}, - [ActHidExaEvt ] = {1900,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaEvt_HideEvent ,NULL}, - [ActShoExaEvt ] = {1901,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaEvt_UnhideEvent ,NULL}, + [ActReqNewExaEvt ] = {1852,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSes_RequestCreatOrEditSession ,NULL}, + [ActEdiOneExaEvt ] = {1902,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSes_RequestCreatOrEditSession ,NULL}, + [ActNewExaEvt ] = {1853,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSes_ReceiveFormSession ,NULL}, + [ActChgExaEvt ] = {1903,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSes_ReceiveFormSession ,NULL}, + [ActReqRemExaEvt ] = {1850,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSes_RequestRemoveSession ,NULL}, + [ActRemExaEvt ] = {1851,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSes_RemoveSession ,NULL}, + [ActHidExaEvt ] = {1900,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSes_HideSession ,NULL}, + [ActShoExaEvt ] = {1901,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSes_UnhideSession ,NULL}, [ActSeeMyExaEvtResCrs] = {1867,-1,TabUnk,ActSeeAllExa ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowMyExaResultsInCrs ,NULL}, [ActSeeMyExaEvtResExa] = {1868,-1,TabUnk,ActSeeAllExa ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowMyExaResultsInExa ,NULL}, @@ -699,7 +699,7 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = [ActSeeAllExaEvtResEvt] = {1874,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowAllExaResultsInEvt ,NULL}, [ActSeeOneExaEvtResOth] = {1875,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowOneExaResult ,NULL}, - [ActChgVisResExaEvtUsr] = {1876,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaEvt_ToggleVisResultsEvtUsr ,NULL}, + [ActChgVisResExaEvtUsr] = {1876,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSes_ToggleVisResultsSesUsr ,NULL}, [ActFrmNewExa ] = {1877,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_RequestCreatOrEditExam ,NULL}, [ActEdiOneExa ] = {1878,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_RequestCreatOrEditExam ,NULL}, diff --git a/swad_changelog.h b/swad_changelog.h index d6a395b7..34031090 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -472,6 +472,15 @@ contiene una de las que yo imparto. As // TODO: ¿Añadir dos columnas a resultados de juegos entre "Preguntas contestadas" y "Puntuación total": Preguntas "Correctas" y Preguntas "Erróneas"? // Problema: sólo es aplicable a tipo test +// TODO: En los avisos amarillos aparecen enlaces, pero en las copias de ellos en el timeline +// no se insertan los hipervínculos de los avisos. +// No los añadí en su momento porque se copian los primeros caracteres del mensaje, +// pudiendo cortarse en mitad de un enlace. +// Es decir, porque es complicadillo de hacer. +// Lo mejor sería limitar la longitud máximoa de los avisos a N caracteres, +// igual que los posts del timeline, y así ponerlos completos siempre, con enlaces y todo. +// De camino evitaría los avisos kilométricos. + // TODO: Si hay accesos a un centro y el centro se elimina, al clicar en el acceso sale un mensaje de "Usted no tiene permiso para realizar esta acción." en lugar de "No existe el centro" // TODO: Poner en swad.cfg varias líneas de swad_config.h para que sea más configurable @@ -548,14 +557,29 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.232.1 (2020-05-16)" +#define Log_PLATFORM_VERSION "SWAD 19.233 (2020-05-17)" #define CSS_FILE "swad19.230.1.css" #define JS_FILE "swad19.230.3.js" /* TODO: Comprobar si el directorio público que devuelve Ses_GetPublicDirFromCache sigue existiendo. // Si no existe, hay que crear un nuevo directorio y meterlo en cache - Version 19.232.1: May 16, 2020 Changes in contextual icons in bank of questions and test. (301004 lines) + Version 19.233: May 17, 2020 Exam event is renamed as exam session. (301028 lines) + 7 changes necessary in database: +RENAME TABLE exa_events TO exa_sessions; +ALTER TABLE exa_groups CHANGE COLUMN EvtCod SesCod INT NOT NULL; +ALTER TABLE exa_prints CHANGE COLUMN EvtCod SesCod INT NOT NULL; +ALTER TABLE exa_sessions CHANGE COLUMN EvtCod SesCod INT NOT NULL AUTO_INCREMENT; +ALTER TABLE exa_groups DROP INDEX EvtCod,ADD UNIQUE INDEX(SesCod,GrpCod); +ALTER TABLE exa_prints DROP INDEX EvtCod,ADD UNIQUE INDEX(SesCod,UsrCod); +ALTER TABLE exa_sessions DROP INDEX EvtCod,ADD UNIQUE INDEX(SesCod); + + Version 19.232.2: May 16, 2020 When a new tag is created, it is marked as hidden. (301007 lines) + Version 19.232.1: May 16, 2020 Changes in contextual icons in bank of questions and test. (301006 lines) + Copy the following 2 icons to icon public directory: +sudo cp icon/iconset/nuvola/house-user.svg /var/www/html/swad/icon/iconset/nuvola/ +sudo cp icon/iconset/nuvola/tasks.png /var/www/html/swad/icon/iconset/nuvola/ + Version 19.232: May 16, 2020 New option to edit questions separated from tests. (301000 lines) Version 19.231: May 16, 2020 Fixed bugs and code refactoring in exam results. (300956 lines) Version 19.230.3: May 15, 2020 Update maths in exam prints when user answers. (301037 lines) @@ -728,7 +752,7 @@ ALTER TABLE crs_usr DROP COLUMN LastDowGrpCod, DROP COLUMN LastComGrpCod, DROP C ALTER TABLE crs_usr_last ENGINE=MyISAM; OPTIMIZE TABLE crs_usr_last; OPTIMIZE TABLE crs_usr; --------------- + Version 19.206.3: Apr 30, 2020 Added indexes on database table. (300244 lines) 10 changes necessary in database: RENAME TABLE crs_usr TO crs_usr_old; diff --git a/swad_database.c b/swad_database.c index 7961e057..aa0d71fd 100644 --- a/swad_database.c +++ b/swad_database.c @@ -1005,44 +1005,15 @@ mysql> DESCRIBE exa_groups; +--------+---------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+---------+------+-----+---------+-------+ -| EvtCod | int(11) | NO | PRI | NULL | | +| SesCod | int(11) | NO | PRI | NULL | | | GrpCod | int(11) | NO | PRI | NULL | | +--------+---------+------+-----+---------+-------+ -2 rows in set (0.01 sec) +2 rows in set (0.00 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS exa_groups (" - "EvtCod INT NOT NULL," + "SesCod INT NOT NULL," "GrpCod INT NOT NULL," - "UNIQUE INDEX(EvtCod,GrpCod))"); - - /***** Table exa_events *****/ -/* -mysql> DESCRIBE exa_events; -+----------------+---------------+------+-----+---------+----------------+ -| Field | Type | Null | Key | Default | Extra | -+----------------+---------------+------+-----+---------+----------------+ -| EvtCod | int(11) | NO | PRI | NULL | auto_increment | -| ExaCod | int(11) | NO | MUL | NULL | | -| Hidden | enum('N','Y') | NO | | N | | -| UsrCod | int(11) | NO | | NULL | | -| StartTime | datetime | NO | | NULL | | -| EndTime | datetime | NO | | NULL | | -| Title | varchar(2047) | NO | | NULL | | -| ShowUsrResults | enum('N','Y') | NO | | N | | -+----------------+---------------+------+-----+---------+----------------+ -8 rows in set (0.00 sec) -*/ - DB_CreateTable ("CREATE TABLE IF NOT EXISTS exa_events (" - "EvtCod INT NOT NULL AUTO_INCREMENT," - "ExaCod INT NOT NULL," - "Hidden ENUM('N','Y') NOT NULL DEFAULT 'N'," - "UsrCod INT NOT NULL," - "StartTime DATETIME NOT NULL," - "EndTime DATETIME NOT NULL," - "Title VARCHAR(2047) NOT NULL," // ExaEvt_MAX_BYTES_TITLE - "ShowUsrResults ENUM('N','Y') NOT NULL DEFAULT 'N'," - "UNIQUE INDEX(EvtCod)," - "INDEX(ExaCod))"); + "UNIQUE INDEX(SesCod,GrpCod))"); /***** Table exa_exams *****/ /* @@ -1106,7 +1077,7 @@ mysql> DESCRIBE exa_prints; | Field | Type | Null | Key | Default | Extra | +-----------------+---------------+------+-----+---------+----------------+ | PrnCod | int(11) | NO | PRI | NULL | auto_increment | -| EvtCod | int(11) | NO | MUL | NULL | | +| SesCod | int(11) | NO | MUL | NULL | | | UsrCod | int(11) | NO | | NULL | | | StartTime | datetime | NO | | NULL | | | EndTime | datetime | NO | | NULL | | @@ -1119,7 +1090,7 @@ mysql> DESCRIBE exa_prints; */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS exa_prints (" "PrnCod INT NOT NULL AUTO_INCREMENT," - "EvtCod INT NOT NULL," + "SesCod INT NOT NULL," "UsrCod INT NOT NULL," "StartTime DATETIME NOT NULL," "EndTime DATETIME NOT NULL," @@ -1128,7 +1099,36 @@ mysql> DESCRIBE exa_prints; "Sent ENUM('N','Y') NOT NULL DEFAULT 'N'," "Score DOUBLE PRECISION NOT NULL DEFAULT 0," "UNIQUE INDEX(PrnCod)," - "UNIQUE INDEX(EvtCod,UsrCod))"); + "UNIQUE INDEX(SesCod,UsrCod))"); + + /***** Table exa_sessions *****/ +/* +mysql> DESCRIBE exa_sessions; ++----------------+---------------+------+-----+---------+----------------+ +| Field | Type | Null | Key | Default | Extra | ++----------------+---------------+------+-----+---------+----------------+ +| SesCod | int(11) | NO | PRI | NULL | auto_increment | +| ExaCod | int(11) | NO | MUL | NULL | | +| Hidden | enum('N','Y') | NO | | N | | +| UsrCod | int(11) | NO | | NULL | | +| StartTime | datetime | NO | | NULL | | +| EndTime | datetime | NO | | NULL | | +| Title | varchar(2047) | NO | | NULL | | +| ShowUsrResults | enum('N','Y') | NO | | N | | ++----------------+---------------+------+-----+---------+----------------+ +8 rows in set (0.00 sec) +*/ + DB_CreateTable ("CREATE TABLE IF NOT EXISTS exa_sessions (" + "SesCod INT NOT NULL AUTO_INCREMENT," + "ExaCod INT NOT NULL," + "Hidden ENUM('N','Y') NOT NULL DEFAULT 'N'," + "UsrCod INT NOT NULL," + "StartTime DATETIME NOT NULL," + "EndTime DATETIME NOT NULL," + "Title VARCHAR(2047) NOT NULL," // ExaSes_MAX_BYTES_TITLE + "ShowUsrResults ENUM('N','Y') NOT NULL DEFAULT 'N'," + "UNIQUE INDEX(SesCod)," + "INDEX(ExaCod))"); /***** Table exa_set_answers *****/ /* diff --git a/swad_exam.c b/swad_exam.c index 173b5621..a796fe68 100644 --- a/swad_exam.c +++ b/swad_exam.c @@ -36,8 +36,8 @@ #include "swad_database.h" #include "swad_exam.h" -#include "swad_exam_event.h" #include "swad_exam_result.h" +#include "swad_exam_session.h" #include "swad_exam_set.h" #include "swad_exam_type.h" #include "swad_figure.h" @@ -157,7 +157,7 @@ void Exa_ResetExams (struct Exa_Exams *Exams) Exams->ListQuestions = NULL; Exams->ExaCodsSelected = NULL; // String with selected exam codes separated by separator multiple Exams->ExaCod = -1L; // Selected/current exam code - Exams->EvtCod = -1L; // Selected/current event code + Exams->SesCod = -1L; // Selected/current session code Exams->SetInd = 0; // Current set index Exams->QstCod = -1L; // Current question code } @@ -180,8 +180,8 @@ void Exa_ResetExam (struct Exa_Exam *Exam) Exam->Hidden = false; Exam->NumSets = 0; Exam->NumQsts = 0; - Exam->NumEvts = 0; - Exam->NumOpenEvts = 0; + Exam->NumSess = 0; + Exam->NumOpenSess = 0; } /*****************************************************************************/ @@ -212,7 +212,7 @@ static void Exa_ListAllExams (struct Exa_Exams *Exams) extern const char *Txt_Exams; extern const char *Txt_EXAMS_ORDER_HELP[Exa_NUM_ORDERS]; extern const char *Txt_EXAMS_ORDER[Exa_NUM_ORDERS]; - extern const char *Txt_Events; + extern const char *Txt_Sessions; extern const char *Txt_No_exams; Exa_Order_t Order; struct Pagination Pagination; @@ -271,7 +271,7 @@ static void Exa_ListAllExams (struct Exa_Exams *Exams) HTM_TH_End (); } - HTM_TH (1,1,"RM",Txt_Events); + HTM_TH (1,1,"RM",Txt_Sessions); HTM_TR_End (); @@ -341,7 +341,7 @@ static void Exa_PutIconsListExams (void *Exams) if (Exa_CheckIfICanEditExams ()) Exa_PutIconToCreateNewExam ((struct Exa_Exams *) Exams); - /***** Put icon to view events results *****/ + /***** Put icon to view sessions results *****/ switch (Gbl.Usrs.Me.Role.Logged) { case Rol_STD: @@ -411,12 +411,12 @@ void Exa_SeeOneExam (void) { struct Exa_Exams Exams; struct Exa_Exam Exam; - struct ExaEvt_Event Event; + struct ExaSes_Session Session; /***** Reset exams context *****/ Exa_ResetExams (&Exams); Exa_ResetExam (&Exam); - ExaEvt_ResetEvent (&Event); + ExaSes_ResetSession (&Session); /***** Get parameters *****/ Exa_GetParams (&Exams); @@ -429,8 +429,8 @@ void Exa_SeeOneExam (void) Exams.ExaCod = Exam.ExaCod; /***** Show exam *****/ - Exa_ShowOnlyOneExam (&Exams,&Exam,&Event, - false); // Do not put form for event + Exa_ShowOnlyOneExam (&Exams,&Exam,&Session, + false); // Do not put form for session } /*****************************************************************************/ @@ -439,17 +439,17 @@ void Exa_SeeOneExam (void) void Exa_ShowOnlyOneExam (struct Exa_Exams *Exams, struct Exa_Exam *Exam, - struct ExaEvt_Event *Event, - bool PutFormEvent) + struct ExaSes_Session *Session, + bool PutFormSession) { - Exa_ShowOnlyOneExamBegin (Exams,Exam,Event,PutFormEvent); + Exa_ShowOnlyOneExamBegin (Exams,Exam,Session,PutFormSession); Exa_ShowOnlyOneExamEnd (); } void Exa_ShowOnlyOneExamBegin (struct Exa_Exams *Exams, struct Exa_Exam *Exam, - struct ExaEvt_Event *Event, - bool PutFormEvent) + struct ExaSes_Session *Session, + bool PutFormSession) { extern const char *Hlp_ASSESSMENT_Exams; extern const char *Txt_Exam; @@ -465,8 +465,8 @@ void Exa_ShowOnlyOneExamBegin (struct Exa_Exams *Exams, Exam, true); // Show only this exam - /***** List events *****/ - ExaEvt_ListEvents (Exams,Exam,Event,PutFormEvent); + /***** List sessions *****/ + ExaSes_ListSessions (Exams,Exam,Session,PutFormSession); } void Exa_ShowOnlyOneExamEnd (void) @@ -482,7 +482,7 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams, extern const char *Txt_Sets_of_questions; extern const char *Txt_Maximum_grade; extern const char *Txt_Result_visibility; - extern const char *Txt_Events; + extern const char *Txt_Sessions; char *Anchor; static unsigned UniqueId = 0; char *Id; @@ -522,7 +522,7 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams, { if (asprintf (&Id,"exa_date_%u_%u",(unsigned) StartEndTime,UniqueId) < 0) Lay_NotEnoughMemoryExit (); - Color = Exam->NumOpenEvts ? (Exam->Hidden ? "DATE_GREEN_LIGHT": + Color = Exam->NumOpenSess ? (Exam->Hidden ? "DATE_GREEN_LIGHT": "DATE_GREEN") : (Exam->Hidden ? "DATE_RED_LIGHT": "DATE_RED"); @@ -573,7 +573,7 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams, TstVis_ShowVisibilityIcons (Exam->Visibility,Exam->Hidden); HTM_DIV_End (); - /***** Number of events in exam *****/ + /***** Number of sessions in exam *****/ if (ShowOnlyThisExam) HTM_TD_Begin ("class=\"RT\""); else @@ -582,13 +582,13 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams, Exams->ExaCod = Exam->ExaCod; Frm_StartForm (ActSeeExa); Exa_PutParams (Exams); - HTM_BUTTON_SUBMIT_Begin (Txt_Events, + HTM_BUTTON_SUBMIT_Begin (Txt_Sessions, Exam->Hidden ? "BT_LINK LT ASG_TITLE_LIGHT" : "BT_LINK LT ASG_TITLE", NULL); if (ShowOnlyThisExam) - HTM_TxtColonNBSP (Txt_Events); - HTM_Unsigned (Exam->NumEvts); + HTM_TxtColonNBSP (Txt_Sessions); + HTM_Unsigned (Exam->NumSess); HTM_BUTTON_End (); Frm_EndForm (); @@ -637,14 +637,14 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams, } /*****************************************************************************/ -/************* Put icon to show results of events in an exam *****************/ +/************ Put icon to show results of sessions in an exam ****************/ /*****************************************************************************/ static void Exa_PutIconToShowResultsOfExam (void *Exams) { if (Exams) { - /***** Put icon to view events results *****/ + /***** Put icon to view sessions results *****/ switch (Gbl.Usrs.Me.Role.Logged) { case Rol_STD: @@ -828,11 +828,11 @@ void Exa_GetListExams (struct Exa_Exams *Exams,Exa_Order_t SelectedOrder) /***** Get list of exams from database *****/ NumRows = DB_QuerySELECT (&mysql_res,"can not get exams", "SELECT exa_exams.ExaCod," // row[0] - "MIN(exa_events.StartTime) AS StartTime," // row[1] - "MAX(exa_events.EndTime) AS EndTime" // row[2] + "MIN(exa_sessions.StartTime) AS StartTime," // row[1] + "MAX(exa_sessions.EndTime) AS EndTime" // row[2] " FROM exa_exams" - " LEFT JOIN exa_events" - " ON exa_exams.ExaCod=exa_events.ExaCod" + " LEFT JOIN exa_sessions" + " ON exa_exams.ExaCod=exa_sessions.ExaCod" " WHERE exa_exams.CrsCod=%ld" "%s" " GROUP BY exa_exams.ExaCod" @@ -873,7 +873,7 @@ void Exa_GetListExams (struct Exa_Exams *Exams,Exa_Order_t SelectedOrder) } /*****************************************************************************/ -/********************* Get list of exam events selected **********************/ +/******************** Get list of exam sessions selected *********************/ /*****************************************************************************/ void Exa_GetListSelectedExaCods (struct Exa_Exams *Exams) @@ -962,8 +962,8 @@ void Exa_GetDataOfExamByCod (struct Exa_Exam *Exam) "exa_exams.Visibility," // row[5] "exa_exams.Title" // row[6] " FROM exa_exams" - " LEFT JOIN exa_events" - " ON exa_exams.ExaCod=exa_events.ExaCod" + " LEFT JOIN exa_sessions" + " ON exa_exams.ExaCod=exa_sessions.ExaCod" " WHERE exa_exams.ExaCod=%ld", Exam->ExaCod); if (NumRows) // Exam found... @@ -1001,11 +1001,11 @@ void Exa_GetDataOfExamByCod (struct Exa_Exam *Exam) /* Get number of questions */ Exam->NumQsts = ExaSet_GetNumQstsExam (Exam->ExaCod); - /* Get number of events */ - Exam->NumEvts = ExaEvt_GetNumEventsInExam (Exam->ExaCod); + /* Get number of sessions */ + Exam->NumSess = ExaSes_GetNumSessionsInExam (Exam->ExaCod); - /* Get number of open events */ - Exam->NumOpenEvts = ExaEvt_GetNumOpenEventsInExam (Exam->ExaCod); + /* Get number of open sessions */ + Exam->NumOpenSess = ExaSes_GetNumOpenSessionsInExam (Exam->ExaCod); } else /* Initialize to empty exam */ @@ -1020,7 +1020,7 @@ void Exa_GetDataOfExamByCod (struct Exa_Exam *Exam) NumRows = DB_QuerySELECT (&mysql_res,"can not get exam data", "SELECT UNIX_TIMESTAMP(MIN(StartTime))," // row[0] "UNIX_TIMESTAMP(MAX(EndTime))" // row[1] - " FROM exa_events" + " FROM exa_sessions" " WHERE ExaCod=%ld", Exam->ExaCod); if (NumRows) @@ -1178,8 +1178,8 @@ void Exa_RemoveExam (void) static void Exa_RemoveExamFromAllTables (long ExaCod) { - /***** Remove all events in this exam *****/ - ExaEvt_RemoveEventsInExamFromAllTables (ExaCod); + /***** Remove all sessions in this exam *****/ + ExaSes_RemoveSessionsInExamFromAllTables (ExaCod); /***** Remove exam questions *****/ DB_QueryDELETE ("can not remove exam questions", @@ -1207,8 +1207,8 @@ static void Exa_RemoveExamFromAllTables (long ExaCod) void Exa_RemoveExamsCrs (long CrsCod) { - /***** Remove all events in this course *****/ - ExaEvt_RemoveEventInCourseFromAllTables (CrsCod); + /***** Remove all sessions in this course *****/ + ExaSes_RemoveSessionInCourseFromAllTables (CrsCod); /***** Remove the questions in exams *****/ DB_QueryDELETE ("can not remove questions in course exams", @@ -1756,7 +1756,7 @@ unsigned Exa_GetNextQuestionIndexInExam (long ExaCod,unsigned QstInd) { MYSQL_RES *mysql_res; MYSQL_ROW row; - unsigned NextQstInd = ExaEvt_AFTER_LAST_QUESTION; // End of questions has been reached + unsigned NextQstInd = ExaSes_AFTER_LAST_QUESTION; // End of questions has been reached /***** Get next question index in an exam from database *****/ // Although indexes are always continuous... @@ -1793,15 +1793,15 @@ static void Exa_PutParamSetCod (void *SetCod) // Should be a pointer to long */ /*****************************************************************************/ -/*********** Get number of events and check is edition is possible **********/ +/********** Get number of sessions and check is edition is possible **********/ /*****************************************************************************/ -// Before calling this function, number of events must be calculated +// Before calling this function, number of sessions must be calculated bool Exa_CheckIfEditable (const struct Exa_Exam *Exam) { if (Exa_CheckIfICanEditExams ()) - /***** Questions are editable only if exam has no events *****/ - return (bool) (Exam->NumEvts == 0); // Exams with events should not be edited + /***** Questions are editable only if exam has no sessions *****/ + return (bool) (Exam->NumSess == 0); // Exams with sessions should not be edited else return false; // Questions are not editable } diff --git a/swad_exam.h b/swad_exam.h index 0c24ba0d..59a89328 100644 --- a/swad_exam.h +++ b/swad_exam.h @@ -28,10 +28,7 @@ /********************************* Headers ***********************************/ /*****************************************************************************/ -// #include "swad_date.h" -// #include "swad_exam_event.h" #include "swad_exam_type.h" -// #include "swad_scope.h" /*****************************************************************************/ /************************** Public types and constants ***********************/ @@ -51,12 +48,12 @@ bool Exa_CheckIfICanEditExams (void); void Exa_SeeOneExam (void); void Exa_ShowOnlyOneExam (struct Exa_Exams *Exams, struct Exa_Exam *Exam, - struct ExaEvt_Event *Event, - bool PutFormEvent); + struct ExaSes_Session *Session, + bool PutFormSession); void Exa_ShowOnlyOneExamBegin (struct Exa_Exams *Exams, struct Exa_Exam *Exam, - struct ExaEvt_Event *Event, - bool PutFormEvent); + struct ExaSes_Session *Session, + bool PutFormSession); void Exa_ShowOnlyOneExamEnd (void); void Exa_SetCurrentExaCod (long ExaCod); diff --git a/swad_exam_print.c b/swad_exam_print.c index cfafdc5d..5263730e 100644 --- a/swad_exam_print.c +++ b/swad_exam_print.c @@ -1,4 +1,4 @@ -// swad_exam_print.c: exam prints (each copy of an exam in an event for a student) +// swad_exam_print.c: exam prints (each copy of an exam in a session for a student) /* SWAD (Shared Workspace At a Distance), @@ -35,9 +35,9 @@ #include "swad_box.h" #include "swad_database.h" #include "swad_exam.h" -#include "swad_exam_event.h" #include "swad_exam_print.h" #include "swad_exam_result.h" +#include "swad_exam_session.h" #include "swad_exam_set.h" #include "swad_exam_type.h" #include "swad_form.h" @@ -140,7 +140,7 @@ static void ExaPrn_UpdatePrintInDB (const struct ExaPrn_Print *Print); void ExaPrn_ResetPrint (struct ExaPrn_Print *Print) { - Print->EvtCod = -1L; + Print->SesCod = -1L; Print->UsrCod = -1L; ExaPrn_ResetPrintExceptEvtCodAndUsrCod (Print); } @@ -148,7 +148,6 @@ void ExaPrn_ResetPrint (struct ExaPrn_Print *Print) static void ExaPrn_ResetPrintExceptEvtCodAndUsrCod (struct ExaPrn_Print *Print) { Print->PrnCod = -1L; - // Print->ExaCod = -1L; Print->TimeUTC[Dat_START_TIME] = Print->TimeUTC[Dat_END_TIME ] = (time_t) 0; Print->NumQsts = @@ -158,32 +157,32 @@ static void ExaPrn_ResetPrintExceptEvtCodAndUsrCod (struct ExaPrn_Print *Print) } /*****************************************************************************/ -/********************** Show print of an exam in an event ********************/ +/********************** Show print of an exam in a session *******************/ /*****************************************************************************/ void ExaPrn_ShowExamPrint (void) { struct Exa_Exams Exams; struct Exa_Exam Exam; - struct ExaEvt_Event Event; + struct ExaSes_Session Session; struct ExaPrn_Print Print; /***** Reset exams context *****/ Exa_ResetExams (&Exams); Exa_ResetExam (&Exam); - ExaEvt_ResetEvent (&Event); + ExaSes_ResetSession (&Session); ExaPrn_ResetPrint (&Print); /***** Get and check parameters *****/ - ExaEvt_GetAndCheckParameters (&Exams,&Exam,&Event); + ExaSes_GetAndCheckParameters (&Exams,&Exam,&Session); - /***** Check if I can access to this event *****/ - if (ExaEvt_CheckIfICanAnswerThisEvent (&Event)) + /***** Check if I can access to this session *****/ + if (ExaSes_CheckIfICanAnswerThisSession (&Session)) { /***** Get print data from database *****/ - Print.EvtCod = Event.EvtCod; + Print.SesCod = Session.SesCod; Print.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod; - ExaPrn_GetPrintDataByEvtCodAndUsrCod (&Print); + ExaPrn_GetPrintDataBySesCodAndUsrCod (&Print); if (Print.PrnCod > 0) // Print exists and I can access to it /***** Get questions and user's answers of exam print from database *****/ @@ -209,10 +208,10 @@ void ExaPrn_ShowExamPrint (void) } /*****************************************************************************/ -/********* Get data of an exam print using event code and user code **********/ +/******** Get data of an exam print using session code and user code *********/ /*****************************************************************************/ -void ExaPrn_GetPrintDataByEvtCodAndUsrCod (struct ExaPrn_Print *Print) +void ExaPrn_GetPrintDataBySesCodAndUsrCod (struct ExaPrn_Print *Print) { MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -227,9 +226,9 @@ void ExaPrn_GetPrintDataByEvtCodAndUsrCod (struct ExaPrn_Print *Print) "Sent," // row[5] "Score" // row[6] " FROM exa_prints" - " WHERE EvtCod=%ld" + " WHERE SesCod=%ld" " AND UsrCod=%ld", - Print->EvtCod, + Print->SesCod, Print->UsrCod) == 1) { row = mysql_fetch_row (mysql_res); @@ -490,10 +489,10 @@ static void ExaPrn_CreatePrintInDB (struct ExaPrn_Print *Print) Print->PrnCod = DB_QueryINSERTandReturnCode ("can not create new exam print", "INSERT INTO exa_prints" - " (EvtCod,UsrCod,StartTime,EndTime,NumQsts,NumQstsNotBlank,Sent,Score)" + " (SesCod,UsrCod,StartTime,EndTime,NumQsts,NumQstsNotBlank,Sent,Score)" " VALUES" " (%ld,%ld,NOW(),NOW(),%u,0,'N',0)", - Print->EvtCod, + Print->SesCod, Gbl.Usrs.Me.UsrDat.UsrCod, Print->NumQsts); } @@ -588,8 +587,8 @@ static void ExaPrn_ShowExamPrintToFillIt (const char *Title, /***** Form to end/close this exam print *****/ Frm_StartForm (ActEndExaPrn); - // ExaEvt_PutParamEvtCod (Print->EvtCod); - Btn_PutCreateButton ("He terminado"); // TODO: Translate!!! + // ExaSes_PutParamSesCod (Print->SesCod); + Btn_PutCreateButton ("He terminado"); // TODO: Need translations!!! Frm_EndForm (); } @@ -744,10 +743,10 @@ static void ExaPrn_WriteIntAnsToFill (const struct ExaPrn_Print *Print, Id, Print->PrintedQuestions[NumQst].StrAnswers); HTM_TxtF (" onchange=\"updateExamPrint('examprint','%s','Ans'," - "'act=%ld&ses=%s&EvtCod=%ld&NumQst=%u');" + "'act=%ld&ses=%s&SesCod=%ld&NumQst=%u');" " return false;\" />", // return false is necessary to not submit form Id, - Act_GetActCod (ActAnsExaPrn),Gbl.Session.Id,Print->EvtCod,NumQst); + Act_GetActCod (ActAnsExaPrn),Gbl.Session.Id,Print->SesCod,NumQst); } /*****************************************************************************/ @@ -768,10 +767,10 @@ static void ExaPrn_WriteFloatAnsToFill (const struct ExaPrn_Print *Print, Id,Tst_MAX_BYTES_FLOAT_ANSWER, Print->PrintedQuestions[NumQst].StrAnswers); HTM_TxtF (" onchange=\"updateExamPrint('examprint','%s','Ans'," - "'act=%ld&ses=%s&EvtCod=%ld&NumQst=%u');" + "'act=%ld&ses=%s&SesCod=%ld&NumQst=%u');" " return false;\" />", // return false is necessary to not submit form Id, - Act_GetActCod (ActAnsExaPrn),Gbl.Session.Id,Print->EvtCod,NumQst); + Act_GetActCod (ActAnsExaPrn),Gbl.Session.Id,Print->SesCod,NumQst); } /*****************************************************************************/ @@ -793,11 +792,11 @@ static void ExaPrn_WriteTFAnsToFill (const struct ExaPrn_Print *Print, NumQst); HTM_TxtF ("