From c3ce51b7984a87d8ce48333d1c0c51a2e6857840 Mon Sep 17 00:00:00 2001 From: acanas Date: Wed, 22 Apr 2020 03:15:04 +0200 Subject: [PATCH] Version19.192 --- Makefile | 3 +- icon/iconset/awesome/file-contract.svg | 1 + icon/iconset/awesome/file-invoice.svg | 1 + icon/iconset/nuvola/file-contract.png | Bin 0 -> 5985 bytes icon/iconset/nuvola/file-invoice.png | Bin 0 -> 10554 bytes swad_API.c | 14 +- swad_account.c | 2 +- swad_action.c | 114 ++++- swad_action.h | 421 +++++++++-------- swad_changelog.h | 9 +- swad_config.h | 4 +- swad_course.c | 2 +- swad_database.c | 6 +- swad_enrolment.c | 2 +- swad_exam.c | 68 +-- swad_exam.h | 6 +- swad_exam_event.c | 262 +++++------ swad_exam_event.h | 14 +- swad_exam_result.c | 311 ++++++------- swad_exam_result.h | 6 +- swad_figure.c | 57 +++ swad_figure.h | 3 +- swad_game.c | 2 +- swad_help_URL.c | 126 +++++ swad_match.c | 20 +- swad_match_result.c | 112 ++--- swad_match_result.h | 2 +- swad_menu.c | 7 +- swad_pagination.c | 44 ++ swad_pagination.h | 21 +- swad_record.c | 2 +- swad_test.c | 374 +++++++++++---- swad_test.h | 6 +- swad_test_exam.c | 613 ++++++++++++------------- swad_test_exam.h | 72 +-- swad_text.c | 481 ++++++++++++++++++- swad_user.c | 53 +-- swad_user.h | 3 +- 38 files changed, 2122 insertions(+), 1122 deletions(-) create mode 100644 icon/iconset/awesome/file-contract.svg create mode 100644 icon/iconset/awesome/file-invoice.svg create mode 100644 icon/iconset/nuvola/file-contract.png create mode 100644 icon/iconset/nuvola/file-invoice.png diff --git a/Makefile b/Makefile index 8c66f939..cf232d28 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,8 @@ OBJS = swad_account.o swad_action.o swad_agenda.o swad_alert.o \ swad_course_config.o swad_cryptography.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_announcement.o \ + swad_enrolment.o swad_exam.o swad_exam_announcement.o \ + swad_exam_event.o swad_exam_result.o \ swad_figure.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/icon/iconset/awesome/file-contract.svg b/icon/iconset/awesome/file-contract.svg new file mode 100644 index 00000000..71f21b64 --- /dev/null +++ b/icon/iconset/awesome/file-contract.svg @@ -0,0 +1 @@ + diff --git a/icon/iconset/awesome/file-invoice.svg b/icon/iconset/awesome/file-invoice.svg new file mode 100644 index 00000000..5f508280 --- /dev/null +++ b/icon/iconset/awesome/file-invoice.svg @@ -0,0 +1 @@ + diff --git a/icon/iconset/nuvola/file-contract.png b/icon/iconset/nuvola/file-contract.png new file mode 100644 index 0000000000000000000000000000000000000000..e63e28ebb6fedfd82739df2a0a91cab850af7d88 GIT binary patch literal 5985 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 VV_+qB>my)q?PyhLL5Z0K{U2Z0A#DHv literal 0 HcmV?d00001 diff --git a/swad_API.c b/swad_API.c index 2efa7bd4..758141c7 100644 --- a/swad_API.c +++ b/swad_API.c @@ -3960,7 +3960,7 @@ int swad__sendNotice (struct soap *soap, /****************** Return test configuration in a course ********************/ /*****************************************************************************/ -#define TstExa_MAX_BYTES_FEEDBACK_TYPE 32 +#define TstRes_MAX_BYTES_FEEDBACK_TYPE 32 int swad__getTestConfig (struct soap *soap, char *wsKey,int courseCode, // input @@ -4015,7 +4015,7 @@ int swad__getTestConfig (struct soap *soap, getTestConfigOut->visibility = TstVis_MIN_VISIBILITY; /* TODO: Remove these lines in 2021 */ - getTestConfigOut->feedback = (char *) soap_malloc (soap,TstExa_MAX_BYTES_FEEDBACK_TYPE + 1); + getTestConfigOut->feedback = (char *) soap_malloc (soap,TstRes_MAX_BYTES_FEEDBACK_TYPE + 1); getTestConfigOut->feedback[0] = '\0'; /***** Get test configuration *****/ @@ -4033,23 +4033,23 @@ int swad__getTestConfig (struct soap *soap, if (!TstVis_IsVisibleTotalScore (TstCfg_GetConfigVisibility ())) Str_Copy (getTestConfigOut->feedback, "nothing", - TstExa_MAX_BYTES_FEEDBACK_TYPE); + TstRes_MAX_BYTES_FEEDBACK_TYPE); else if (!TstVis_IsVisibleEachQstScore (TstCfg_GetConfigVisibility ())) Str_Copy (getTestConfigOut->feedback, "totalResult", - TstExa_MAX_BYTES_FEEDBACK_TYPE); + TstRes_MAX_BYTES_FEEDBACK_TYPE); else if (!TstVis_IsVisibleCorrectAns (TstCfg_GetConfigVisibility ())) Str_Copy (getTestConfigOut->feedback, "eachResult", - TstExa_MAX_BYTES_FEEDBACK_TYPE); + TstRes_MAX_BYTES_FEEDBACK_TYPE); else if (!TstVis_IsVisibleFeedbackTxt (TstCfg_GetConfigVisibility ())) Str_Copy (getTestConfigOut->feedback, "eachGoodBad", - TstExa_MAX_BYTES_FEEDBACK_TYPE); + TstRes_MAX_BYTES_FEEDBACK_TYPE); else Str_Copy (getTestConfigOut->feedback, "fullFeedback", - TstExa_MAX_BYTES_FEEDBACK_TYPE); + TstRes_MAX_BYTES_FEEDBACK_TYPE); /***** Get number of tests *****/ if (TstCfg_GetConfigPluggable () == TstCfg_PLUGGABLE_YES && diff --git a/swad_account.c b/swad_account.c index 8989f352..45e0b834 100644 --- a/swad_account.c +++ b/swad_account.c @@ -1081,7 +1081,7 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat, UsrDat->FullName); /***** Remove test results made by user in all courses *****/ - TstExa_RemoveExamsMadeByUsrInAllCrss (UsrDat->UsrCod); + TstRes_RemoveExamsMadeByUsrInAllCrss (UsrDat->UsrCod); /***** Remove user's notifications *****/ Ntf_RemoveUsrNtfs (UsrDat->UsrCod); diff --git a/swad_action.c b/swad_action.c index e67001aa..90dcaf8b 100644 --- a/swad_action.c +++ b/swad_action.c @@ -46,7 +46,10 @@ #include "swad_degree_type.h" #include "swad_department.h" #include "swad_duplicate.h" +#include "swad_exam.h" #include "swad_exam_announcement.h" +#include "swad_exam_event.h" +#include "swad_exam_result.h" #include "swad_enrolment.h" #include "swad_figure.h" #include "swad_follow.h" @@ -541,11 +544,12 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = // Actions in menu: [ActSeeAss ] = { 15, 0,TabAss,ActSeeAss ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Inf_ShowInfo ,"info" }, [ActSeeAsg ] = { 801, 1,TabAss,ActSeeAsg ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Asg_SeeAssignments ,"edit" }, - [ActSeePrj ] = {1674, 2,TabAss,ActSeePrj ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_SeeProjects ,"file-alt" }, + [ActSeePrj ] = {1674, 2,TabAss,ActSeePrj ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_SeeProjects ,"file-invoice" }, [ActReqTst ] = { 103, 3,TabAss,ActReqTst ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_RequestTest ,"check" }, + [ActSeeAllExa ] = {1848, 4,TabAss,ActSeeAllExa ,0x200,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_SeeAllExams ,"file-contract" }, [ActSeeAllGam ] = {1649, 4,TabAss,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_SeeAllGames ,"gamepad" }, [ActSeeAllSvy ] = { 966, 5,TabAss,ActSeeAllSvy ,0x3F8,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Svy_SeeAllSurveys ,"poll" }, - [ActSeeAllExaAnn ] = { 85, 6,TabAss,ActSeeAllExaAnn ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaAnn_ListExamAnnouncementsSee ,"bullhorn" }, + [ActSeeAllExaAnn ] = { 85, 6,TabAss,ActSeeAllExaAnn ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaAnn_ListExamAnnouncementsSee,"bullhorn" }, // Actions not in menu: [ActEdiAss ] = { 69,-1,TabUnk,ActSeeAss ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Inf_FormsToSelSendInfo ,NULL}, @@ -664,12 +668,62 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = [ActRenTag ] = { 143,-1,TabUnk,ActReqTst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_RenameTag ,NULL}, [ActRcvCfgTst ] = { 454,-1,TabUnk,ActReqTst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstCfg_ReceiveConfigTst ,NULL}, - [ActReqSeeMyTstRes ] = {1083,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,TstExa_SelDatesToSeeMyExams ,NULL}, - [ActSeeMyTstRes ] = {1084,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstExa_ShowMyExams ,NULL}, - [ActSeeOneTstResMe ] = {1085,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstExa_ShowOneExam ,NULL}, - [ActReqSeeUsrTstRes ] = {1080,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,TstExa_SelUsrsToViewUsrsExams ,NULL}, - [ActSeeUsrTstRes ] = {1081,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstExa_GetUsrsAndShowExams ,NULL}, - [ActSeeOneTstResOth ] = {1082,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstExa_ShowOneExam ,NULL}, + [ActReqSeeMyTstRes ] = {1083,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,TstRes_SelDatesToSeeMyExams ,NULL}, + [ActSeeMyTstRes ] = {1084,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstRes_ShowMyExams ,NULL}, + [ActSeeOneTstResMe ] = {1085,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstRes_ShowOneExam ,NULL}, + [ActReqSeeUsrTstRes ] = {1080,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,TstRes_SelUsrsToViewUsrsExams ,NULL}, + [ActSeeUsrTstRes ] = {1081,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstRes_GetUsrsAndShowExams ,NULL}, + [ActSeeOneTstResOth ] = {1082,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstRes_ShowOneExam ,NULL}, + + [ActSeeExa ] = {1849,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_SeeOneExam ,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}, + [ActReqNewExaEvt ] = {1852,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_RequestNewEvent ,NULL}, + [ActNewExaEvt ] = {1853,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,ExaEvt_CreateNewEventTch ,ExaEvt_ResumeEvent ,NULL}, + [ActResExaEvt ] = {1854,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,ExaEvt_GetEventBeingPlayed ,ExaEvt_ResumeEvent ,NULL}, + [ActBckExaEvt ] = {1855,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,ExaEvt_GetEventBeingPlayed ,ExaEvt_BackEvent ,NULL}, + [ActPlyPauExaEvt ] = {1856,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,ExaEvt_GetEventBeingPlayed ,ExaEvt_PlayPauseEvent ,NULL}, + [ActFwdExaEvt ] = {1857,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,ExaEvt_GetEventBeingPlayed ,ExaEvt_ForwardEvent ,NULL}, + [ActChgNumColExaEvt ] = {1858,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,ExaEvt_GetEventBeingPlayed ,ExaEvt_ChangeNumColsEvt ,NULL}, + [ActChgVisResExaEvtQst] = {1859,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,ExaEvt_GetEventBeingPlayed ,ExaEvt_ToggleVisibilResultsEvtQst,NULL}, + [ActExaEvtCntDwn ] = {1860,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_AJAX_RFRESH,ExaEvt_GetEventBeingPlayed ,ExaEvt_StartCountdown ,NULL}, + [ActRefExaEvtTch ] = {1861,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_AJAX_RFRESH,ExaEvt_GetEventBeingPlayed ,ExaEvt_RefreshEventTch ,NULL}, + + [ActJoiExaEvt ] = {1862,-1,TabUnk,ActSeeAllExa ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,ExaEvt_GetEventBeingPlayed ,ExaEvt_JoinEventAsStd ,NULL}, + [ActSeeExaEvtAnsQstStd] = {1863,-1,TabUnk,ActSeeAllExa ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,ExaEvt_GetEventBeingPlayed ,ExaEvt_JoinEventAsStd ,NULL}, + [ActRemExaEvtAnsQstStd] = {1864,-1,TabUnk,ActSeeAllExa ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,ExaEvt_GetEventBeingPlayed ,ExaEvt_RemoveMyQuestionAnswer ,NULL}, + [ActAnsExaEvtQstStd ] = {1865,-1,TabUnk,ActSeeAllExa ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,ExaEvt_GetEventBeingPlayed ,ExaEvt_ReceiveQuestionAnswer ,NULL}, + [ActRefExaEvtStd ] = {1866,-1,TabUnk,ActSeeAllExa ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_AJAX_RFRESH,ExaEvt_GetEventBeingPlayed ,ExaEvt_RefreshEventStd ,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}, + [ActSeeMyExaEvtResEvt] = {1869,-1,TabUnk,ActSeeAllExa ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowMyExaResultsInEvt ,NULL}, + [ActSeeOneExaEvtResMe] = {1870,-1,TabUnk,ActSeeAllExa ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowOneExaResult ,NULL}, + + [ActReqSeeAllExaEvtRes] = {1871,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_SelUsrsToViewExaResults ,NULL}, + [ActSeeAllExaEvtResCrs] = {1872,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowAllExaResultsInCrs ,NULL}, + [ActSeeAllExaEvtResExa] = {1873,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowAllExaResultsInExa ,NULL}, + [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_ToggleVisibilResultsEvtUsr ,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}, + [ActNewExa ] = {1879,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_RecFormExam ,NULL}, + [ActChgExa ] = {1880,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_RecFormExam ,NULL}, + [ActReqRemExa ] = {1881,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_AskRemExam ,NULL}, + [ActRemExa ] = {1882,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_RemoveExam ,NULL}, + [ActHidExa ] = {1883,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_HideExam ,NULL}, + [ActShoExa ] = {1884,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_UnhideExam ,NULL}, + [ActAddOneExaQst ] = {1885,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,Exa_RequestNewQuestion ,NULL}, + [ActExaLstTstQst ] = {1886,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_ListTstQuestionsToSelect ,NULL}, + [ActAddTstQstToExa ] = {1887,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_AddTstQuestionsToExam ,NULL}, + [ActReqRemExaQst ] = {1888,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_RequestRemoveQst ,NULL}, + [ActRemExaQst ] = {1889,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_RemoveQst ,NULL}, + [ActUp_ExaQst ] = {1890,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_MoveUpQst ,NULL}, + [ActDwnExaQst ] = {1891,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_MoveDownQst ,NULL}, [ActSeeGam ] = {1650,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_SeeOneGame ,NULL}, @@ -3596,6 +3650,50 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un ActChgRooBld, // #1845 ActChgRooFlo, // #1846 ActChgRooTyp, // #1847 + ActSeeAllExa, // #1848 + ActSeeExa, // #1849 + ActReqRemExaEvt, // #1850 + ActRemExaEvt, // #1851 + ActReqNewExaEvt, // #1852 + ActNewExaEvt, // #1853 + ActResExaEvt, // #1854 + ActBckExaEvt, // #1855 + ActPlyPauExaEvt, // #1856 + ActFwdExaEvt, // #1857 + ActChgNumColExaEvt, // #1858 + ActChgVisResExaEvtQst, // #1859 + ActExaEvtCntDwn, // #1860 + ActRefExaEvtTch, // #1861 + ActJoiExaEvt, // #1862 + ActSeeExaEvtAnsQstStd, // #1863 + ActRemExaEvtAnsQstStd, // #1864 + ActAnsExaEvtQstStd, // #1865 + ActRefExaEvtStd, // #1866 + ActSeeMyExaEvtResCrs, // #1867 + ActSeeMyExaEvtResExa, // #1868 + ActSeeMyExaEvtResEvt, // #1869 + ActSeeOneExaEvtResMe, // #1870 + ActReqSeeAllExaEvtRes, // #1871 + ActSeeAllExaEvtResCrs, // #1872 + ActSeeAllExaEvtResExa, // #1873 + ActSeeAllExaEvtResEvt, // #1874 + ActSeeOneExaEvtResOth, // #1875 + ActChgVisResExaEvtUsr, // #1876 + ActFrmNewExa, // #1877 + ActEdiOneExa, // #1878 + ActNewExa, // #1879 + ActChgExa, // #1880 + ActReqRemExa, // #1881 + ActRemExa, // #1882 + ActHidExa, // #1883 + ActShoExa, // #1884 + ActAddOneExaQst, // #1885 + ActExaLstTstQst, // #1886 + ActAddTstQstToExa, // #1887 + ActReqRemExaQst, // #1888 + ActRemExaQst, // #1889 + ActUp_ExaQst, // #1890 + ActDwnExaQst, // #1891 }; /*****************************************************************************/ diff --git a/swad_action.h b/swad_action.h index 84a919c7..04ad0818 100644 --- a/swad_action.h +++ b/swad_action.h @@ -64,7 +64,7 @@ typedef enum typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action -#define Act_MAX_ACTION_COD 1847 +#define Act_MAX_ACTION_COD 1891 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13 @@ -516,207 +516,256 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to #define ActSeeAsg (ActChgCrsTT1stDay + 2) #define ActSeePrj (ActChgCrsTT1stDay + 3) #define ActReqTst (ActChgCrsTT1stDay + 4) -#define ActSeeAllGam (ActChgCrsTT1stDay + 5) -#define ActSeeAllSvy (ActChgCrsTT1stDay + 6) -#define ActSeeAllExaAnn (ActChgCrsTT1stDay + 7) +#define ActSeeAllExa (ActChgCrsTT1stDay + 5) +#define ActSeeAllGam (ActChgCrsTT1stDay + 6) +#define ActSeeAllSvy (ActChgCrsTT1stDay + 7) +#define ActSeeAllExaAnn (ActChgCrsTT1stDay + 8) // Secondary actions -#define ActEdiAss (ActChgCrsTT1stDay + 8) -#define ActChgFrcReaAss (ActChgCrsTT1stDay + 9) -#define ActChgHavReaAss (ActChgCrsTT1stDay + 10) -#define ActSelInfSrcAss (ActChgCrsTT1stDay + 11) -#define ActRcvURLAss (ActChgCrsTT1stDay + 12) -#define ActRcvPagAss (ActChgCrsTT1stDay + 13) -#define ActEditorAss (ActChgCrsTT1stDay + 14) -#define ActPlaTxtEdiAss (ActChgCrsTT1stDay + 15) -#define ActRchTxtEdiAss (ActChgCrsTT1stDay + 16) -#define ActRcvPlaTxtAss (ActChgCrsTT1stDay + 17) -#define ActRcvRchTxtAss (ActChgCrsTT1stDay + 18) +#define ActEdiAss (ActChgCrsTT1stDay + 9) +#define ActChgFrcReaAss (ActChgCrsTT1stDay + 10) +#define ActChgHavReaAss (ActChgCrsTT1stDay + 11) +#define ActSelInfSrcAss (ActChgCrsTT1stDay + 12) +#define ActRcvURLAss (ActChgCrsTT1stDay + 13) +#define ActRcvPagAss (ActChgCrsTT1stDay + 14) +#define ActEditorAss (ActChgCrsTT1stDay + 15) +#define ActPlaTxtEdiAss (ActChgCrsTT1stDay + 16) +#define ActRchTxtEdiAss (ActChgCrsTT1stDay + 17) +#define ActRcvPlaTxtAss (ActChgCrsTT1stDay + 18) +#define ActRcvRchTxtAss (ActChgCrsTT1stDay + 19) -#define ActFrmNewAsg (ActChgCrsTT1stDay + 19) -#define ActEdiOneAsg (ActChgCrsTT1stDay + 20) -#define ActPrnOneAsg (ActChgCrsTT1stDay + 21) -#define ActNewAsg (ActChgCrsTT1stDay + 22) -#define ActChgAsg (ActChgCrsTT1stDay + 23) -#define ActReqRemAsg (ActChgCrsTT1stDay + 24) -#define ActRemAsg (ActChgCrsTT1stDay + 25) -#define ActHidAsg (ActChgCrsTT1stDay + 26) -#define ActShoAsg (ActChgCrsTT1stDay + 27) +#define ActFrmNewAsg (ActChgCrsTT1stDay + 20) +#define ActEdiOneAsg (ActChgCrsTT1stDay + 21) +#define ActPrnOneAsg (ActChgCrsTT1stDay + 22) +#define ActNewAsg (ActChgCrsTT1stDay + 23) +#define ActChgAsg (ActChgCrsTT1stDay + 24) +#define ActReqRemAsg (ActChgCrsTT1stDay + 25) +#define ActRemAsg (ActChgCrsTT1stDay + 26) +#define ActHidAsg (ActChgCrsTT1stDay + 27) +#define ActShoAsg (ActChgCrsTT1stDay + 28) -#define ActReqUsrPrj (ActChgCrsTT1stDay + 28) -#define ActSeeTblAllPrj (ActChgCrsTT1stDay + 29) -#define ActCfgPrj (ActChgCrsTT1stDay + 30) -#define ActRcvCfgPrj (ActChgCrsTT1stDay + 31) -#define ActReqLckAllPrj (ActChgCrsTT1stDay + 32) -#define ActReqUnlAllPrj (ActChgCrsTT1stDay + 33) -#define ActLckAllPrj (ActChgCrsTT1stDay + 34) -#define ActUnlAllPrj (ActChgCrsTT1stDay + 35) -#define ActFrmNewPrj (ActChgCrsTT1stDay + 36) -#define ActEdiOnePrj (ActChgCrsTT1stDay + 37) -#define ActPrnOnePrj (ActChgCrsTT1stDay + 38) -#define ActNewPrj (ActChgCrsTT1stDay + 39) -#define ActChgPrj (ActChgCrsTT1stDay + 40) -#define ActReqRemPrj (ActChgCrsTT1stDay + 41) -#define ActRemPrj (ActChgCrsTT1stDay + 42) -#define ActHidPrj (ActChgCrsTT1stDay + 43) -#define ActShoPrj (ActChgCrsTT1stDay + 44) -#define ActLckPrj (ActChgCrsTT1stDay + 45) -#define ActUnlPrj (ActChgCrsTT1stDay + 46) -#define ActReqAddStdPrj (ActChgCrsTT1stDay + 47) -#define ActReqAddTutPrj (ActChgCrsTT1stDay + 48) -#define ActReqAddEvlPrj (ActChgCrsTT1stDay + 49) -#define ActAddStdPrj (ActChgCrsTT1stDay + 50) -#define ActAddTutPrj (ActChgCrsTT1stDay + 51) -#define ActAddEvlPrj (ActChgCrsTT1stDay + 52) -#define ActReqRemStdPrj (ActChgCrsTT1stDay + 53) -#define ActReqRemTutPrj (ActChgCrsTT1stDay + 54) -#define ActReqRemEvlPrj (ActChgCrsTT1stDay + 55) -#define ActRemStdPrj (ActChgCrsTT1stDay + 56) -#define ActRemTutPrj (ActChgCrsTT1stDay + 57) -#define ActRemEvlPrj (ActChgCrsTT1stDay + 58) +#define ActReqUsrPrj (ActChgCrsTT1stDay + 29) +#define ActSeeTblAllPrj (ActChgCrsTT1stDay + 30) +#define ActCfgPrj (ActChgCrsTT1stDay + 31) +#define ActRcvCfgPrj (ActChgCrsTT1stDay + 32) +#define ActReqLckAllPrj (ActChgCrsTT1stDay + 33) +#define ActReqUnlAllPrj (ActChgCrsTT1stDay + 34) +#define ActLckAllPrj (ActChgCrsTT1stDay + 35) +#define ActUnlAllPrj (ActChgCrsTT1stDay + 36) +#define ActFrmNewPrj (ActChgCrsTT1stDay + 37) +#define ActEdiOnePrj (ActChgCrsTT1stDay + 38) +#define ActPrnOnePrj (ActChgCrsTT1stDay + 39) +#define ActNewPrj (ActChgCrsTT1stDay + 40) +#define ActChgPrj (ActChgCrsTT1stDay + 41) +#define ActReqRemPrj (ActChgCrsTT1stDay + 42) +#define ActRemPrj (ActChgCrsTT1stDay + 43) +#define ActHidPrj (ActChgCrsTT1stDay + 44) +#define ActShoPrj (ActChgCrsTT1stDay + 45) +#define ActLckPrj (ActChgCrsTT1stDay + 46) +#define ActUnlPrj (ActChgCrsTT1stDay + 47) +#define ActReqAddStdPrj (ActChgCrsTT1stDay + 48) +#define ActReqAddTutPrj (ActChgCrsTT1stDay + 49) +#define ActReqAddEvlPrj (ActChgCrsTT1stDay + 50) +#define ActAddStdPrj (ActChgCrsTT1stDay + 51) +#define ActAddTutPrj (ActChgCrsTT1stDay + 52) +#define ActAddEvlPrj (ActChgCrsTT1stDay + 53) +#define ActReqRemStdPrj (ActChgCrsTT1stDay + 54) +#define ActReqRemTutPrj (ActChgCrsTT1stDay + 55) +#define ActReqRemEvlPrj (ActChgCrsTT1stDay + 56) +#define ActRemStdPrj (ActChgCrsTT1stDay + 57) +#define ActRemTutPrj (ActChgCrsTT1stDay + 58) +#define ActRemEvlPrj (ActChgCrsTT1stDay + 59) -#define ActAdmDocPrj (ActChgCrsTT1stDay + 59) -#define ActReqRemFilDocPrj (ActChgCrsTT1stDay + 60) -#define ActRemFilDocPrj (ActChgCrsTT1stDay + 61) -#define ActRemFolDocPrj (ActChgCrsTT1stDay + 62) -#define ActCopDocPrj (ActChgCrsTT1stDay + 63) -#define ActPasDocPrj (ActChgCrsTT1stDay + 64) -#define ActRemTreDocPrj (ActChgCrsTT1stDay + 65) -#define ActFrmCreDocPrj (ActChgCrsTT1stDay + 66) -#define ActCreFolDocPrj (ActChgCrsTT1stDay + 67) -#define ActCreLnkDocPrj (ActChgCrsTT1stDay + 68) -#define ActRenFolDocPrj (ActChgCrsTT1stDay + 69) -#define ActRcvFilDocPrjDZ (ActChgCrsTT1stDay + 70) -#define ActRcvFilDocPrjCla (ActChgCrsTT1stDay + 71) -#define ActExpDocPrj (ActChgCrsTT1stDay + 72) -#define ActConDocPrj (ActChgCrsTT1stDay + 73) -#define ActZIPDocPrj (ActChgCrsTT1stDay + 74) -#define ActReqDatDocPrj (ActChgCrsTT1stDay + 75) -#define ActChgDatDocPrj (ActChgCrsTT1stDay + 76) -#define ActDowDocPrj (ActChgCrsTT1stDay + 77) +#define ActAdmDocPrj (ActChgCrsTT1stDay + 60) +#define ActReqRemFilDocPrj (ActChgCrsTT1stDay + 61) +#define ActRemFilDocPrj (ActChgCrsTT1stDay + 62) +#define ActRemFolDocPrj (ActChgCrsTT1stDay + 63) +#define ActCopDocPrj (ActChgCrsTT1stDay + 64) +#define ActPasDocPrj (ActChgCrsTT1stDay + 65) +#define ActRemTreDocPrj (ActChgCrsTT1stDay + 66) +#define ActFrmCreDocPrj (ActChgCrsTT1stDay + 67) +#define ActCreFolDocPrj (ActChgCrsTT1stDay + 68) +#define ActCreLnkDocPrj (ActChgCrsTT1stDay + 69) +#define ActRenFolDocPrj (ActChgCrsTT1stDay + 70) +#define ActRcvFilDocPrjDZ (ActChgCrsTT1stDay + 71) +#define ActRcvFilDocPrjCla (ActChgCrsTT1stDay + 72) +#define ActExpDocPrj (ActChgCrsTT1stDay + 73) +#define ActConDocPrj (ActChgCrsTT1stDay + 74) +#define ActZIPDocPrj (ActChgCrsTT1stDay + 75) +#define ActReqDatDocPrj (ActChgCrsTT1stDay + 76) +#define ActChgDatDocPrj (ActChgCrsTT1stDay + 77) +#define ActDowDocPrj (ActChgCrsTT1stDay + 78) -#define ActAdmAssPrj (ActChgCrsTT1stDay + 78) -#define ActReqRemFilAssPrj (ActChgCrsTT1stDay + 79) -#define ActRemFilAssPrj (ActChgCrsTT1stDay + 80) -#define ActRemFolAssPrj (ActChgCrsTT1stDay + 81) -#define ActCopAssPrj (ActChgCrsTT1stDay + 82) -#define ActPasAssPrj (ActChgCrsTT1stDay + 83) -#define ActRemTreAssPrj (ActChgCrsTT1stDay + 84) -#define ActFrmCreAssPrj (ActChgCrsTT1stDay + 85) -#define ActCreFolAssPrj (ActChgCrsTT1stDay + 86) -#define ActCreLnkAssPrj (ActChgCrsTT1stDay + 87) -#define ActRenFolAssPrj (ActChgCrsTT1stDay + 88) -#define ActRcvFilAssPrjDZ (ActChgCrsTT1stDay + 89) -#define ActRcvFilAssPrjCla (ActChgCrsTT1stDay + 90) -#define ActExpAssPrj (ActChgCrsTT1stDay + 91) -#define ActConAssPrj (ActChgCrsTT1stDay + 92) -#define ActZIPAssPrj (ActChgCrsTT1stDay + 93) -#define ActReqDatAssPrj (ActChgCrsTT1stDay + 94) -#define ActChgDatAssPrj (ActChgCrsTT1stDay + 95) -#define ActDowAssPrj (ActChgCrsTT1stDay + 96) +#define ActAdmAssPrj (ActChgCrsTT1stDay + 79) +#define ActReqRemFilAssPrj (ActChgCrsTT1stDay + 80) +#define ActRemFilAssPrj (ActChgCrsTT1stDay + 81) +#define ActRemFolAssPrj (ActChgCrsTT1stDay + 82) +#define ActCopAssPrj (ActChgCrsTT1stDay + 83) +#define ActPasAssPrj (ActChgCrsTT1stDay + 84) +#define ActRemTreAssPrj (ActChgCrsTT1stDay + 85) +#define ActFrmCreAssPrj (ActChgCrsTT1stDay + 86) +#define ActCreFolAssPrj (ActChgCrsTT1stDay + 87) +#define ActCreLnkAssPrj (ActChgCrsTT1stDay + 88) +#define ActRenFolAssPrj (ActChgCrsTT1stDay + 89) +#define ActRcvFilAssPrjDZ (ActChgCrsTT1stDay + 90) +#define ActRcvFilAssPrjCla (ActChgCrsTT1stDay + 91) +#define ActExpAssPrj (ActChgCrsTT1stDay + 92) +#define ActConAssPrj (ActChgCrsTT1stDay + 93) +#define ActZIPAssPrj (ActChgCrsTT1stDay + 94) +#define ActReqDatAssPrj (ActChgCrsTT1stDay + 95) +#define ActChgDatAssPrj (ActChgCrsTT1stDay + 96) +#define ActDowAssPrj (ActChgCrsTT1stDay + 97) -#define ActSeeTst (ActChgCrsTT1stDay + 97) -#define ActReqAssTst (ActChgCrsTT1stDay + 98) -#define ActAssTst (ActChgCrsTT1stDay + 99) -#define ActEdiTstQst (ActChgCrsTT1stDay + 100) -#define ActEdiOneTstQst (ActChgCrsTT1stDay + 101) -#define ActReqImpTstQst (ActChgCrsTT1stDay + 102) -#define ActImpTstQst (ActChgCrsTT1stDay + 103) -#define ActLstTstQst (ActChgCrsTT1stDay + 104) -#define ActRcvTstQst (ActChgCrsTT1stDay + 105) -#define ActReqRemSevTstQst (ActChgCrsTT1stDay + 106) -#define ActRemSevTstQst (ActChgCrsTT1stDay + 107) -#define ActReqRemOneTstQst (ActChgCrsTT1stDay + 108) -#define ActRemOneTstQst (ActChgCrsTT1stDay + 109) -#define ActChgShfTstQst (ActChgCrsTT1stDay + 110) -#define ActCfgTst (ActChgCrsTT1stDay + 111) -#define ActEnableTag (ActChgCrsTT1stDay + 112) -#define ActDisableTag (ActChgCrsTT1stDay + 113) -#define ActRenTag (ActChgCrsTT1stDay + 114) -#define ActRcvCfgTst (ActChgCrsTT1stDay + 115) +#define ActSeeTst (ActChgCrsTT1stDay + 98) +#define ActReqAssTst (ActChgCrsTT1stDay + 99) +#define ActAssTst (ActChgCrsTT1stDay + 100) +#define ActEdiTstQst (ActChgCrsTT1stDay + 101) +#define ActEdiOneTstQst (ActChgCrsTT1stDay + 102) +#define ActReqImpTstQst (ActChgCrsTT1stDay + 103) +#define ActImpTstQst (ActChgCrsTT1stDay + 104) +#define ActLstTstQst (ActChgCrsTT1stDay + 105) +#define ActRcvTstQst (ActChgCrsTT1stDay + 106) +#define ActReqRemSevTstQst (ActChgCrsTT1stDay + 107) +#define ActRemSevTstQst (ActChgCrsTT1stDay + 108) +#define ActReqRemOneTstQst (ActChgCrsTT1stDay + 109) +#define ActRemOneTstQst (ActChgCrsTT1stDay + 110) +#define ActChgShfTstQst (ActChgCrsTT1stDay + 111) +#define ActCfgTst (ActChgCrsTT1stDay + 112) +#define ActEnableTag (ActChgCrsTT1stDay + 113) +#define ActDisableTag (ActChgCrsTT1stDay + 114) +#define ActRenTag (ActChgCrsTT1stDay + 115) +#define ActRcvCfgTst (ActChgCrsTT1stDay + 116) -#define ActReqSeeMyTstRes (ActChgCrsTT1stDay + 116) -#define ActSeeMyTstRes (ActChgCrsTT1stDay + 117) -#define ActSeeOneTstResMe (ActChgCrsTT1stDay + 118) -#define ActReqSeeUsrTstRes (ActChgCrsTT1stDay + 119) -#define ActSeeUsrTstRes (ActChgCrsTT1stDay + 120) -#define ActSeeOneTstResOth (ActChgCrsTT1stDay + 121) +#define ActReqSeeMyTstRes (ActChgCrsTT1stDay + 117) +#define ActSeeMyTstRes (ActChgCrsTT1stDay + 118) +#define ActSeeOneTstResMe (ActChgCrsTT1stDay + 119) +#define ActReqSeeUsrTstRes (ActChgCrsTT1stDay + 120) +#define ActSeeUsrTstRes (ActChgCrsTT1stDay + 121) +#define ActSeeOneTstResOth (ActChgCrsTT1stDay + 122) -#define ActSeeGam (ActChgCrsTT1stDay + 122) -#define ActReqRemMch (ActChgCrsTT1stDay + 123) -#define ActRemMch (ActChgCrsTT1stDay + 124) -#define ActReqNewMch (ActChgCrsTT1stDay + 125) -#define ActNewMch (ActChgCrsTT1stDay + 126) -#define ActResMch (ActChgCrsTT1stDay + 127) -#define ActBckMch (ActChgCrsTT1stDay + 128) -#define ActPlyPauMch (ActChgCrsTT1stDay + 129) -#define ActFwdMch (ActChgCrsTT1stDay + 130) -#define ActChgNumColMch (ActChgCrsTT1stDay + 131) -#define ActChgVisResMchQst (ActChgCrsTT1stDay + 132) -#define ActMchCntDwn (ActChgCrsTT1stDay + 133) -#define ActRefMchTch (ActChgCrsTT1stDay + 134) +#define ActSeeExa (ActChgCrsTT1stDay + 123) +#define ActReqRemExaEvt (ActChgCrsTT1stDay + 124) +#define ActRemExaEvt (ActChgCrsTT1stDay + 125) +#define ActReqNewExaEvt (ActChgCrsTT1stDay + 126) +#define ActNewExaEvt (ActChgCrsTT1stDay + 127) +#define ActResExaEvt (ActChgCrsTT1stDay + 128) +#define ActBckExaEvt (ActChgCrsTT1stDay + 129) +#define ActPlyPauExaEvt (ActChgCrsTT1stDay + 130) +#define ActFwdExaEvt (ActChgCrsTT1stDay + 131) +#define ActChgNumColExaEvt (ActChgCrsTT1stDay + 132) +#define ActChgVisResExaEvtQst (ActChgCrsTT1stDay + 133) +#define ActExaEvtCntDwn (ActChgCrsTT1stDay + 134) +#define ActRefExaEvtTch (ActChgCrsTT1stDay + 135) +#define ActJoiExaEvt (ActChgCrsTT1stDay + 136) +#define ActSeeExaEvtAnsQstStd (ActChgCrsTT1stDay + 137) +#define ActRemExaEvtAnsQstStd (ActChgCrsTT1stDay + 138) +#define ActAnsExaEvtQstStd (ActChgCrsTT1stDay + 139) +#define ActRefExaEvtStd (ActChgCrsTT1stDay + 140) -#define ActJoiMch (ActChgCrsTT1stDay + 135) -#define ActSeeMchAnsQstStd (ActChgCrsTT1stDay + 136) -#define ActRemMchAnsQstStd (ActChgCrsTT1stDay + 137) -#define ActAnsMchQstStd (ActChgCrsTT1stDay + 138) -#define ActRefMchStd (ActChgCrsTT1stDay + 139) +#define ActSeeMyExaEvtResCrs (ActChgCrsTT1stDay + 141) +#define ActSeeMyExaEvtResExa (ActChgCrsTT1stDay + 142) +#define ActSeeMyExaEvtResEvt (ActChgCrsTT1stDay + 143) +#define ActSeeOneExaEvtResMe (ActChgCrsTT1stDay + 144) -#define ActSeeMyMchResCrs (ActChgCrsTT1stDay + 140) -#define ActSeeMyMchResGam (ActChgCrsTT1stDay + 141) -#define ActSeeMyMchResMch (ActChgCrsTT1stDay + 142) -#define ActSeeOneMchResMe (ActChgCrsTT1stDay + 143) +#define ActReqSeeAllExaEvtRes (ActChgCrsTT1stDay + 145) +#define ActSeeAllExaEvtResCrs (ActChgCrsTT1stDay + 146) +#define ActSeeAllExaEvtResExa (ActChgCrsTT1stDay + 147) +#define ActSeeAllExaEvtResEvt (ActChgCrsTT1stDay + 148) +#define ActSeeOneExaEvtResOth (ActChgCrsTT1stDay + 149) -#define ActReqSeeAllMchRes (ActChgCrsTT1stDay + 144) -#define ActSeeAllMchResCrs (ActChgCrsTT1stDay + 145) -#define ActSeeAllMchResGam (ActChgCrsTT1stDay + 146) -#define ActSeeAllMchResMch (ActChgCrsTT1stDay + 147) -#define ActSeeOneMchResOth (ActChgCrsTT1stDay + 148) +#define ActChgVisResExaEvtUsr (ActChgCrsTT1stDay + 150) -#define ActChgVisResMchUsr (ActChgCrsTT1stDay + 149) +#define ActFrmNewExa (ActChgCrsTT1stDay + 151) +#define ActEdiOneExa (ActChgCrsTT1stDay + 152) +#define ActNewExa (ActChgCrsTT1stDay + 153) +#define ActChgExa (ActChgCrsTT1stDay + 154) +#define ActReqRemExa (ActChgCrsTT1stDay + 155) +#define ActRemExa (ActChgCrsTT1stDay + 156) +#define ActHidExa (ActChgCrsTT1stDay + 157) +#define ActShoExa (ActChgCrsTT1stDay + 158) +#define ActAddOneExaQst (ActChgCrsTT1stDay + 159) +#define ActExaLstTstQst (ActChgCrsTT1stDay + 160) +#define ActAddTstQstToExa (ActChgCrsTT1stDay + 161) +#define ActReqRemExaQst (ActChgCrsTT1stDay + 162) +#define ActRemExaQst (ActChgCrsTT1stDay + 163) +#define ActUp_ExaQst (ActChgCrsTT1stDay + 164) +#define ActDwnExaQst (ActChgCrsTT1stDay + 165) -#define ActFrmNewGam (ActChgCrsTT1stDay + 150) -#define ActEdiOneGam (ActChgCrsTT1stDay + 151) -#define ActNewGam (ActChgCrsTT1stDay + 152) -#define ActChgGam (ActChgCrsTT1stDay + 153) -#define ActReqRemGam (ActChgCrsTT1stDay + 154) -#define ActRemGam (ActChgCrsTT1stDay + 155) -#define ActHidGam (ActChgCrsTT1stDay + 156) -#define ActShoGam (ActChgCrsTT1stDay + 157) -#define ActAddOneGamQst (ActChgCrsTT1stDay + 158) -#define ActGamLstTstQst (ActChgCrsTT1stDay + 159) -#define ActAddTstQstToGam (ActChgCrsTT1stDay + 160) -#define ActReqRemGamQst (ActChgCrsTT1stDay + 161) -#define ActRemGamQst (ActChgCrsTT1stDay + 162) -#define ActUp_GamQst (ActChgCrsTT1stDay + 163) -#define ActDwnGamQst (ActChgCrsTT1stDay + 164) +#define ActSeeGam (ActChgCrsTT1stDay + 166) +#define ActReqRemMch (ActChgCrsTT1stDay + 167) +#define ActRemMch (ActChgCrsTT1stDay + 168) +#define ActReqNewMch (ActChgCrsTT1stDay + 169) +#define ActNewMch (ActChgCrsTT1stDay + 170) +#define ActResMch (ActChgCrsTT1stDay + 171) +#define ActBckMch (ActChgCrsTT1stDay + 172) +#define ActPlyPauMch (ActChgCrsTT1stDay + 173) +#define ActFwdMch (ActChgCrsTT1stDay + 174) +#define ActChgNumColMch (ActChgCrsTT1stDay + 175) +#define ActChgVisResMchQst (ActChgCrsTT1stDay + 176) +#define ActMchCntDwn (ActChgCrsTT1stDay + 177) +#define ActRefMchTch (ActChgCrsTT1stDay + 178) -#define ActSeeSvy (ActChgCrsTT1stDay + 165) -#define ActAnsSvy (ActChgCrsTT1stDay + 166) -#define ActFrmNewSvy (ActChgCrsTT1stDay + 167) -#define ActEdiOneSvy (ActChgCrsTT1stDay + 168) -#define ActNewSvy (ActChgCrsTT1stDay + 169) -#define ActChgSvy (ActChgCrsTT1stDay + 170) -#define ActReqRemSvy (ActChgCrsTT1stDay + 171) -#define ActRemSvy (ActChgCrsTT1stDay + 172) -#define ActReqRstSvy (ActChgCrsTT1stDay + 173) -#define ActRstSvy (ActChgCrsTT1stDay + 174) -#define ActHidSvy (ActChgCrsTT1stDay + 175) -#define ActShoSvy (ActChgCrsTT1stDay + 176) -#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 177) -#define ActRcvSvyQst (ActChgCrsTT1stDay + 178) -#define ActReqRemSvyQst (ActChgCrsTT1stDay + 179) -#define ActRemSvyQst (ActChgCrsTT1stDay + 180) +#define ActJoiMch (ActChgCrsTT1stDay + 179) +#define ActSeeMchAnsQstStd (ActChgCrsTT1stDay + 180) +#define ActRemMchAnsQstStd (ActChgCrsTT1stDay + 181) +#define ActAnsMchQstStd (ActChgCrsTT1stDay + 182) +#define ActRefMchStd (ActChgCrsTT1stDay + 183) -#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 181) -#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 182) -#define ActEdiExaAnn (ActChgCrsTT1stDay + 183) -#define ActRcvExaAnn (ActChgCrsTT1stDay + 184) -#define ActPrnExaAnn (ActChgCrsTT1stDay + 185) -#define ActReqRemExaAnn (ActChgCrsTT1stDay + 186) -#define ActRemExaAnn (ActChgCrsTT1stDay + 187) -#define ActHidExaAnn (ActChgCrsTT1stDay + 188) -#define ActShoExaAnn (ActChgCrsTT1stDay + 189) +#define ActSeeMyMchResCrs (ActChgCrsTT1stDay + 184) +#define ActSeeMyMchResGam (ActChgCrsTT1stDay + 185) +#define ActSeeMyMchResMch (ActChgCrsTT1stDay + 186) +#define ActSeeOneMchResMe (ActChgCrsTT1stDay + 187) + +#define ActReqSeeAllMchRes (ActChgCrsTT1stDay + 188) +#define ActSeeAllMchResCrs (ActChgCrsTT1stDay + 189) +#define ActSeeAllMchResGam (ActChgCrsTT1stDay + 190) +#define ActSeeAllMchResMch (ActChgCrsTT1stDay + 191) +#define ActSeeOneMchResOth (ActChgCrsTT1stDay + 192) + +#define ActChgVisResMchUsr (ActChgCrsTT1stDay + 193) + +#define ActFrmNewGam (ActChgCrsTT1stDay + 194) +#define ActEdiOneGam (ActChgCrsTT1stDay + 195) +#define ActNewGam (ActChgCrsTT1stDay + 196) +#define ActChgGam (ActChgCrsTT1stDay + 197) +#define ActReqRemGam (ActChgCrsTT1stDay + 198) +#define ActRemGam (ActChgCrsTT1stDay + 199) +#define ActHidGam (ActChgCrsTT1stDay + 200) +#define ActShoGam (ActChgCrsTT1stDay + 201) +#define ActAddOneGamQst (ActChgCrsTT1stDay + 202) +#define ActGamLstTstQst (ActChgCrsTT1stDay + 203) +#define ActAddTstQstToGam (ActChgCrsTT1stDay + 204) +#define ActReqRemGamQst (ActChgCrsTT1stDay + 205) +#define ActRemGamQst (ActChgCrsTT1stDay + 206) +#define ActUp_GamQst (ActChgCrsTT1stDay + 207) +#define ActDwnGamQst (ActChgCrsTT1stDay + 208) + +#define ActSeeSvy (ActChgCrsTT1stDay + 209) +#define ActAnsSvy (ActChgCrsTT1stDay + 210) +#define ActFrmNewSvy (ActChgCrsTT1stDay + 211) +#define ActEdiOneSvy (ActChgCrsTT1stDay + 212) +#define ActNewSvy (ActChgCrsTT1stDay + 213) +#define ActChgSvy (ActChgCrsTT1stDay + 214) +#define ActReqRemSvy (ActChgCrsTT1stDay + 215) +#define ActRemSvy (ActChgCrsTT1stDay + 216) +#define ActReqRstSvy (ActChgCrsTT1stDay + 217) +#define ActRstSvy (ActChgCrsTT1stDay + 218) +#define ActHidSvy (ActChgCrsTT1stDay + 219) +#define ActShoSvy (ActChgCrsTT1stDay + 220) +#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 221) +#define ActRcvSvyQst (ActChgCrsTT1stDay + 222) +#define ActReqRemSvyQst (ActChgCrsTT1stDay + 223) +#define ActRemSvyQst (ActChgCrsTT1stDay + 224) + +#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 225) +#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 226) +#define ActEdiExaAnn (ActChgCrsTT1stDay + 227) +#define ActRcvExaAnn (ActChgCrsTT1stDay + 228) +#define ActPrnExaAnn (ActChgCrsTT1stDay + 229) +#define ActReqRemExaAnn (ActChgCrsTT1stDay + 230) +#define ActRemExaAnn (ActChgCrsTT1stDay + 231) +#define ActHidExaAnn (ActChgCrsTT1stDay + 232) +#define ActShoExaAnn (ActChgCrsTT1stDay + 233) /*****************************************************************************/ /******************************** Files tab **********************************/ diff --git a/swad_changelog.h b/swad_changelog.h index 58a611f6..91181535 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.191 (2020-04-20)" +#define Log_PLATFORM_VERSION "SWAD 19.192 (2020-04-22)" #define CSS_FILE "swad19.190.css" #define JS_FILE "swad19.172.1.js" /* @@ -552,6 +552,13 @@ Funci // TODO: Cambiar icono notificaciones nuevas con "bell-on.svg" // TODO: Ahmed El Moukhtari Koubaa: Cuando le damos a la opción de mostrar solo los mensajes no leídos, se muestran estos mensajes, pero cuando los intentamos leer, es decir, hacemos clic sobre ellos se recarga toda la página por así decirlo y vuelve a dar una lista con los mensajes, pero descartando aquel que clicamos porque, entiendo yo al menos, que ya lo ha marcado como leído. + Version 19.192: Apr 22, 2020 Changes in exams. (296803 lines) + Copy the following 4 icons to icon public directory: +sudo cp icon/iconset/awesome/file-contract.svg /var/www/html/swad/icon/iconset/awesome +sudo cp icon/iconset/awesome/file-invoice.svg /var/www/html/swad/icon/iconset/awesome +sudo cp icon/iconset/nuvola/file-contract.png /var/www/html/swad/icon/iconset/nuvola +sudo cp icon/iconset/nuvola/file-invoice.png /var/www/html/swad/icon/iconset/nuvola + Version 19.191: Apr 20, 2020 Module swad_exam for exam announcements is renamed as swad_exam_announcement. New modules swad_exam, swad_exam_event and swad_exam_result to make exams. (295885 lines) Version 19.190.5: Apr 19, 2020 Anchors in forms to edit buildings and rooms. (288527 lines) diff --git a/swad_config.h b/swad_config.h index 19f84932..b9ef34c6 100644 --- a/swad_config.h +++ b/swad_config.h @@ -28,9 +28,9 @@ /** Uncomment one of the following installations of SWAD or create your own **/ /*****************************************************************************/ -//#define LOCALHOST_UBUNTU // Comment this line if not applicable +#define LOCALHOST_UBUNTU // Comment this line if not applicable //#define OPENSWAD_ORG // Comment this line if not applicable -#define SWAD_UGR_ES // Comment this line if not applicable +//#define SWAD_UGR_ES // Comment this line if not applicable //#define SWADBERRY_UGR_ES // Comment this line if not applicable /*****************************************************************************/ diff --git a/swad_course.c b/swad_course.c index 56b91f01..b48b59ac 100644 --- a/swad_course.c +++ b/swad_course.c @@ -1891,7 +1891,7 @@ static void Crs_EmptyCourseCompletely (long CrsCod) Svy_RemoveSurveys (Hie_CRS,CrsCod); /***** Remove all test exams made in the course *****/ - TstExa_RemoveCrsExams (CrsCod); + TstRes_RemoveCrsExams (CrsCod); /***** Remove all tests questions in the course *****/ Tst_RemoveCrsTests (CrsCod); diff --git a/swad_database.c b/swad_database.c index d2fd627a..1afa7b16 100644 --- a/swad_database.c +++ b/swad_database.c @@ -1463,7 +1463,7 @@ mysql> DESCRIBE mch_indexes; DB_CreateTable ("CREATE TABLE IF NOT EXISTS mch_indexes (" "MchCod INT NOT NULL," "QstInd INT NOT NULL," - "Indexes TEXT NOT NULL," // TstExa_MAX_BYTES_INDEXES_ONE_QST + "Indexes TEXT NOT NULL," // TstRes_MAX_BYTES_INDEXES_ONE_QST "UNIQUE INDEX(MchCod,QstInd))"); /***** Table mch_results *****/ @@ -2886,8 +2886,8 @@ mysql> DESCRIBE tst_exam_questions; "QstCod INT NOT NULL," "QstInd INT NOT NULL," "Score DOUBLE PRECISION NOT NULL DEFAULT 0," - "Indexes TEXT NOT NULL," // TstExa_MAX_BYTES_INDEXES_ONE_QST - "Answers TEXT NOT NULL," // TstExa_MAX_BYTES_ANSWERS_ONE_QST + "Indexes TEXT NOT NULL," // TstRes_MAX_BYTES_INDEXES_ONE_QST + "Answers TEXT NOT NULL," // TstRes_MAX_BYTES_ANSWERS_ONE_QST "UNIQUE INDEX(ExaCod,QstCod))"); /***** Table tst_exams *****/ diff --git a/swad_enrolment.c b/swad_enrolment.c index acd3d959..e13e425a 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -4120,7 +4120,7 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat, Brw_RemoveSomeInfoAboutCrsUsrFilesFromDB (UsrDat->UsrCod,Crs->CrsCod); /***** Remove test results made by user in course *****/ - TstExa_RemoveExamsMadeByUsrInCrs (UsrDat->UsrCod,Crs->CrsCod); + TstRes_RemoveExamsMadeByUsrInCrs (UsrDat->UsrCod,Crs->CrsCod); /***** Set all the notifications for this user in this course as removed, except notifications about new messages *****/ diff --git a/swad_exam.c b/swad_exam.c index cbdf8105..db2111ef 100644 --- a/swad_exam.c +++ b/swad_exam.c @@ -36,6 +36,8 @@ #include "swad_database.h" #include "swad_exam.h" +#include "swad_exam_event.h" +#include "swad_exam_result.h" #include "swad_figure.h" #include "swad_form.h" #include "swad_global.h" @@ -348,7 +350,7 @@ static void Exa_PutIconsListExams (void *Exams) if (Exa_CheckIfICanEditExams ()) Exa_PutIconToCreateNewExam ((struct Exa_Exams *) Exams); - /***** Put icon to view matches results *****/ + /***** Put icon to view events results *****/ switch (Gbl.Usrs.Me.Role.Logged) { case Rol_STD: @@ -469,7 +471,7 @@ void Exa_ShowOnlyOneExamBegin (struct Exa_Exams *Exams, /***** Write questions of this exam *****/ Exa_ListExamQuestions (Exams,Exam); else - /***** List matches *****/ + /***** List events *****/ ExaEvt_ListEvents (Exams,Exam,PutFormNewMatch); } @@ -526,7 +528,7 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams, { if (asprintf (&Id,"exa_date_%u_%u",(unsigned) StartEndTime,UniqueId) < 0) Lay_NotEnoughMemoryExit (); - Color = Exam->NumUnfinishedEves ? (Exam->Hidden ? "DATE_GREEN_LIGHT": + Color = Exam->NumUnfinishedEvts ? (Exam->Hidden ? "DATE_GREEN_LIGHT": "DATE_GREEN") : (Exam->Hidden ? "DATE_RED_LIGHT": "DATE_RED"); @@ -577,7 +579,7 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams, TstVis_ShowVisibilityIcons (Exam->Visibility,Exam->Hidden); HTM_DIV_End (); - /***** Number of matches in exam *****/ + /***** Number of events in exam *****/ if (ShowOnlyThisExam) HTM_TD_Begin ("class=\"RT\""); else @@ -592,7 +594,7 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams, NULL); if (ShowOnlyThisExam) HTM_TxtColonNBSP (Txt_Matches); - HTM_Unsigned (Exam->NumEves); + HTM_Unsigned (Exam->NumEvts); HTM_BUTTON_End (); Frm_EndForm (); @@ -641,24 +643,24 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams, } /*****************************************************************************/ -/************* Put icon to show results of matches in an exam *****************/ +/************* Put icon to show results of events in an exam *****************/ /*****************************************************************************/ static void Exa_PutIconToShowResultsOfExam (void *Exams) { if (Exams) { - /***** Put icon to view matches results *****/ + /***** Put icon to view events results *****/ switch (Gbl.Usrs.Me.Role.Logged) { case Rol_STD: - Ico_PutContextualIconToShowResults (ActSeeMyEveResExa,ExaRes_RESULTS_BOX_ID, + Ico_PutContextualIconToShowResults (ActSeeMyExaEvtResExa,ExaRes_RESULTS_BOX_ID, Exa_PutParams,Exams); break; case Rol_NET: case Rol_TCH: case Rol_SYS_ADM: - Ico_PutContextualIconToShowResults (ActSeeAllEveResExa,ExaRes_RESULTS_BOX_ID, + Ico_PutContextualIconToShowResults (ActSeeAllExaEvtResExa,ExaRes_RESULTS_BOX_ID, Exa_PutParams,Exams); break; default: @@ -1007,11 +1009,11 @@ void Exa_GetDataOfExamByCod (struct Exa_Exam *Exam) /* Get number of questions */ Exam->NumQsts = Exa_GetNumQstsExam (Exam->ExaCod); - /* Get number of matches */ - Exam->NumEves = ExaEve_GetNumEvesInExam (Exam->ExaCod); + /* Get number of events */ + Exam->NumEvts = ExaEvt_GetNumEventsInExam (Exam->ExaCod); - /* Get number of unfinished matches */ - Exam->NumUnfinishedEves = ExaEvt_GetNumUnfinishedEvtsInExam (Exam->ExaCod); + /* Get number of unfinished events */ + Exam->NumUnfinishedEvts = ExaEvt_GetNumUnfinishedEventsInExam (Exam->ExaCod); } else /* Initialize to empty exam */ @@ -1067,8 +1069,8 @@ static void Exa_ResetExam (struct Exa_Exam *Exam) Exam->TimeUTC[Dat_END_TIME ] = (time_t) 0; Exam->Title[0] = '\0'; Exam->NumQsts = 0; - Exam->NumEves = 0; - Exam->NumUnfinishedEves = 0; + Exam->NumEvts = 0; + Exam->NumUnfinishedEvts = 0; Exam->Hidden = false; } @@ -1195,7 +1197,7 @@ void Exa_RemoveExam (void) static void Exa_RemoveExamFromAllTables (long ExaCod) { - /***** Remove all matches in this exam *****/ + /***** Remove all events in this exam *****/ ExaEvt_RemoveEventsInExamFromAllTables (ExaCod); /***** Remove exam question *****/ @@ -1215,7 +1217,7 @@ static void Exa_RemoveExamFromAllTables (long ExaCod) void Exa_RemoveExamsCrs (long CrsCod) { - /***** Remove all matches in this course *****/ + /***** Remove all events in this course *****/ ExaEvt_RemoveEventInCourseFromAllTables (CrsCod); /***** Remove the questions in exams *****/ @@ -1659,7 +1661,7 @@ void Exa_RequestNewQuestion (void) Lay_ShowErrorAndExit ("Code of exam is missing."); Exa_GetDataOfExamByCod (&Exam); - /***** Check if exam has matches *****/ + /***** Check if exam has events *****/ if (Exa_CheckIfEditable (&Exam)) { /***** Show form to create a new question in this exam *****/ @@ -1692,12 +1694,12 @@ void Exa_ListTstQuestionsToSelect (void) Lay_ShowErrorAndExit ("Code of exam is missing."); Exa_GetDataOfExamByCod (&Exam); - /***** Check if exam has matches *****/ + /***** Check if exam has events *****/ if (Exa_CheckIfEditable (&Exam)) { /***** List several test questions for selection *****/ Exams.ExaCod = Exam.ExaCod; - Tst_ListQuestionsToSelect (&Exams); + Tst_ListQuestionsToSelectForExam (&Exams); } else Lay_NoPermissionExit (); @@ -1733,11 +1735,11 @@ unsigned Exa_GetParamQstInd (void) static void Exa_RemAnswersOfAQuestion (long ExaCod,unsigned QstInd) { - /***** Remove answers from all matches of this exam *****/ + /***** Remove answers from all events of this exam *****/ DB_QueryDELETE ("can not remove the answers of a question", "DELETE FROM exa_answers" " USING exa_events,exa_answers" - " WHERE exa_events.ExaCod=%ld" // From all matches of this exam... + " WHERE exa_events.ExaCod=%ld" // From all events of this exam... " AND exa_events.EvtCod=exa_answers.EvtCod" " AND exa_answers.QstInd=%u", // ...remove only answers to this question ExaCod,QstInd); @@ -2159,7 +2161,7 @@ void Exa_AddTstQuestionsToExam (void) Lay_ShowErrorAndExit ("Code of exam is missing."); Exa_GetDataOfExamByCod (&Exam); - /***** Check if exam has matches *****/ + /***** Check if exam has events *****/ if (Exa_CheckIfEditable (&Exam)) { /***** Get selected questions *****/ @@ -2279,7 +2281,7 @@ void Exa_RequestRemoveQst (void) Lay_ShowErrorAndExit ("Code of exam is missing."); Exa_GetDataOfExamByCod (&Exam); - /***** Check if exam has matches *****/ + /***** Check if exam has events *****/ if (Exa_CheckIfEditable (&Exam)) { /***** Get question index *****/ @@ -2322,7 +2324,7 @@ void Exa_RemoveQst (void) Lay_ShowErrorAndExit ("Code of exam is missing."); Exa_GetDataOfExamByCod (&Exam); - /***** Check if exam has matches *****/ + /***** Check if exam has events *****/ if (Exa_CheckIfEditable (&Exam)) { /***** Get question index *****/ @@ -2386,7 +2388,7 @@ void Exa_MoveUpQst (void) Lay_ShowErrorAndExit ("Code of exam is missing."); Exa_GetDataOfExamByCod (&Exam); - /***** Check if exam has matches *****/ + /***** Check if exam has events *****/ if (Exa_CheckIfEditable (&Exam)) { /***** Get question index *****/ @@ -2441,7 +2443,7 @@ void Exa_MoveDownQst (void) Lay_ShowErrorAndExit ("Code of exam is missing."); Exa_GetDataOfExamByCod (&Exam); - /***** Check if exam has matches *****/ + /***** Check if exam has events *****/ if (Exa_CheckIfEditable (&Exam)) { /***** Get question index *****/ @@ -2533,15 +2535,15 @@ static void Exa_ExchangeQuestions (long ExaCod, } /*****************************************************************************/ -/*********** Get number of matches and check is edition is possible **********/ +/*********** Get number of events and check is edition is possible **********/ /*****************************************************************************/ -// Before calling this function, number of matches must be calculated +// Before calling this function, number of events must be calculated static bool Exa_CheckIfEditable (const struct Exa_Exam *Exam) { if (Exa_CheckIfICanEditExams ()) - /***** Questions are editable only if exam has no matches *****/ - return (bool) (Exam->NumEves == 0); // Exams with matches should not be edited + /***** Questions are editable only if exam has no events *****/ + return (bool) (Exam->NumEvts == 0); // Exams with events should not be edited else return false; // Questions are not editable } @@ -2562,10 +2564,10 @@ void Exa_PutButtonNewMatch (struct Exa_Exams *Exams,long ExaCod) } /*****************************************************************************/ -/************* Request the creation of a new match as a teacher **************/ +/************* Request the creation of a new event as a teacher **************/ /*****************************************************************************/ -void Exa_RequestNewMatch (void) +void Exa_RequestNewEvent (void) { struct Exa_Exams Exams; struct Exa_Exam Exam; diff --git a/swad_exam.h b/swad_exam.h index a9d3f8db..886747df 100644 --- a/swad_exam.h +++ b/swad_exam.h @@ -90,8 +90,8 @@ struct Exa_Exam time_t TimeUTC[Dat_NUM_START_END_TIME]; bool Hidden; // Exam is hidden unsigned NumQsts; // Number of questions in the exam - unsigned NumEves; // Number of events in the exam - unsigned NumUnfinishedEves; // Number of unfinished events in the exam + unsigned NumEvts; // Number of events in the exam + unsigned NumUnfinishedEvts; // Number of unfinished events in the exam }; /*****************************************************************************/ @@ -156,7 +156,7 @@ void Exa_MoveUpQst (void); void Exa_MoveDownQst (void); void Exa_PutButtonNewMatch (struct Exa_Exams *Exams,long ExaCod); -void Exa_RequestNewMatch (void); +void Exa_RequestNewEvent (void); unsigned Exa_GetNumCoursesWithExams (Hie_Level_t Scope); unsigned Exa_GetNumExams (Hie_Level_t Scope); diff --git a/swad_exam_event.c b/swad_exam_event.c index 2f421cee..0967c02d 100644 --- a/swad_exam_event.c +++ b/swad_exam_event.c @@ -112,24 +112,24 @@ static void ExaEvt_ListOneOrMoreEvents (struct Exa_Exams *Exams, MYSQL_RES *mysql_res); static void ExaEvt_ListOneOrMoreEventsHeading (bool ICanEditEvents); static bool ExaEvt_CheckIfICanEditEvents (void); -static bool ExaEvt_CheckIfICanEditThisEvent (const struct ExaEvt_Match *Event); +static bool ExaEvt_CheckIfICanEditThisEvent (const struct ExaEvt_Event *Event); static void ExaEvt_ListOneOrMoreEventsIcons (struct Exa_Exams *Exams, - const struct ExaEvt_Match *Event); -static void ExaEvt_ListOneOrMoreEventsAuthor (const struct ExaEvt_Match *Event); -static void ExaEvt_ListOneOrMoreEventsTimes (const struct ExaEvt_Match *Event,unsigned UniqueId); -static void ExaEvt_ListOneOrMoreEventsTitleGrps (const struct ExaEvt_Match *Event); -static void ExaEvt_GetAndWriteNamesOfGrpsAssociatedToEvent (const struct ExaEvt_Match *Event); -static void ExaEvt_ListOneOrMoreEventsNumPlayers (const struct ExaEvt_Match *Event); -static void ExaEvt_ListOneOrMoreEventsStatus (struct ExaEvt_Match *Event,unsigned NumQsts); + const struct ExaEvt_Event *Event); +static void ExaEvt_ListOneOrMoreEventsAuthor (const struct ExaEvt_Event *Event); +static void ExaEvt_ListOneOrMoreEventsTimes (const struct ExaEvt_Event *Event,unsigned UniqueId); +static void ExaEvt_ListOneOrMoreEventsTitleGrps (const struct ExaEvt_Event *Event); +static void ExaEvt_GetAndWriteNamesOfGrpsAssociatedToEvent (const struct ExaEvt_Event *Event); +static void ExaEvt_ListOneOrMoreEventsNumPlayers (const struct ExaEvt_Event *Event); +static void ExaEvt_ListOneOrMoreEventsStatus (struct ExaEvt_Event *Event,unsigned NumQsts); static void ExaEvt_ListOneOrMoreEventsResult (struct Exa_Exams *Exams, - const struct ExaEvt_Match *Event); + const struct ExaEvt_Event *Event); static void ExaEvt_ListOneOrMoreEventsResultStd (struct Exa_Exams *Exams, - const struct ExaEvt_Match *Event); + const struct ExaEvt_Event *Event); static void ExaEvt_ListOneOrMoreEventsResultTch (struct Exa_Exams *Exams, - const struct ExaEvt_Match *Event); + const struct ExaEvt_Event *Event); static void ExaEvt_GetEventDataFromRow (MYSQL_RES *mysql_res, - struct ExaEvt_Match *Event); + struct ExaEvt_Event *Event); static ExaEvt_Showing_t ExaEvt_GetShowingFromStr (const char *Str); static void ExaEvt_RemoveEventFromAllTables (long EvtCod); @@ -149,63 +149,63 @@ static void ExaEvt_CreateIndexes (long ExaCod,long EvtCod); static void ExaEvt_ReorderAnswer (long EvtCod,unsigned QstInd, const struct Tst_Question *Question); static void ExaEvt_CreateGrps (long EvtCod); -static void ExaEvt_UpdateEventStatusInDB (const struct ExaEvt_Match *Event); +static void ExaEvt_UpdateEventStatusInDB (const struct ExaEvt_Event *Event); -static void ExaEvt_UpdateElapsedTimeInQuestion (const struct ExaEvt_Match *Event); -static void ExaEvt_GetElapsedTimeInQuestion (const struct ExaEvt_Match *Event, +static void ExaEvt_UpdateElapsedTimeInQuestion (const struct ExaEvt_Event *Event); +static void ExaEvt_GetElapsedTimeInQuestion (const struct ExaEvt_Event *Event, struct Time *Time); -static void ExaEvt_GetElapsedTimeInMatch (const struct ExaEvt_Match *Event, +static void ExaEvt_GetElapsedTimeInMatch (const struct ExaEvt_Event *Event, struct Time *Time); static void ExaEvt_GetElapsedTime (unsigned NumRows,MYSQL_RES *mysql_res, struct Time *Time); -static void ExaEvt_SetMatchStatusToPrev (struct ExaEvt_Match *Event); -static void ExaEvt_SetMatchStatusToPrevQst (struct ExaEvt_Match *Event); -static void ExaEvt_SetMatchStatusToStart (struct ExaEvt_Match *Event); +static void ExaEvt_SetMatchStatusToPrev (struct ExaEvt_Event *Event); +static void ExaEvt_SetMatchStatusToPrevQst (struct ExaEvt_Event *Event); +static void ExaEvt_SetMatchStatusToStart (struct ExaEvt_Event *Event); -static void ExaEvt_SetMatchStatusToNext (struct ExaEvt_Match *Event); -static void ExaEvt_SetMatchStatusToNextQst (struct ExaEvt_Match *Event); -static void ExaEvt_SetMatchStatusToEnd (struct ExaEvt_Match *Event); +static void ExaEvt_SetMatchStatusToNext (struct ExaEvt_Event *Event); +static void ExaEvt_SetMatchStatusToNextQst (struct ExaEvt_Event *Event); +static void ExaEvt_SetMatchStatusToEnd (struct ExaEvt_Event *Event); -static void ExaEvt_ShowMatchStatusForTch (struct ExaEvt_Match *Event); -static void ExaEvt_ShowMatchStatusForStd (struct ExaEvt_Match *Event,ExaEvt_Update_t Update); +static void ExaEvt_ShowMatchStatusForTch (struct ExaEvt_Event *Event); +static void ExaEvt_ShowMatchStatusForStd (struct ExaEvt_Event *Event,ExaEvt_Update_t Update); -static void ExaEvt_ShowLeftColumnTch (struct ExaEvt_Match *Event); -static void ExaEvt_ShowRefreshablePartTch (struct ExaEvt_Match *Event); -static void ExaEvt_WriteElapsedTimeInEvt (struct ExaEvt_Match *Event); -static void ExaEvt_WriteElapsedTimeInQst (struct ExaEvt_Match *Event); -static void ExaEvt_WriteNumRespondersQst (struct ExaEvt_Match *Event); -static void ExaEvt_PutFormCountdown (struct ExaEvt_Match *Event,long Seconds,const char *Color); -static void ExaEvt_PutCountdownAndHourglassIcon (struct ExaEvt_Match *Event); -static void ExaEvt_PutFormsCountdown (struct ExaEvt_Match *Event); +static void ExaEvt_ShowLeftColumnTch (struct ExaEvt_Event *Event); +static void ExaEvt_ShowRefreshablePartTch (struct ExaEvt_Event *Event); +static void ExaEvt_WriteElapsedTimeInEvt (struct ExaEvt_Event *Event); +static void ExaEvt_WriteElapsedTimeInQst (struct ExaEvt_Event *Event); +static void ExaEvt_WriteNumRespondersQst (struct ExaEvt_Event *Event); +static void ExaEvt_PutFormCountdown (struct ExaEvt_Event *Event,long Seconds,const char *Color); +static void ExaEvt_PutCountdownAndHourglassIcon (struct ExaEvt_Event *Event); +static void ExaEvt_PutFormsCountdown (struct ExaEvt_Event *Event); -static void ExaEvt_ShowRightColumnTch (const struct ExaEvt_Match *Event); -static void ExaEvt_ShowLeftColumnStd (const struct ExaEvt_Match *Event, +static void ExaEvt_ShowRightColumnTch (const struct ExaEvt_Event *Event); +static void ExaEvt_ShowLeftColumnStd (const struct ExaEvt_Event *Event, const struct ExaEvt_UsrAnswer *UsrAnswer); -static void ExaEvt_ShowRightColumnStd (struct ExaEvt_Match *Event, +static void ExaEvt_ShowRightColumnStd (struct ExaEvt_Event *Event, const struct ExaEvt_UsrAnswer *UsrAnswer, ExaEvt_Update_t Update); -static void ExaEvt_ShowNumQstInEvt (const struct ExaEvt_Match *Event); -static void ExaEvt_PutMatchControlButtons (const struct ExaEvt_Match *Event); -static void ExaEvt_ShowFormColumns (const struct ExaEvt_Match *Event); +static void ExaEvt_ShowNumQstInEvt (const struct ExaEvt_Event *Event); +static void ExaEvt_PutMatchControlButtons (const struct ExaEvt_Event *Event); +static void ExaEvt_ShowFormColumns (const struct ExaEvt_Event *Event); static void ExaEvt_PutParamNumCols (unsigned NumCols); -static void ExaEvt_ShowEventTitleTch (const struct ExaEvt_Match *Event); -static void ExaEvt_ShowEventTitleStd (const struct ExaEvt_Match *Event); +static void ExaEvt_ShowEventTitleTch (const struct ExaEvt_Event *Event); +static void ExaEvt_ShowEventTitleStd (const struct ExaEvt_Event *Event); -static void ExaEvt_PutCheckboxResult (const struct ExaEvt_Match *Event); -static void ExaEvt_PutIfAnswered (const struct ExaEvt_Match *Event,bool Answered); -static void ExaEvt_PutIconToRemoveMyAnswer (const struct ExaEvt_Match *Event); -static void ExaEvt_ShowQuestionAndAnswersTch (const struct ExaEvt_Match *Event); -static void ExaEvt_WriteAnswersEventResult (const struct ExaEvt_Match *Event, +static void ExaEvt_PutCheckboxResult (const struct ExaEvt_Event *Event); +static void ExaEvt_PutIfAnswered (const struct ExaEvt_Event *Event,bool Answered); +static void ExaEvt_PutIconToRemoveMyAnswer (const struct ExaEvt_Event *Event); +static void ExaEvt_ShowQuestionAndAnswersTch (const struct ExaEvt_Event *Event); +static void ExaEvt_WriteAnswersEventResult (const struct ExaEvt_Event *Event, const struct Tst_Question *Question, const char *Class,bool ShowResult); -static bool ExaEvt_ShowQuestionAndAnswersStd (const struct ExaEvt_Match *Event, +static bool ExaEvt_ShowQuestionAndAnswersStd (const struct ExaEvt_Event *Event, const struct ExaEvt_UsrAnswer *UsrAnswer, ExaEvt_Update_t Update); -static void ExaEvt_ShowEventScore (const struct ExaEvt_Match *Event); +static void ExaEvt_ShowEventScore (const struct ExaEvt_Event *Event); static void ExaEvt_DrawEmptyScoreRow (unsigned NumRow,double MinScore,double MaxScore); static void ExaEvt_DrawScoreRow (double Score,double MinScore,double MaxScore, unsigned NumRow,unsigned NumUsrs,unsigned MaxUsrs); @@ -225,11 +225,11 @@ static void ExaEvt_RemoveOldPlayers (void); static void ExaEvt_UpdateEventAsBeingPlayed (long EvtCod); static void ExaEvt_SetEventAsNotBeingPlayed (long EvtCod); static bool ExaEvt_GetIfEventIsBeingPlayed (long EvtCod); -static void ExaEvt_GetNumPlayers (struct ExaEvt_Match *Event); +static void ExaEvt_GetNumPlayers (struct ExaEvt_Event *Event); -static void ExaEvt_RemoveMyAnswerToEventQuestion (const struct ExaEvt_Match *Event); +static void ExaEvt_RemoveMyAnswerToEventQuestion (const struct ExaEvt_Event *Event); -static void ExaEvt_ComputeScore (struct TstExa_Exam *Result); +static void ExaEvt_ComputeScore (struct TstRes_Result *Result); static unsigned ExaEvt_GetNumUsrsWhoHaveAnswerEvt (long EvtCod); @@ -350,7 +350,7 @@ void ExaEvt_ListEvents (struct Exa_Exams *Exams, /******************** Get exam event data using its code *********************/ /*****************************************************************************/ -void ExaEvt_GetDataOfEventByCod (struct ExaEvt_Match *Event) +void ExaEvt_GetDataOfEventByCod (struct ExaEvt_Event *Event) { MYSQL_RES *mysql_res; unsigned long NumRows; @@ -434,7 +434,7 @@ static void ExaEvt_PutIconToCreateNewEvent (struct Exa_Exams *Exams) extern const char *Txt_New_match; /***** Put form to create a new exam event *****/ - Ico_PutContextualIconToAdd (ActReqNewExaEvt,ExaEvt_NEW_MATCH_SECTION_ID, + Ico_PutContextualIconToAdd (ActReqNewExaEvt,ExaEvt_NEW_EVENT_SECTION_ID, Gam_PutParams,Exams, Txt_New_match); } @@ -450,7 +450,7 @@ static void ExaEvt_ListOneOrMoreEvents (struct Exa_Exams *Exams, { unsigned NumEvent; unsigned UniqueId; - struct ExaEvt_Match Event; + struct ExaEvt_Event Event; bool ICanEditEvents = ExaEvt_CheckIfICanEditEvents (); /***** Write the heading *****/ @@ -554,7 +554,7 @@ static bool ExaEvt_CheckIfICanEditEvents (void) /************** Check if I can edit (remove/resume) an exam event ************/ /*****************************************************************************/ -static bool ExaEvt_CheckIfICanEditThisEvent (const struct ExaEvt_Match *Event) +static bool ExaEvt_CheckIfICanEditThisEvent (const struct ExaEvt_Event *Event) { switch (Gbl.Usrs.Me.Role.Logged) { @@ -573,7 +573,7 @@ static bool ExaEvt_CheckIfICanEditThisEvent (const struct ExaEvt_Match *Event) /*****************************************************************************/ static void ExaEvt_ListOneOrMoreEventsIcons (struct Exa_Exams *Exams, - const struct ExaEvt_Match *Event) + const struct ExaEvt_Event *Event) { HTM_TD_Begin ("class=\"BT%u\"",Gbl.RowEvenOdd); @@ -597,7 +597,7 @@ static void ExaEvt_ListOneOrMoreEventsIcons (struct Exa_Exams *Exams, /*********** Put a column for teacher who created the exam event *************/ /*****************************************************************************/ -static void ExaEvt_ListOneOrMoreEventsAuthor (const struct ExaEvt_Match *Event) +static void ExaEvt_ListOneOrMoreEventsAuthor (const struct ExaEvt_Event *Event) { /***** Event author (teacher) *****/ HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd); @@ -609,7 +609,7 @@ static void ExaEvt_ListOneOrMoreEventsAuthor (const struct ExaEvt_Match *Event) /*************** Put a column for exam event start and end times *************/ /*****************************************************************************/ -static void ExaEvt_ListOneOrMoreEventsTimes (const struct ExaEvt_Match *Event,unsigned UniqueId) +static void ExaEvt_ListOneOrMoreEventsTimes (const struct ExaEvt_Event *Event,unsigned UniqueId) { Dat_StartEndTime_t StartEndTime; char *Id; @@ -637,7 +637,7 @@ static void ExaEvt_ListOneOrMoreEventsTimes (const struct ExaEvt_Match *Event,un /*************** Put a column for exam event title and grous *****************/ /*****************************************************************************/ -static void ExaEvt_ListOneOrMoreEventsTitleGrps (const struct ExaEvt_Match *Event) +static void ExaEvt_ListOneOrMoreEventsTitleGrps (const struct ExaEvt_Event *Event) { extern const char *Txt_Play; extern const char *Txt_Resume; @@ -666,7 +666,7 @@ static void ExaEvt_ListOneOrMoreEventsTitleGrps (const struct ExaEvt_Match *Even /********** Get and write the names of the groups of an exam event ***********/ /*****************************************************************************/ -static void ExaEvt_GetAndWriteNamesOfGrpsAssociatedToEvent (const struct ExaEvt_Match *Event) +static void ExaEvt_GetAndWriteNamesOfGrpsAssociatedToEvent (const struct ExaEvt_Event *Event) { extern const char *Txt_Group; extern const char *Txt_Groups; @@ -742,7 +742,7 @@ bool ExaEvt_CheckIfMatchIsAssociatedToGrp (long EvtCod,long GrpCod) /******************* Put a column for number of players **********************/ /*****************************************************************************/ -static void ExaEvt_ListOneOrMoreEventsNumPlayers (const struct ExaEvt_Match *Event) +static void ExaEvt_ListOneOrMoreEventsNumPlayers (const struct ExaEvt_Event *Event) { /***** Number of players who have answered any question in the exam event ******/ HTM_TD_Begin ("class=\"DAT RT COLOR%u\"",Gbl.RowEvenOdd); @@ -754,7 +754,7 @@ static void ExaEvt_ListOneOrMoreEventsNumPlayers (const struct ExaEvt_Match *Eve /******************** Put a column for exam event status *********************/ /*****************************************************************************/ -static void ExaEvt_ListOneOrMoreEventsStatus (struct ExaEvt_Match *Event,unsigned NumQsts) +static void ExaEvt_ListOneOrMoreEventsStatus (struct ExaEvt_Event *Event,unsigned NumQsts) { extern const char *Txt_Play; extern const char *Txt_Resume; @@ -787,7 +787,7 @@ static void ExaEvt_ListOneOrMoreEventsStatus (struct ExaEvt_Match *Event,unsigne /*****************************************************************************/ static void ExaEvt_ListOneOrMoreEventsResult (struct Exa_Exams *Exams, - const struct ExaEvt_Match *Event) + const struct ExaEvt_Event *Event) { HTM_TD_Begin ("class=\"DAT CT COLOR%u\"",Gbl.RowEvenOdd); @@ -810,7 +810,7 @@ static void ExaEvt_ListOneOrMoreEventsResult (struct Exa_Exams *Exams, } static void ExaEvt_ListOneOrMoreEventsResultStd (struct Exa_Exams *Exams, - const struct ExaEvt_Match *Event) + const struct ExaEvt_Event *Event) { extern const char *Txt_Results; @@ -831,7 +831,7 @@ static void ExaEvt_ListOneOrMoreEventsResultStd (struct Exa_Exams *Exams, } static void ExaEvt_ListOneOrMoreEventsResultTch (struct Exa_Exams *Exams, - const struct ExaEvt_Match *Event) + const struct ExaEvt_Event *Event) { extern const char *Txt_Visible_results; extern const char *Txt_Hidden_results; @@ -873,7 +873,7 @@ void ExaEvt_ToggleVisibilResultsEvtUsr (void) { struct Exa_Exams Exams; struct Exa_Exam Exam; - struct ExaEvt_Match Event; + struct ExaEvt_Event Event; /***** Reset games *****/ Gam_ResetGames (&Exams); @@ -906,7 +906,7 @@ void ExaEvt_ToggleVisibilResultsEvtUsr (void) /*****************************************************************************/ static void ExaEvt_GetEventDataFromRow (MYSQL_RES *mysql_res, - struct ExaEvt_Match *Event) + struct ExaEvt_Event *Event) { MYSQL_ROW row; Dat_StartEndTime_t StartEndTime; @@ -1015,7 +1015,7 @@ void ExaEvt_RequestRemoveEvent (void) extern const char *Txt_Remove_event; struct Exa_Exams Exams; struct Exa_Exam Exam; - struct ExaEvt_Match Event; + struct ExaEvt_Event Event; /***** Reset games *****/ Gam_ResetGames (&Exams); @@ -1047,7 +1047,7 @@ void ExaEvt_RemoveEvent (void) extern const char *Txt_Match_X_removed; struct Exa_Exams Exams; struct Exa_Exam Exam; - struct ExaEvt_Match Event; + struct ExaEvt_Event Event; /***** Reset games *****/ Gam_ResetGames (&Exams); @@ -1249,7 +1249,7 @@ static void ExaEvt_PutParamEvtCod (long EvtCod) void ExaEvt_GetAndCheckParameters (struct Exa_Exams *Exams, struct Exa_Exam *Exam, - struct ExaEvt_Match *Event) + struct ExaEvt_Event *Event) { /***** Get parameters *****/ /* Get parameters of exam */ @@ -1292,7 +1292,7 @@ static void ExaEvt_PutFormNewMatch (const struct Exa_Exam *Exam) extern const char *Txt_Play; /***** Start section for a new exam event *****/ - HTM_SECTION_Begin (ExaEvt_NEW_MATCH_SECTION_ID); + HTM_SECTION_Begin (ExaEvt_NEW_EVENT_SECTION_ID); /***** Begin form *****/ Frm_StartForm (ActNewExaEvt); @@ -1432,7 +1432,7 @@ void ExaEvt_CreateNewEventTch (void) void ExaEvt_ResumeEvent (void) { - struct ExaEvt_Match Event; + struct ExaEvt_Event Event; /***** Remove old players. This function must be called by a teacher @@ -1589,7 +1589,7 @@ static void ExaEvt_ReorderAnswer (long EvtCod,unsigned QstInd, long LongNum; unsigned AnsInd; char StrOneAnswer[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; - char StrAnswersOneQst[TstExa_MAX_BYTES_ANSWERS_ONE_QST + 1]; + char StrAnswersOneQst[TstRes_MAX_BYTES_ANSWERS_ONE_QST + 1]; /***** Initialize list of answers to empty string *****/ StrAnswersOneQst[0] = '\0'; @@ -1622,9 +1622,9 @@ static void ExaEvt_ReorderAnswer (long EvtCod,unsigned QstInd, /* Concatenate answer index to list of answers */ if (NumAns) Str_Concat (StrAnswersOneQst,",", - TstExa_MAX_BYTES_ANSWERS_ONE_QST); + TstRes_MAX_BYTES_ANSWERS_ONE_QST); Str_Concat (StrAnswersOneQst,StrOneAnswer, - TstExa_MAX_BYTES_ANSWERS_ONE_QST); + TstRes_MAX_BYTES_ANSWERS_ONE_QST); } /***** Free structure that stores the query result *****/ @@ -1648,7 +1648,7 @@ void ExaEvt_GetIndexes (long EvtCod,unsigned QstInd, { MYSQL_RES *mysql_res; MYSQL_ROW row; - char StrIndexesOneQst[TstExa_MAX_BYTES_INDEXES_ONE_QST + 1]; + char StrIndexesOneQst[TstRes_MAX_BYTES_INDEXES_ONE_QST + 1]; /***** Get indexes for a question from database *****/ if (!DB_QuerySELECT (&mysql_res,"can not get data of a question", @@ -1661,14 +1661,14 @@ void ExaEvt_GetIndexes (long EvtCod,unsigned QstInd, /* Get indexes (row[0]) */ Str_Copy (StrIndexesOneQst,row[0], - TstExa_MAX_BYTES_INDEXES_ONE_QST); + TstRes_MAX_BYTES_INDEXES_ONE_QST); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); /***** Get indexes from string *****/ Par_ReplaceCommaBySeparatorMultiple (StrIndexesOneQst); - TstExa_GetIndexesFromStr (StrIndexesOneQst,Indexes); + TstRes_GetIndexesFromStr (StrIndexesOneQst,Indexes); } /*****************************************************************************/ @@ -1725,7 +1725,7 @@ void ExaEvt_RemoveGroupsOfType (long GrpTypCod) /************** Insert/update an exam exam event being played ****************/ /*****************************************************************************/ -static void ExaEvt_UpdateEventStatusInDB (const struct ExaEvt_Match *Event) +static void ExaEvt_UpdateEventStatusInDB (const struct ExaEvt_Event *Event) { char *EvtSubQuery; @@ -1775,7 +1775,7 @@ static void ExaEvt_UpdateEventStatusInDB (const struct ExaEvt_Match *Event) /********** Update elapsed time in current question (by a teacher) ***********/ /*****************************************************************************/ -static void ExaEvt_UpdateElapsedTimeInQuestion (const struct ExaEvt_Match *Event) +static void ExaEvt_UpdateElapsedTimeInQuestion (const struct ExaEvt_Event *Event) { /***** Update elapsed time in current question in database *****/ if (Event->Status.Playing && // Event is being played @@ -1795,7 +1795,7 @@ static void ExaEvt_UpdateElapsedTimeInQuestion (const struct ExaEvt_Match *Event /**************** Get elapsed time in an exam event question *****************/ /*****************************************************************************/ -static void ExaEvt_GetElapsedTimeInQuestion (const struct ExaEvt_Match *Event, +static void ExaEvt_GetElapsedTimeInQuestion (const struct ExaEvt_Event *Event, struct Time *Time) { MYSQL_RES *mysql_res; @@ -1819,7 +1819,7 @@ static void ExaEvt_GetElapsedTimeInQuestion (const struct ExaEvt_Match *Event, /******************** Get elapsed time in an exam event **********************/ /*****************************************************************************/ -static void ExaEvt_GetElapsedTimeInMatch (const struct ExaEvt_Match *Event, +static void ExaEvt_GetElapsedTimeInMatch (const struct ExaEvt_Event *Event, struct Time *Time) { MYSQL_RES *mysql_res; @@ -1872,7 +1872,7 @@ static void ExaEvt_GetElapsedTime (unsigned NumRows,MYSQL_RES *mysql_res, void ExaEvt_PlayPauseEvent (void) { - struct ExaEvt_Match Event; + struct ExaEvt_Event Event; /***** Remove old players. This function must be called by a teacher @@ -1906,7 +1906,7 @@ void ExaEvt_PlayPauseEvent (void) void ExaEvt_ChangeNumColsEvt (void) { - struct ExaEvt_Match Event; + struct ExaEvt_Event Event; /***** Remove old players. This function must be called by a teacher @@ -1939,7 +1939,7 @@ void ExaEvt_ChangeNumColsEvt (void) void ExaEvt_ToggleVisibilResultsEvtQst (void) { - struct ExaEvt_Match Event; + struct ExaEvt_Event Event; /***** Remove old players. This function must be called by a teacher @@ -1971,7 +1971,7 @@ void ExaEvt_ToggleVisibilResultsEvtQst (void) void ExaEvt_BackEvent (void) { - struct ExaEvt_Match Event; + struct ExaEvt_Event Event; /***** Remove old players. This function must be called by a teacher @@ -2000,7 +2000,7 @@ void ExaEvt_BackEvent (void) void ExaEvt_ForwardEvent (void) { - struct ExaEvt_Match Event; + struct ExaEvt_Event Event; /***** Remove old players. This function must be called by a teacher @@ -2027,7 +2027,7 @@ void ExaEvt_ForwardEvent (void) /************ Set exam event status to previous (backward) status ************/ /*****************************************************************************/ -static void ExaEvt_SetMatchStatusToPrev (struct ExaEvt_Match *Event) +static void ExaEvt_SetMatchStatusToPrev (struct ExaEvt_Event *Event) { /***** What to show *****/ switch (Event->Status.Showing) @@ -2053,7 +2053,7 @@ static void ExaEvt_SetMatchStatusToPrev (struct ExaEvt_Match *Event) /**************** Set exam event status to previous question *****************/ /*****************************************************************************/ -static void ExaEvt_SetMatchStatusToPrevQst (struct ExaEvt_Match *Event) +static void ExaEvt_SetMatchStatusToPrevQst (struct ExaEvt_Event *Event) { /***** Get index of the previous question *****/ Event->Status.QstInd = Gam_GetPrevQuestionIndexInGame (Event->ExaCod, @@ -2073,7 +2073,7 @@ static void ExaEvt_SetMatchStatusToPrevQst (struct ExaEvt_Match *Event) /********************** Set exam event status to start ***********************/ /*****************************************************************************/ -static void ExaEvt_SetMatchStatusToStart (struct ExaEvt_Match *Event) +static void ExaEvt_SetMatchStatusToStart (struct ExaEvt_Event *Event) { Event->Status.QstInd = 0; // Before first question Event->Status.QstCod = -1L; @@ -2085,7 +2085,7 @@ static void ExaEvt_SetMatchStatusToStart (struct ExaEvt_Match *Event) /************** Set exam event status to next (forward) status ***************/ /*****************************************************************************/ -static void ExaEvt_SetMatchStatusToNext (struct ExaEvt_Match *Event) +static void ExaEvt_SetMatchStatusToNext (struct ExaEvt_Event *Event) { /***** What to show *****/ switch (Event->Status.Showing) @@ -2116,7 +2116,7 @@ static void ExaEvt_SetMatchStatusToNext (struct ExaEvt_Match *Event) /**************** Set exam event status to next question *********************/ /*****************************************************************************/ -static void ExaEvt_SetMatchStatusToNextQst (struct ExaEvt_Match *Event) +static void ExaEvt_SetMatchStatusToNextQst (struct ExaEvt_Event *Event) { /***** Get index of the next question *****/ Event->Status.QstInd = Gam_GetNextQuestionIndexInGame (Event->ExaCod, @@ -2137,7 +2137,7 @@ static void ExaEvt_SetMatchStatusToNextQst (struct ExaEvt_Match *Event) /********************** Set exam event status to end *************************/ /*****************************************************************************/ -static void ExaEvt_SetMatchStatusToEnd (struct ExaEvt_Match *Event) +static void ExaEvt_SetMatchStatusToEnd (struct ExaEvt_Event *Event) { Event->Status.QstInd = ExaEvt_AFTER_LAST_QUESTION; // After last question Event->Status.QstCod = -1L; @@ -2149,7 +2149,7 @@ static void ExaEvt_SetMatchStatusToEnd (struct ExaEvt_Match *Event) /***** Show current exam event status (number, question, answers, button) ****/ /*****************************************************************************/ -static void ExaEvt_ShowMatchStatusForTch (struct ExaEvt_Match *Event) +static void ExaEvt_ShowMatchStatusForTch (struct ExaEvt_Event *Event) { /***** Left column *****/ ExaEvt_ShowLeftColumnTch (Event); @@ -2162,7 +2162,7 @@ static void ExaEvt_ShowMatchStatusForTch (struct ExaEvt_Match *Event) /************ Show current question being played for a student ***************/ /*****************************************************************************/ -static void ExaEvt_ShowMatchStatusForStd (struct ExaEvt_Match *Event,ExaEvt_Update_t Update) +static void ExaEvt_ShowMatchStatusForStd (struct ExaEvt_Event *Event,ExaEvt_Update_t Update) { bool ICanPlayThisMatchBasedOnGrps; struct ExaEvt_UsrAnswer UsrAnswer; @@ -2226,7 +2226,7 @@ unsigned ExaEvt_GetNumUnfinishedEventsInExam (long ExaCod) /********* Check if I belong to any of the groups of an exam event ***********/ /*****************************************************************************/ -bool ExaEvt_CheckIfICanPlayThisEventBasedOnGrps (const struct ExaEvt_Match *Event) +bool ExaEvt_CheckIfICanPlayThisEventBasedOnGrps (const struct ExaEvt_Event *Event) { switch (Gbl.Usrs.Me.Role.Logged) { @@ -2262,7 +2262,7 @@ bool ExaEvt_CheckIfICanPlayThisEventBasedOnGrps (const struct ExaEvt_Match *Even /******** Show left column when playing an exam event (as a teacher) *********/ /*****************************************************************************/ -static void ExaEvt_ShowLeftColumnTch (struct ExaEvt_Match *Event) +static void ExaEvt_ShowLeftColumnTch (struct ExaEvt_Event *Event) { /***** Start left container *****/ HTM_DIV_Begin ("class=\"EXA_LEFT_TCH\""); @@ -2294,7 +2294,7 @@ static void ExaEvt_ShowLeftColumnTch (struct ExaEvt_Match *Event) /***************** Show left refreshable part for teachers *******************/ /*****************************************************************************/ -static void ExaEvt_ShowRefreshablePartTch (struct ExaEvt_Match *Event) +static void ExaEvt_ShowRefreshablePartTch (struct ExaEvt_Event *Event) { /***** Write elapsed time in exam event *****/ ExaEvt_WriteElapsedTimeInEvt (Event); @@ -2316,7 +2316,7 @@ static void ExaEvt_ShowRefreshablePartTch (struct ExaEvt_Match *Event) /****************** Write elapsed time in current exam event *****************/ /*****************************************************************************/ -static void ExaEvt_WriteElapsedTimeInEvt (struct ExaEvt_Match *Event) +static void ExaEvt_WriteElapsedTimeInEvt (struct ExaEvt_Event *Event) { struct Time Time; @@ -2335,7 +2335,7 @@ static void ExaEvt_WriteElapsedTimeInEvt (struct ExaEvt_Match *Event) /****************** Write elapsed time in current question *******************/ /*****************************************************************************/ -static void ExaEvt_WriteElapsedTimeInQst (struct ExaEvt_Match *Event) +static void ExaEvt_WriteElapsedTimeInQst (struct ExaEvt_Event *Event) { struct Time Time; @@ -2360,7 +2360,7 @@ static void ExaEvt_WriteElapsedTimeInQst (struct ExaEvt_Match *Event) /************ Write number of responders to an exam event question ***********/ /*****************************************************************************/ -static void ExaEvt_WriteNumRespondersQst (struct ExaEvt_Match *Event) +static void ExaEvt_WriteNumRespondersQst (struct ExaEvt_Event *Event) { extern const char *Txt_MATCH_respond; @@ -2402,7 +2402,7 @@ static void ExaEvt_WriteNumRespondersQst (struct ExaEvt_Match *Event) /*************** Write current countdown and hourglass icon ******************/ /*****************************************************************************/ -static void ExaEvt_PutCountdownAndHourglassIcon (struct ExaEvt_Match *Event) +static void ExaEvt_PutCountdownAndHourglassIcon (struct ExaEvt_Event *Event) { extern const char *Txt_Countdown; const char *Class; @@ -2459,7 +2459,7 @@ static void ExaEvt_PutCountdownAndHourglassIcon (struct ExaEvt_Match *Event) /******************** Put all forms to start countdowns **********************/ /*****************************************************************************/ -static void ExaEvt_PutFormsCountdown (struct ExaEvt_Match *Event) +static void ExaEvt_PutFormsCountdown (struct ExaEvt_Event *Event) { /***** Start container *****/ HTM_DIV_Begin ("class=\"EXA_SHOW_HOURGLASS\""); @@ -2478,7 +2478,7 @@ static void ExaEvt_PutFormsCountdown (struct ExaEvt_Match *Event) /****** Put a form to start a countdown with a given number of seconds *******/ /*****************************************************************************/ -static void ExaEvt_PutFormCountdown (struct ExaEvt_Match *Event,long Seconds,const char *Color) +static void ExaEvt_PutFormCountdown (struct ExaEvt_Event *Event,long Seconds,const char *Color) { extern const char *Txt_Countdown; char *OnSubmit; @@ -2536,7 +2536,7 @@ static void ExaEvt_PutFormCountdown (struct ExaEvt_Match *Event,long Seconds,con /******* Show right column when playing an exam event (as a teacher) *********/ /*****************************************************************************/ -static void ExaEvt_ShowRightColumnTch (const struct ExaEvt_Match *Event) +static void ExaEvt_ShowRightColumnTch (const struct ExaEvt_Event *Event) { /***** Start right container *****/ HTM_DIV_Begin ("class=\"EXA_RIGHT_TCH\""); @@ -2558,7 +2558,7 @@ static void ExaEvt_ShowRightColumnTch (const struct ExaEvt_Match *Event) /******** Show left column when playing an exam event (as a student) *********/ /*****************************************************************************/ -static void ExaEvt_ShowLeftColumnStd (const struct ExaEvt_Match *Event, +static void ExaEvt_ShowLeftColumnStd (const struct ExaEvt_Event *Event, const struct ExaEvt_UsrAnswer *UsrAnswer) { bool Answered = UsrAnswer->NumOpt >= 0; @@ -2598,7 +2598,7 @@ static void ExaEvt_ShowLeftColumnStd (const struct ExaEvt_Match *Event, /******* Show right column when playing an exam event (as a student) *********/ /*****************************************************************************/ -static void ExaEvt_ShowRightColumnStd (struct ExaEvt_Match *Event, +static void ExaEvt_ShowRightColumnStd (struct ExaEvt_Event *Event, const struct ExaEvt_UsrAnswer *UsrAnswer, ExaEvt_Update_t Update) { @@ -2644,7 +2644,7 @@ static void ExaEvt_ShowRightColumnStd (struct ExaEvt_Match *Event, /********************* Show number of question in exam ***********************/ /*****************************************************************************/ -static void ExaEvt_ShowNumQstInEvt (const struct ExaEvt_Match *Event) +static void ExaEvt_ShowNumQstInEvt (const struct ExaEvt_Event *Event) { extern const char *Txt_MATCH_Start; extern const char *Txt_MATCH_End; @@ -2670,7 +2670,7 @@ static void ExaEvt_ShowNumQstInEvt (const struct ExaEvt_Match *Event) /******************* Put buttons to control an exam event ********************/ /*****************************************************************************/ -static void ExaEvt_PutMatchControlButtons (const struct ExaEvt_Match *Event) +static void ExaEvt_PutMatchControlButtons (const struct ExaEvt_Event *Event) { extern const char *Txt_Go_back; extern const char *Txt_Go_forward; @@ -2743,7 +2743,7 @@ static void ExaEvt_PutMatchControlButtons (const struct ExaEvt_Match *Event) /** Show form to choice whether to show answers in one column or two columns */ /*****************************************************************************/ -static void ExaEvt_ShowFormColumns (const struct ExaEvt_Match *Event) +static void ExaEvt_ShowFormColumns (const struct ExaEvt_Event *Event) { extern const char *Txt_column; extern const char *Txt_columns; @@ -2805,7 +2805,7 @@ static void ExaEvt_PutParamNumCols (unsigned NumCols) // Number of columns /***************** Put checkbox to select if show results ********************/ /*****************************************************************************/ -static void ExaEvt_PutCheckboxResult (const struct ExaEvt_Match *Event) +static void ExaEvt_PutCheckboxResult (const struct ExaEvt_Event *Event) { extern const char *Txt_View_results; @@ -2835,7 +2835,7 @@ static void ExaEvt_PutCheckboxResult (const struct ExaEvt_Match *Event) /***************** Put checkbox to select if show results ********************/ /*****************************************************************************/ -static void ExaEvt_PutIfAnswered (const struct ExaEvt_Match *Event,bool Answered) +static void ExaEvt_PutIfAnswered (const struct ExaEvt_Event *Event,bool Answered) { extern const char *Txt_View_my_answer; extern const char *Txt_MATCH_QUESTION_Answered; @@ -2883,7 +2883,7 @@ static void ExaEvt_PutIfAnswered (const struct ExaEvt_Match *Event,bool Answered /***************** Put checkbox to select if show results ********************/ /*****************************************************************************/ -static void ExaEvt_PutIconToRemoveMyAnswer (const struct ExaEvt_Match *Event) +static void ExaEvt_PutIconToRemoveMyAnswer (const struct ExaEvt_Event *Event) { extern const char *Txt_Delete_my_answer; @@ -2913,7 +2913,7 @@ static void ExaEvt_PutIconToRemoveMyAnswer (const struct ExaEvt_Match *Event) /***************************** Show exam event title ******************************/ /*****************************************************************************/ -static void ExaEvt_ShowEventTitleTch (const struct ExaEvt_Match *Event) +static void ExaEvt_ShowEventTitleTch (const struct ExaEvt_Event *Event) { /***** Event title *****/ HTM_DIV_Begin ("class=\"EXA_TOP LT\""); @@ -2921,7 +2921,7 @@ static void ExaEvt_ShowEventTitleTch (const struct ExaEvt_Match *Event) HTM_DIV_End (); } -static void ExaEvt_ShowEventTitleStd (const struct ExaEvt_Match *Event) +static void ExaEvt_ShowEventTitleStd (const struct ExaEvt_Event *Event) { /***** Event title *****/ HTM_DIV_Begin ("class=\"EXA_TOP CT\""); @@ -2933,7 +2933,7 @@ static void ExaEvt_ShowEventTitleStd (const struct ExaEvt_Match *Event) /***** Show question and its answers when playing an exam event (as a teacher) *****/ /*****************************************************************************/ -static void ExaEvt_ShowQuestionAndAnswersTch (const struct ExaEvt_Match *Event) +static void ExaEvt_ShowQuestionAndAnswersTch (const struct ExaEvt_Event *Event) { extern const char *Txt_MATCH_Paused; extern const char *Txt_Question_removed; @@ -3012,7 +3012,7 @@ static void ExaEvt_ShowQuestionAndAnswersTch (const struct ExaEvt_Match *Event) /************* Write answers of a question when seeing an exam event ***************/ /*****************************************************************************/ -static void ExaEvt_WriteAnswersEventResult (const struct ExaEvt_Match *Event, +static void ExaEvt_WriteAnswersEventResult (const struct ExaEvt_Event *Event, const struct Tst_Question *Question, const char *Class,bool ShowResult) { @@ -3029,7 +3029,7 @@ static void ExaEvt_WriteAnswersEventResult (const struct ExaEvt_Match *Event, /******** Write single or multiple choice answer when seeing an exam event *********/ /*****************************************************************************/ -void ExaEvt_WriteChoiceAnsViewEvent (const struct ExaEvt_Match *Event, +void ExaEvt_WriteChoiceAnsViewEvent (const struct ExaEvt_Event *Event, const struct Tst_Question *Question, const char *Class,bool ShowResult) { @@ -3121,7 +3121,7 @@ void ExaEvt_WriteChoiceAnsViewEvent (const struct ExaEvt_Match *Event, /*****************************************************************************/ // Return true on valid question, false on invalid question -static bool ExaEvt_ShowQuestionAndAnswersStd (const struct ExaEvt_Match *Event, +static bool ExaEvt_ShowQuestionAndAnswersStd (const struct ExaEvt_Event *Event, const struct ExaEvt_UsrAnswer *UsrAnswer, ExaEvt_Update_t Update) { @@ -3191,7 +3191,7 @@ static bool ExaEvt_ShowQuestionAndAnswersStd (const struct ExaEvt_Match *Event, #define ExaEvt_NUM_ROWS_SCORE 50 -static void ExaEvt_ShowEventScore (const struct ExaEvt_Match *Event) +static void ExaEvt_ShowEventScore (const struct ExaEvt_Event *Event) { MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -3568,7 +3568,7 @@ static bool ExaEvt_GetIfEventIsBeingPlayed (long EvtCod) /*************************** Get number of players ***************************/ /*****************************************************************************/ -static void ExaEvt_GetNumPlayers (struct ExaEvt_Match *Event) +static void ExaEvt_GetNumPlayers (struct ExaEvt_Event *Event) { /***** Get number of players who are playing an exam event *****/ Event->Status.NumPlayers = @@ -3583,7 +3583,7 @@ static void ExaEvt_GetNumPlayers (struct ExaEvt_Match *Event) /*****************************************************************************/ // Return true on success -bool ExaEvt_RegisterMeAsPlayerInEvent (struct ExaEvt_Match *Event) +bool ExaEvt_RegisterMeAsPlayerInEvent (struct ExaEvt_Event *Event) { /***** Trivial check: exam event code must be > 0 *****/ if (Event->EvtCod <= 0) @@ -3629,7 +3629,7 @@ void ExaEvt_GetEventBeingPlayed (void) void ExaEvt_JoinEventAsStd (void) { - struct ExaEvt_Match Event; + struct ExaEvt_Event Event; /***** Get data of the exam event from database *****/ Event.EvtCod = ExaEvt_GetEvtCodBeingPlayed (); @@ -3647,7 +3647,7 @@ void ExaEvt_JoinEventAsStd (void) void ExaEvt_RemoveMyQuestionAnswer (void) { - struct ExaEvt_Match Event; + struct ExaEvt_Event Event; unsigned QstInd; /***** Get data of the exam event from database *****/ @@ -3677,7 +3677,7 @@ void ExaEvt_RemoveMyQuestionAnswer (void) void ExaEvt_StartCountdown (void) { - struct ExaEvt_Match Event; + struct ExaEvt_Event Event; long NewCountdown; /***** Get countdown parameter ****/ @@ -3708,7 +3708,7 @@ void ExaEvt_StartCountdown (void) void ExaEvt_RefreshEventTch (void) { - struct ExaEvt_Match Event; + struct ExaEvt_Event Event; enum {REFRESH_LEFT,REFRESH_ALL} WhatToRefresh; if (!Gbl.Session.IsOpen) // If session has been closed, do not write anything @@ -3766,7 +3766,7 @@ void ExaEvt_RefreshEventTch (void) void ExaEvt_RefreshEventStd (void) { - struct ExaEvt_Match Event; + struct ExaEvt_Event Event; if (!Gbl.Session.IsOpen) // If session has been closed, do not write anything return; @@ -3826,12 +3826,12 @@ void ExaEvt_GetQstAnsFromDB (long EvtCod,long UsrCod,unsigned QstInd, void ExaEvt_ReceiveQuestionAnswer (void) { - struct ExaEvt_Match Event; + struct ExaEvt_Event Event; unsigned QstInd; unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION]; struct ExaEvt_UsrAnswer PreviousUsrAnswer; struct ExaEvt_UsrAnswer UsrAnswer; - struct TstExa_Exam Result; + struct TstRes_Result Result; /***** Get data of the exam event from database *****/ Event.EvtCod = ExaEvt_GetEvtCodBeingPlayed (); @@ -3937,7 +3937,7 @@ void ExaEvt_ReceiveQuestionAnswer (void) /********************* Remove answer to exam event question ***********************/ /*****************************************************************************/ -static void ExaEvt_RemoveMyAnswerToEventQuestion (const struct ExaEvt_Match *Event) +static void ExaEvt_RemoveMyAnswerToEventQuestion (const struct ExaEvt_Event *Event) { DB_QueryDELETE ("can not remove your answer to the exam event question", "DELETE FROM exa_answers" @@ -3949,7 +3949,7 @@ static void ExaEvt_RemoveMyAnswerToEventQuestion (const struct ExaEvt_Match *Eve /******************** Compute exam event score for a student **********************/ /*****************************************************************************/ -static void ExaEvt_ComputeScore (struct TstExa_Exam *Result) +static void ExaEvt_ComputeScore (struct TstRes_Result *Result) { unsigned NumQst; struct Tst_Question Question; @@ -3964,7 +3964,7 @@ static void ExaEvt_ComputeScore (struct TstExa_Exam *Result) Question.Answer.Type = Tst_ANS_UNIQUE_CHOICE; /***** Compute score for this answer ******/ - TstExa_ComputeChoiceAnsScore (Result,NumQst,&Question); + TstRes_ComputeChoiceAnsScore (Result,NumQst,&Question); /***** Update total score *****/ Result->Score += Result->Questions[NumQst].Score; diff --git a/swad_exam_event.h b/swad_exam_event.h index 5be9425e..e8bc5a69 100644 --- a/swad_exam_event.h +++ b/swad_exam_event.h @@ -34,7 +34,7 @@ /************************** Public types and constants ***********************/ /*****************************************************************************/ -#define ExaEvt_NEW_MATCH_SECTION_ID "new_match" +#define ExaEvt_NEW_EVENT_SECTION_ID "new_event" #define ExaEvt_AFTER_LAST_QUESTION ((unsigned)((1UL << 31) - 1)) // 2^31 - 1, don't change this number because it is used in database to indicate that a event is finished @@ -49,7 +49,7 @@ typedef enum } ExaEvt_Showing_t; #define ExaEvt_SHOWING_DEFAULT ExaEvt_START -struct ExaEvt_Match +struct ExaEvt_Event { long EvtCod; long ExaCod; @@ -88,7 +88,7 @@ long ExaEvt_GetEvtCodBeingPlayed (void); void ExaEvt_ListEvents (struct Exa_Exams *Exams, struct Exa_Exam *Exam, bool PutFormNewEvent); -void ExaEvt_GetDataOfEventByCod (struct ExaEvt_Match *Event); +void ExaEvt_GetDataOfEventByCod (struct ExaEvt_Event *Event); void ExaEvt_ToggleVisibilResultsEvtUsr (void); @@ -102,7 +102,7 @@ void ExaEvt_RemoveUsrFromEventTablesInCrs (long UsrCod,long CrsCod); void ExaEvt_PutParamsEdit (void *Exams); void ExaEvt_GetAndCheckParameters (struct Exa_Exams *Exams, struct Exa_Exam *Exam, - struct ExaEvt_Match *Event); + struct ExaEvt_Event *Event); long ExaEvt_GetParamEvtCod (void); void ExaEvt_CreateNewEventTch (void); @@ -122,13 +122,13 @@ void ExaEvt_ForwardEvent (void); unsigned ExaEvt_GetNumEventsInExam (long ExaCod); unsigned ExaEvt_GetNumUnfinishedEventsInExam (long ExaCod); -bool ExaEvt_CheckIfICanPlayThisEventBasedOnGrps (const struct ExaEvt_Match *Event); +bool ExaEvt_CheckIfICanPlayThisEventBasedOnGrps (const struct ExaEvt_Event *Event); -void ExaEvt_WriteChoiceAnsViewEvent (const struct ExaEvt_Match *Event, +void ExaEvt_WriteChoiceAnsViewEvent (const struct ExaEvt_Event *Event, const struct Tst_Question *Question, const char *Class,bool ShowResult); -bool ExaEvt_RegisterMeAsPlayerInEvent (struct ExaEvt_Match *Event); +bool ExaEvt_RegisterMeAsPlayerInEvent (struct ExaEvt_Event *Event); void ExaEvt_GetEventBeingPlayed (void); void ExaEvt_JoinEventAsStd (void); diff --git a/swad_exam_result.c b/swad_exam_result.c index 7aa4044f..0d81ad85 100644 --- a/swad_exam_result.c +++ b/swad_exam_result.c @@ -36,6 +36,7 @@ #include "swad_database.h" #include "swad_date.h" #include "swad_exam.h" +#include "swad_exam_event.h" #include "swad_exam_result.h" #include "swad_form.h" #include "swad_global.h" @@ -74,15 +75,15 @@ extern struct Globals Gbl; static void ExaRes_PutFormToSelUsrsToViewEvtResults (void *Exams); static void ExaRes_ListMyEvtResultsInCrs (struct Exa_Exams *Exams); -static void ExaRes_ListMyEvtResultsInGam (struct Exa_Exams *Exams,long ExaCod); -static void ExaRes_ListMyEvtResultsInMch (struct Exa_Exams *Exams,long EvtCod); +static void ExaRes_ListMyEvtResultsInExa (struct Exa_Exams *Exams,long ExaCod); +static void ExaRes_ListMyEvtResultsInEvt (struct Exa_Exams *Exams,long EvtCod); static void ExaRes_ShowAllEvtResultsInSelectedExams (void *Exams); static void ExaRes_ListAllEvtResultsInSelectedExams (struct Exa_Exams *Exams); static void ExaRes_ListAllEvtResultsInExa (struct Exa_Exams *Exams,long ExaCod); static void ExaRes_ListAllEvtResultsInEvt (struct Exa_Exams *Exams,long EvtCod); static void ExaRes_ShowResultsBegin (struct Exa_Exams *Exams, - const char *Title,bool ListGamesToSelect); + const char *Title,bool ListExamsToSelect); static void ExaRes_ShowResultsEnd (void); static void ExaRes_ListExamsToSelect (struct Exa_Exams *Exams); @@ -101,7 +102,7 @@ static void ExaRes_ShowEvtResultsSummaryRow (unsigned NumResults, double TotalScoreOfAllResults, double TotalGrade); static void ExaRes_GetEventResultDataByEvtCod (long EvtCod,long UsrCod, - struct TstExa_Exam *Exam); + struct TstRes_Result *Result); static bool ExaRes_CheckIfICanSeeEventResult (struct ExaEvt_Event *Event,long UsrCod); static bool ExaRes_CheckIfICanViewScore (bool ICanViewResult,unsigned Visibility); @@ -115,21 +116,21 @@ void ExaRes_ShowMyExaResultsInCrs (void) extern const char *Txt_Results; struct Exa_Exams Exams; - /***** Reset games *****/ - Gam_ResetGames (&Exams); + /***** Reset exams *****/ + Exa_ResetExams (&Exams); - /***** Get list of games *****/ - Gam_GetListGames (&Exams,Gam_ORDER_BY_TITLE); - Gam_GetListSelectedGamCods (&Exams); + /***** Get list of exams *****/ + Exa_GetListExams (&Exams,Exa_ORDER_BY_TITLE); + Exa_GetListSelectedExaCods (&Exams); /***** List my events results in the current course *****/ - ExaRes_ShowResultsBegin (&Exams,Txt_Results,true); // List games to select + ExaRes_ShowResultsBegin (&Exams,Txt_Results,true); // List exams to select ExaRes_ListMyEvtResultsInCrs (&Exams); ExaRes_ShowResultsEnd (); - /***** Free list of games *****/ - free (Exams.GamCodsSelected); - Gam_FreeListGames (&Exams); + /***** Free list of exams *****/ + free (Exams.ExaCodsSelected); + Exa_FreeListExams (&Exams); } static void ExaRes_ListMyEvtResultsInCrs (struct Exa_Exams *Exams) @@ -156,32 +157,32 @@ void ExaRes_ShowMyExaResultsInExa (void) struct Exa_Exams Exams; struct Exa_Exam Exam; - /***** Reset games *****/ - Gam_ResetGames (&Exams); + /***** Reset exams *****/ + Exa_ResetExams (&Exams); /***** Get parameters *****/ - if ((Exam.ExaCod = Gam_GetParams (&Exams)) <= 0) + if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) Lay_ShowErrorAndExit ("Code of exam is missing."); - Gam_GetDataOfGameByCod (&Exam); + Exa_GetDataOfExamByCod (&Exam); /***** Exam begin *****/ - Gam_ShowOnlyOneGameBegin (&Exams,&Exam, + Exa_ShowOnlyOneExamBegin (&Exams,&Exam, false, // Do not list exam questions false); // Do not put form to start new event /***** List my events results in exam *****/ ExaRes_ShowResultsBegin (&Exams, Str_BuildStringStr (Txt_Results_of_game_X,Exam.Title), - false); // Do not list games to select + false); // Do not list exams to select Str_FreeString (); - ExaRes_ListMyEvtResultsInGam (&Exams,Exam.ExaCod); + ExaRes_ListMyEvtResultsInExa (&Exams,Exam.ExaCod); ExaRes_ShowResultsEnd (); /***** Exam end *****/ - Gam_ShowOnlyOneGameEnd (); + Exa_ShowOnlyOneExamEnd (); } -static void ExaRes_ListMyEvtResultsInGam (struct Exa_Exams *Exams,long ExaCod) +static void ExaRes_ListMyEvtResultsInExa (struct Exa_Exams *Exams,long ExaCod) { /***** Table header *****/ ExaRes_ShowHeaderEvtResults (Usr_ME); @@ -195,41 +196,41 @@ static void ExaRes_ListMyEvtResultsInGam (struct Exa_Exams *Exams,long ExaCod) /***************** Show my events results in a given event ******************/ /*****************************************************************************/ -void ExaRes_ShowMyExaResultsInEve (void) +void ExaRes_ShowMyExaResultsInEvt (void) { extern const char *Txt_Results_of_match_X; struct Exa_Exams Exams; struct Exa_Exam Exam; struct ExaEvt_Event Event; - /***** Reset games *****/ - Gam_ResetGames (&Exams); + /***** Reset exams *****/ + Exa_ResetExams (&Exams); /***** Get parameters *****/ - if ((Exam.ExaCod = Gam_GetParams (&Exams)) <= 0) + if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) Lay_ShowErrorAndExit ("Code of exam is missing."); - if ((Event.EvtCod = Mch_GetParamEvtCod ()) <= 0) + if ((Event.EvtCod = ExaEvt_GetParamEvtCod ()) <= 0) Lay_ShowErrorAndExit ("Code of event is missing."); - Gam_GetDataOfGameByCod (&Exam); + Exa_GetDataOfExamByCod (&Exam); ExaEvt_GetDataOfEventByCod (&Event); /***** Exam begin *****/ - Gam_ShowOnlyOneGameBegin (&Exams,&Exam, + Exa_ShowOnlyOneExamBegin (&Exams,&Exam, false, // Do not list exam questions false); // Do not put form to start new event /***** List my events results in event *****/ ExaRes_ShowResultsBegin (&Exams,Str_BuildStringStr (Txt_Results_of_match_X,Event.Title), - false); // Do not list games to select + false); // Do not list exams to select Str_FreeString (); - ExaRes_ListMyEvtResultsInMch (&Exams,Event.EvtCod); + ExaRes_ListMyEvtResultsInEvt (&Exams,Event.EvtCod); ExaRes_ShowResultsEnd (); /***** Exam end *****/ - Gam_ShowOnlyOneGameEnd (); + Exa_ShowOnlyOneExamEnd (); } -static void ExaRes_ListMyEvtResultsInMch (struct Exa_Exams *Exams,long EvtCod) +static void ExaRes_ListMyEvtResultsInEvt (struct Exa_Exams *Exams,long EvtCod) { /***** Table header *****/ ExaRes_ShowHeaderEvtResults (Usr_ME); @@ -247,8 +248,8 @@ void ExaRes_ShowAllExaResultsInCrs (void) { struct Exa_Exams Exams; - /***** Reset games *****/ - Gam_ResetGames (&Exams); + /***** Reset exams *****/ + Exa_ResetExams (&Exams); /***** Get users and show their events results *****/ Usr_GetSelectedUsrsAndGoToAct (&Gbl.Usrs.Selected, @@ -267,20 +268,20 @@ static void ExaRes_ShowAllEvtResultsInSelectedExams (void *Exams) if (!Exams) return; - /***** Get list of games *****/ - Gam_GetListGames ((struct Exa_Exams *) Exams,Gam_ORDER_BY_TITLE); - Gam_GetListSelectedGamCods ((struct Exa_Exams *) Exams); + /***** Get list of exams *****/ + Exa_GetListExams ((struct Exa_Exams *) Exams,Exa_ORDER_BY_TITLE); + Exa_GetListSelectedExaCods ((struct Exa_Exams *) Exams); /***** List the events results of the selected users *****/ ExaRes_ShowResultsBegin ((struct Exa_Exams *) Exams, Txt_Results, - true); // List games to select + true); // List exams to select ExaRes_ListAllEvtResultsInSelectedExams ((struct Exa_Exams *) Exams); ExaRes_ShowResultsEnd (); - /***** Free list of games *****/ - free (((struct Exa_Exams *) Exams)->GamCodsSelected); - Gam_FreeListGames ((struct Exa_Exams *) Exams); + /***** Free list of exams *****/ + free (((struct Exa_Exams *) Exams)->ExaCodsSelected); + Exa_FreeListExams ((struct Exa_Exams *) Exams); } static void ExaRes_ListAllEvtResultsInSelectedExams (struct Exa_Exams *Exams) @@ -300,7 +301,7 @@ static void ExaRes_ListAllEvtResultsInSelectedExams (struct Exa_Exams *Exams) Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64); Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat); if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) - if (Usr_CheckIfICanViewMch (&Gbl.Usrs.Other.UsrDat)) + if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat)) { /***** Show events results *****/ Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat); @@ -318,8 +319,8 @@ void ExaRes_SelUsrsToViewExaResults (void) { struct Exa_Exams Exams; - /***** Reset games *****/ - Gam_ResetGames (&Exams); + /***** Reset exams *****/ + Exa_ResetExams (&Exams); /***** Put form to select users *****/ ExaRes_PutFormToSelUsrsToViewEvtResults (&Exams); @@ -327,16 +328,16 @@ void ExaRes_SelUsrsToViewExaResults (void) static void ExaRes_PutFormToSelUsrsToViewEvtResults (void *Exams) { - extern const char *Hlp_ASSESSMENT_Games_results; + extern const char *Hlp_ASSESSMENT_Exams_results; extern const char *Txt_Results; extern const char *Txt_View_matches_results; if (Exams) // Not used Usr_PutFormToSelectUsrsToGoToAct (&Gbl.Usrs.Selected, - ActSeeAllMchResCrs, + ActSeeAllExaEvtResCrs, NULL,NULL, Txt_Results, - Hlp_ASSESSMENT_Games_results, + Hlp_ASSESSMENT_Exams_results, Txt_View_matches_results, false); // Do not put form with date range } @@ -351,29 +352,29 @@ void ExaRes_ShowAllExaResultsInExa (void) struct Exa_Exams Exams; struct Exa_Exam Exam; - /***** Reset games *****/ - Gam_ResetGames (&Exams); + /***** Reset exams *****/ + Exa_ResetExams (&Exams); /***** Get parameters *****/ - if ((Exam.ExaCod = Gam_GetParams (&Exams)) <= 0) + if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) Lay_ShowErrorAndExit ("Code of exam is missing."); - Gam_GetDataOfGameByCod (&Exam); + Exa_GetDataOfExamByCod (&Exam); /***** Exam begin *****/ - Gam_ShowOnlyOneGameBegin (&Exams,&Exam, + Exa_ShowOnlyOneExamBegin (&Exams,&Exam, false, // Do not list exam questions false); // Do not put form to start new event /***** List events results in exam *****/ ExaRes_ShowResultsBegin (&Exams, Str_BuildStringStr (Txt_Results_of_game_X,Exam.Title), - false); // Do not list games to select + false); // Do not list exams to select Str_FreeString (); ExaRes_ListAllEvtResultsInExa (&Exams,Exam.ExaCod); ExaRes_ShowResultsEnd (); /***** Exam end *****/ - Gam_ShowOnlyOneGameEnd (); + Exa_ShowOnlyOneExamEnd (); } static void ExaRes_ListAllEvtResultsInExa (struct Exa_Exams *Exams,long ExaCod) @@ -414,7 +415,7 @@ static void ExaRes_ListAllEvtResultsInExa (struct Exa_Exams *Exams,long ExaCod) /* Get event code (row[0]) */ if ((Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0])) > 0) if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) - if (Usr_CheckIfICanViewMch (&Gbl.Usrs.Other.UsrDat)) + if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat)) { /***** Show events results *****/ Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat); @@ -431,39 +432,39 @@ static void ExaRes_ListAllEvtResultsInExa (struct Exa_Exams *Exams,long ExaCod) /** Show events results of a event for the users who answered in that event */ /*****************************************************************************/ -void ExaRes_ShowAllExaResultsInEve (void) +void ExaRes_ShowAllExaResultsInEvt (void) { extern const char *Txt_Results_of_match_X; struct Exa_Exams Exams; struct Exa_Exam Exam; struct ExaEvt_Event Event; - /***** Reset games *****/ - Gam_ResetGames (&Exams); + /***** Reset exams *****/ + Exa_ResetExams (&Exams); /***** Get parameters *****/ - if ((Exam.ExaCod = Gam_GetParams (&Exams)) <= 0) + if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) Lay_ShowErrorAndExit ("Code of exam is missing."); - if ((Event.EvtCod = Mch_GetParamEvtCod ()) <= 0) + if ((Event.EvtCod = ExaEvt_GetParamEvtCod ()) <= 0) Lay_ShowErrorAndExit ("Code of event is missing."); - Gam_GetDataOfGameByCod (&Exam); + Exa_GetDataOfExamByCod (&Exam); ExaEvt_GetDataOfEventByCod (&Event); /***** Exam begin *****/ - Gam_ShowOnlyOneGameBegin (&Exams,&Exam, + Exa_ShowOnlyOneExamBegin (&Exams,&Exam, false, // Do not list exam questions false); // Do not put form to start new event /***** List events results in event *****/ ExaRes_ShowResultsBegin (&Exams, Str_BuildStringStr (Txt_Results_of_match_X,Event.Title), - false); // Do not list games to select + false); // Do not list exams to select Str_FreeString (); ExaRes_ListAllEvtResultsInEvt (&Exams,Event.EvtCod); ExaRes_ShowResultsEnd (); /***** Exam end *****/ - Gam_ShowOnlyOneGameEnd (); + Exa_ShowOnlyOneExamEnd (); } static void ExaRes_ListAllEvtResultsInEvt (struct Exa_Exams *Exams,long EvtCod) @@ -504,7 +505,7 @@ static void ExaRes_ListAllEvtResultsInEvt (struct Exa_Exams *Exams,long EvtCod) /* Get event code (row[0]) */ if ((Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0])) > 0) if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) - if (Usr_CheckIfICanViewMch (&Gbl.Usrs.Other.UsrDat)) + if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat)) { /***** Show events results *****/ Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat); @@ -522,18 +523,18 @@ static void ExaRes_ListAllEvtResultsInEvt (struct Exa_Exams *Exams,long EvtCod) /*****************************************************************************/ static void ExaRes_ShowResultsBegin (struct Exa_Exams *Exams, - const char *Title,bool ListGamesToSelect) + const char *Title,bool ListExamsToSelect) { - extern const char *Hlp_ASSESSMENT_Games_results; + extern const char *Hlp_ASSESSMENT_Exams_results; /***** Begin box *****/ HTM_SECTION_Begin (ExaRes_RESULTS_BOX_ID); Box_BoxBegin ("100%",Title, NULL,NULL, - Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE); + Hlp_ASSESSMENT_Exams_results,Box_NOT_CLOSABLE); - /***** List games to select *****/ - if (ListGamesToSelect) + /***** List exams to select *****/ + if (ListExamsToSelect) ExaRes_ListExamsToSelect (Exams); /***** Begin event results table *****/ @@ -558,22 +559,22 @@ static void ExaRes_ShowResultsEnd (void) static void ExaRes_ListExamsToSelect (struct Exa_Exams *Exams) { - extern const char *Hlp_ASSESSMENT_Games_results; + extern const char *Hlp_ASSESSMENT_Exams_results; extern const char *The_ClassFormLinkInBoxBold[The_NUM_THEMES]; - extern const char *Txt_Games; - extern const char *Txt_Game; + extern const char *Txt_Exams; + extern const char *Txt_Exam; extern const char *Txt_Update_results; unsigned UniqueId; unsigned NumExam; struct Exa_Exam Exam; /***** Begin box *****/ - Box_BoxBegin (NULL,Txt_Games, + Box_BoxBegin (NULL,Txt_Exams, NULL,NULL, - Hlp_ASSESSMENT_Games_results,Box_CLOSABLE); + Hlp_ASSESSMENT_Exams_results,Box_CLOSABLE); /***** Begin form to update the results - depending on the games selected *****/ + depending on the exams selected *****/ Frm_StartFormAnchor (Gbl.Action.Act,ExaRes_RESULTS_TABLE_ID); Grp_PutParamsCodGrps (); Usr_PutHiddenParSelectedUsrsCods (&Gbl.Usrs.Selected); @@ -585,7 +586,7 @@ static void ExaRes_ListExamsToSelect (struct Exa_Exams *Exams) HTM_TR_Begin (NULL); HTM_TH (1,2,NULL,NULL); - HTM_TH (1,1,"LM",Txt_Game); + HTM_TH (1,1,"LM",Txt_Exam); HTM_TR_End (); @@ -596,7 +597,7 @@ static void ExaRes_ListExamsToSelect (struct Exa_Exams *Exams) { /* Get data of this exam */ Exam.ExaCod = Exams->Lst[NumExam].ExaCod; - Gam_GetDataOfGameByCod (&Exam); + Exa_GetDataOfExamByCod (&Exam); /* Write a row for this event */ HTM_TR_Begin (NULL); @@ -678,8 +679,8 @@ static void ExaRes_ShowHeaderEvtResults (Usr_MeOrOther_t MeOrOther) } /*****************************************************************************/ -/******* Build string with list of selected games separated by commas ********/ -/******* from list of selected games ********/ +/******* Build string with list of selected exams separated by commas ********/ +/******* from list of selected exams ********/ /*****************************************************************************/ static void ExaRes_BuildExamsSelectedCommas (struct Exa_Exams *Exams, @@ -689,12 +690,12 @@ static void ExaRes_BuildExamsSelectedCommas (struct Exa_Exams *Exams, unsigned NumExam; char LongStr[Cns_MAX_DECIMAL_DIGITS_LONG + 1]; - /***** Allocate memory for subquery of games selected *****/ + /***** Allocate memory for subquery of exams selected *****/ MaxLength = (size_t) Exams->NumSelected * (Cns_MAX_DECIMAL_DIGITS_LONG + 1); if ((*ExamsSelectedCommas = (char *) malloc (MaxLength + 1)) == NULL) Lay_NotEnoughMemoryExit (); - /***** Build subquery with list of selected games *****/ + /***** Build subquery with list of selected exams *****/ (*ExamsSelectedCommas)[0] = '\0'; for (NumExam = 0; NumExam < Exams->Num; @@ -760,7 +761,7 @@ static void ExaRes_ShowEvtResults (struct Exa_Exams *Exams, Lay_NotEnoughMemoryExit (); } - /***** Build games subquery *****/ + /***** Build exams subquery *****/ if (ExaCod > 0) { if (asprintf (&ExaSubQuery," AND exa_events.ExaCod=%ld",ExaCod) < 0) @@ -927,8 +928,8 @@ static void ExaRes_ShowEvtResults (struct Exa_Exams *Exams, HTM_TD_Begin ("class=\"DAT RT COLOR%u\"",Gbl.RowEvenOdd); if (ICanViewScore) { - Grade = TstExa_ComputeGrade (NumQstsInThisResult,ScoreInThisResult,MaxGrade); - TstExa_ShowGrade (Grade,MaxGrade); + Grade = TstRes_ComputeGrade (NumQstsInThisResult,ScoreInThisResult,MaxGrade); + TstRes_ShowGrade (Grade,MaxGrade); TotalGrade += Grade; } else @@ -944,12 +945,12 @@ static void ExaRes_ShowEvtResults (struct Exa_Exams *Exams, switch (MeOrOther) { case Usr_ME: - Frm_StartForm (ActSeeOneMchResMe); - Mch_PutParamsEdit (Exams); + Frm_StartForm (ActSeeOneExaEvtResMe); + ExaEvt_PutParamsEdit (Exams); break; case Usr_OTHER: Frm_StartForm (ActSeeOneMchResOth); - Mch_PutParamsEdit (Exams); + ExaEvt_PutParamsEdit (Exams); Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EncryptedUsrCod); break; } @@ -965,9 +966,9 @@ static void ExaRes_ShowEvtResults (struct Exa_Exams *Exams, /***** Write totals for this user *****/ ExaRes_ShowEvtResultsSummaryRow (NumResults, - NumTotalQsts,NumTotalQstsNotBlank, - TotalScoreOfAllResults, - TotalGrade); + NumTotalQsts,NumTotalQstsNotBlank, + TotalScoreOfAllResults, + TotalGrade); } else { @@ -1045,7 +1046,7 @@ static void ExaRes_ShowEvtResultsSummaryRow (unsigned NumResults, void ExaRes_ShowOneExaResult (void) { - extern const char *Hlp_ASSESSMENT_Games_results; + extern const char *Hlp_ASSESSMENT_Exams_results; extern const char *Txt_The_user_does_not_exist; extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME]; @@ -1061,17 +1062,17 @@ void ExaRes_ShowOneExaResult (void) struct UsrData *UsrDat; Dat_StartEndTime_t StartEndTime; char *Id; - struct TstExa_Exam Exam; + struct TstRes_Result Result; bool ShowPhoto; char PhotoURL[PATH_MAX + 1]; bool ICanViewResult; bool ICanViewScore; - /***** Reset games *****/ - Gam_ResetGames (&Exams); + /***** Reset exams *****/ + Exa_ResetExams (&Exams); /***** Get and check parameters *****/ - Mch_GetAndCheckParameters (&Exams,&Exam,&Event); + ExaEvt_GetAndCheckParameters (&Exams,&Exam,&Event); /***** Pointer to user's data *****/ MeOrOther = (Gbl.Action.Act == ActSeeOneMchResMe) ? Usr_ME : @@ -1089,8 +1090,8 @@ void ExaRes_ShowOneExaResult (void) } /***** Get event result data *****/ - TstExa_ResetExam (&Exam); - ExaRes_GetEventResultDataByEvtCod (Event.EvtCod,UsrDat->UsrCod,&Exam); + TstRes_ResetResult (&Result); + ExaRes_GetEventResultDataByEvtCod (Event.EvtCod,UsrDat->UsrCod,&Result); /***** Check if I can view this event result *****/ switch (Gbl.Usrs.Me.Role.Logged) @@ -1121,12 +1122,12 @@ void ExaRes_ShowOneExaResult (void) { /***** Get questions and user's answers of the event result from database *****/ ExaRes_GetExamResultQuestionsFromDB (Event.EvtCod,UsrDat->UsrCod, - &Exam); + &Exam); /***** Begin box *****/ Box_BoxBegin (NULL,Event.Title, NULL,NULL, - Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE); + Hlp_ASSESSMENT_Exams_results,Box_NOT_CLOSABLE); Lay_WriteHeaderClassPhoto (false,false, Gbl.Hierarchy.Ins.InsCod, Gbl.Hierarchy.Deg.DegCod, @@ -1139,7 +1140,7 @@ void ExaRes_ShowOneExaResult (void) /* Get data of the user who answer the event */ if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (UsrDat,Usr_DONT_GET_PREFS)) Lay_ShowErrorAndExit (Txt_The_user_does_not_exist); - if (!Usr_CheckIfICanViewTst (UsrDat)) + if (!Usr_CheckIfICanViewTstExaMchResult (UsrDat)) Lay_NoPermissionExit (); /* User */ @@ -1197,8 +1198,8 @@ void ExaRes_ShowOneExaResult (void) HTM_TD_Begin ("class=\"DAT LT\""); HTM_TxtF ("%u (%u %s)", - Exam.NumQsts, - Exam.NumQstsNotBlank,Txt_non_blank_QUESTIONS); + Result.NumQsts, + Result.NumQstsNotBlank,Txt_non_blank_QUESTIONS); HTM_TD_End (); HTM_TR_End (); @@ -1212,7 +1213,7 @@ void ExaRes_ShowOneExaResult (void) HTM_TD_Begin ("class=\"DAT LT\""); if (ICanViewScore) - HTM_Double2Decimals (Exam.Score); + HTM_Double2Decimals (Result.Score); else Ico_PutIconNotVisible (); HTM_TD_End (); @@ -1228,9 +1229,8 @@ void ExaRes_ShowOneExaResult (void) HTM_TD_Begin ("class=\"DAT LT\""); if (ICanViewScore) - TstExa_ComputeAndShowGrade (Exam.NumQsts, - Exam.Score, - Exam.MaxGrade); + TstRes_ComputeAndShowGrade (Result.NumQsts,Result.Score, + Exam.MaxGrade); else Ico_PutIconNotVisible (); HTM_TD_End (); @@ -1245,13 +1245,13 @@ void ExaRes_ShowOneExaResult (void) HTM_TD_End (); HTM_TD_Begin ("class=\"DAT LT\""); - Gam_ShowTstTagsPresentInAGame (Event.ExaCod); + Exa_ShowTstTagsPresentInAnExam (Event.ExaCod); HTM_TD_End (); HTM_TR_End (); /***** Write answers and solutions *****/ - TstExa_ShowExamAnswers (UsrDat,&Exam,Exam.Visibility); + TstRes_ShowExamAnswers (UsrDat,&Result,Exam.Visibility); /***** End table *****/ HTM_TABLE_End (); @@ -1261,10 +1261,11 @@ void ExaRes_ShowOneExaResult (void) { HTM_DIV_Begin ("class=\"DAT_N_BOLD CM\""); HTM_TxtColonNBSP (Txt_Score); - HTM_Double2Decimals (Exam.Score); + HTM_Double2Decimals (Result.Score); HTM_BR (); HTM_TxtColonNBSP (Txt_Grade); - TstExa_ComputeAndShowGrade (Exam.NumQsts,Exam.Score,Exam.MaxGrade); + TstRes_ComputeAndShowGrade (Result.NumQsts,Result.Score, + Exam.MaxGrade); HTM_DIV_End (); } @@ -1280,37 +1281,37 @@ void ExaRes_ShowOneExaResult (void) /*****************************************************************************/ void ExaRes_GetExamResultQuestionsFromDB (long EvtCod,long UsrCod, - struct TstExa_Exam *Exam) + struct TstRes_Result *Result) { MYSQL_RES *mysql_res; MYSQL_ROW row; unsigned NumQst; long LongNum; unsigned QstInd; - struct Mch_UsrAnswer UsrAnswer; + struct ExaEvt_UsrAnswer UsrAnswer; /***** Get questions and answers of a event result *****/ - Exam->NumQsts = (unsigned) - DB_QuerySELECT (&mysql_res,"can not get questions and answers" - " of a event result", - "SELECT gam_questions.QstCod," // row[0] - "gam_questions.QstInd," // row[1] - "mch_indexes.Indexes" // row[2] - " FROM exa_events,gam_questions,mch_indexes" - " WHERE exa_events.EvtCod=%ld" - " AND exa_events.ExaCod=gam_questions.ExaCod" - " AND exa_events.EvtCod=mch_indexes.EvtCod" - " AND gam_questions.QstInd=mch_indexes.QstInd" - " ORDER BY gam_questions.QstInd", - EvtCod); - for (NumQst = 0, Exam->NumQstsNotBlank = 0; - NumQst < Exam->NumQsts; + Result->NumQsts = (unsigned) + DB_QuerySELECT (&mysql_res,"can not get questions and answers" + " of a event result", + "SELECT exa_questions.QstCod," // row[0] + "exa_questions.QstInd," // row[1] + "exa_indexes.Indexes" // row[2] + " FROM exa_events,exa_questions,exa_indexes" + " WHERE exa_events.EvtCod=%ld" + " AND exa_events.ExaCod=exa_questions.ExaCod" + " AND exa_events.EvtCod=exa_indexes.EvtCod" + " AND exa_questions.QstInd=exa_indexes.QstInd" + " ORDER BY exa_questions.QstInd", + EvtCod); + for (NumQst = 0, Result->NumQstsNotBlank = 0; + NumQst < Result->NumQsts; NumQst++) { row = mysql_fetch_row (mysql_res); /* Get question code (row[0]) */ - if ((Exam->Questions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0) + if ((Result->Questions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0) Lay_ShowErrorAndExit ("Wrong code of question."); /* Get question index (row[1]) */ @@ -1319,24 +1320,24 @@ void ExaRes_GetExamResultQuestionsFromDB (long EvtCod,long UsrCod, QstInd = (unsigned) LongNum; /* Get indexes for this question (row[2]) */ - Str_Copy (Exam->Questions[NumQst].StrIndexes,row[2], - TstExa_MAX_BYTES_INDEXES_ONE_QST); + Str_Copy (Result->Questions[NumQst].StrIndexes,row[2], + TstRes_MAX_BYTES_INDEXES_ONE_QST); /* Get answers selected by user for this question */ - Mch_GetQstAnsFromDB (EvtCod,UsrCod,QstInd,&UsrAnswer); + ExaEvt_GetQstAnsFromDB (EvtCod,UsrCod,QstInd,&UsrAnswer); if (UsrAnswer.AnsInd >= 0) // UsrAnswer.AnsInd >= 0 ==> answer selected { - snprintf (Exam->Questions[NumQst].StrAnswers,TstExa_MAX_BYTES_ANSWERS_ONE_QST + 1, + snprintf (Result->Questions[NumQst].StrAnswers,TstRes_MAX_BYTES_ANSWERS_ONE_QST + 1, "%d",UsrAnswer.AnsInd); - Exam->NumQstsNotBlank++; + Result->NumQstsNotBlank++; } else // UsrAnswer.AnsInd < 0 ==> no answer selected - Exam->Questions[NumQst].StrAnswers[0] = '\0'; // Empty answer + Result->Questions[NumQst].StrAnswers[0] = '\0'; // Empty answer /* Replace each comma by a separator of multiple parameters */ /* In database commas are used as separators instead of special chars */ - Par_ReplaceCommaBySeparatorMultiple (Exam->Questions[NumQst].StrIndexes); - Par_ReplaceCommaBySeparatorMultiple (Exam->Questions[NumQst].StrAnswers); + Par_ReplaceCommaBySeparatorMultiple (Result->Questions[NumQst].StrIndexes); + Par_ReplaceCommaBySeparatorMultiple (Result->Questions[NumQst].StrAnswers); } /***** Free structure that stores the query result *****/ @@ -1348,7 +1349,7 @@ void ExaRes_GetExamResultQuestionsFromDB (long EvtCod,long UsrCod, /*****************************************************************************/ static void ExaRes_GetEventResultDataByEvtCod (long EvtCod,long UsrCod, - struct TstExa_Exam *Exam) + struct TstRes_Result *Result) { MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -1357,11 +1358,11 @@ static void ExaRes_GetEventResultDataByEvtCod (long EvtCod,long UsrCod, /***** Make database query *****/ if (DB_QuerySELECT (&mysql_res,"can not get data" " of a event result of a user", - "SELECT UNIX_TIMESTAMP(exa_results.StartTime)," // row[1] - "UNIX_TIMESTAMP(exa_results.EndTime)," // row[2] - "exa_results.NumQsts," // row[3] - "exa_results.NumQstsNotBlank," // row[4] - "exa_results.Score" // row[5] + "SELECT UNIX_TIMESTAMP(exa_results.StartTime)," // row[1] + "UNIX_TIMESTAMP(exa_results.EndTime)," // row[2] + "exa_results.NumQsts," // row[3] + "exa_results.NumQstsNotBlank," // row[4] + "exa_results.Score" // row[5] " FROM exa_results,exa_events,exa_exams" " WHERE exa_results.EvtCod=%ld" " AND exa_results.UsrCod=%ld" @@ -1377,27 +1378,27 @@ static void ExaRes_GetEventResultDataByEvtCod (long EvtCod,long UsrCod, for (StartEndTime = (Dat_StartEndTime_t) 0; StartEndTime <= (Dat_StartEndTime_t) (Dat_NUM_START_END_TIME - 1); StartEndTime++) - Exam->TimeUTC[StartEndTime] = Dat_GetUNIXTimeFromStr (row[StartEndTime]); + Result->TimeUTC[StartEndTime] = Dat_GetUNIXTimeFromStr (row[StartEndTime]); /* Get number of questions (row[2]) */ - if (sscanf (row[2],"%u",&Exam->NumQsts) != 1) - Exam->NumQsts = 0; + if (sscanf (row[2],"%u",&Result->NumQsts) != 1) + Result->NumQsts = 0; /* Get number of questions not blank (row[3]) */ - if (sscanf (row[3],"%u",&Exam->NumQstsNotBlank) != 1) - Exam->NumQstsNotBlank = 0; + if (sscanf (row[3],"%u",&Result->NumQstsNotBlank) != 1) + Result->NumQstsNotBlank = 0; /* Get score (row[4]) */ Str_SetDecimalPointToUS (); // To get the decimal point as a dot - if (sscanf (row[4],"%lf",&Exam->Score) != 1) - Exam->Score = 0.0; + if (sscanf (row[4],"%lf",&Result->Score) != 1) + Result->Score = 0.0; Str_SetDecimalPointToLocal (); // Return to local system } else { - Exam->NumQsts = 0; - Exam->NumQstsNotBlank = 0; - Exam->Score = 0.0; + Result->NumQsts = 0; + Result->NumQstsNotBlank = 0; + Result->Score = 0.0; } /***** Free structure that stores the query result *****/ @@ -1417,7 +1418,7 @@ static bool ExaRes_CheckIfICanSeeEventResult (struct ExaEvt_Event *Event,long Us case Rol_STD: ItsMe = Usr_ItsMe (UsrCod); if (ItsMe && Event->Status.ShowUsrResults) - return Mch_CheckIfICanPlayThisMatchBasedOnGrps (Event); + return ExaEvt_CheckIfICanPlayThisEventBasedOnGrps (Event); return false; case Rol_NET: case Rol_TCH: diff --git a/swad_exam_result.h b/swad_exam_result.h index 066b9be4..03dfb4a6 100644 --- a/swad_exam_result.h +++ b/swad_exam_result.h @@ -42,15 +42,15 @@ void ExaRes_ShowMyExaResultsInCrs (void); void ExaRes_ShowMyExaResultsInExa (void); -void ExaRes_ShowMyExaResultsInEve (void); +void ExaRes_ShowMyExaResultsInEvt (void); void ExaRes_ShowAllExaResultsInCrs (void); void ExaRes_SelUsrsToViewExaResults (void); void ExaRes_ShowAllExaResultsInExa (void); -void ExaRes_ShowAllExaResultsInEve (void); +void ExaRes_ShowAllExaResultsInEvt (void); void ExaRes_ShowOneExaResult (void); void ExaRes_GetExamResultQuestionsFromDB (long EvtCod,long UsrCod, - struct TstExa_Exam *Exam); + struct TstRes_Result *Result); #endif diff --git a/swad_figure.c b/swad_figure.c index d8752d3b..5f989e32 100644 --- a/swad_figure.c +++ b/swad_figure.c @@ -161,6 +161,7 @@ static void Fig_GetAndShowCourseProgramStats (void); // TODO: Change function fr static void Fig_GetAndShowAssignmentsStats (void); static void Fig_GetAndShowProjectsStats (void); static void Fig_GetAndShowTestsStats (void); +static void Fig_GetAndShowExamsStats (void); static void Fig_GetAndShowGamesStats (void); static void Fig_GetAndShowTimelineActivityStats (void); @@ -335,6 +336,7 @@ void Fig_ShowFigures (void) [Fig_ASSIGNMENTS ] = Fig_GetAndShowAssignmentsStats, [Fig_PROJECTS ] = Fig_GetAndShowProjectsStats, [Fig_TESTS ] = Fig_GetAndShowTestsStats, + [Fig_EXAMS ] = Fig_GetAndShowExamsStats, [Fig_GAMES ] = Fig_GetAndShowGamesStats, [Fig_SURVEYS ] = Fig_GetAndShowSurveysStats, [Fig_TIMELINE ] = Fig_GetAndShowTimelineActivityStats, @@ -3289,6 +3291,61 @@ static void Fig_GetAndShowTestsStats (void) Box_BoxTableEnd (); } +/*****************************************************************************/ +/*************************** Show stats about exams **************************/ +/*****************************************************************************/ + +static void Fig_GetAndShowExamsStats (void) + { + extern const char *Hlp_ANALYTICS_Figures_games; + extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES]; + extern const char *Txt_Number_of_BR_games; + extern const char *Txt_Number_of_BR_courses_with_BR_games; + extern const char *Txt_Average_number_BR_of_games_BR_per_course; + unsigned NumGames; + unsigned NumCoursesWithGames = 0; + double NumGamesPerCourse = 0.0; + + /***** Get the number of games from this location *****/ + if ((NumGames = Gam_GetNumGames (Gbl.Scope.Current))) + if ((NumCoursesWithGames = Gam_GetNumCoursesWithGames (Gbl.Scope.Current)) != 0) + NumGamesPerCourse = (double) NumGames / (double) NumCoursesWithGames; + + /***** Begin box and table *****/ + Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_GAMES], + NULL,NULL, + Hlp_ANALYTICS_Figures_games,Box_NOT_CLOSABLE,2); + + /***** Write table heading *****/ + HTM_TR_Begin (NULL); + + HTM_TH (1,1,"RM",Txt_Number_of_BR_games); + HTM_TH (1,1,"RM",Txt_Number_of_BR_courses_with_BR_games); + HTM_TH (1,1,"RM",Txt_Average_number_BR_of_games_BR_per_course); + + HTM_TR_End (); + + /***** Write number of games *****/ + HTM_TR_Begin (NULL); + + HTM_TD_Begin ("class=\"DAT RM\""); + HTM_Unsigned (NumGames); + HTM_TD_End (); + + HTM_TD_Begin ("class=\"DAT RM\""); + HTM_Unsigned (NumCoursesWithGames); + HTM_TD_End (); + + HTM_TD_Begin ("class=\"DAT RM\""); + HTM_Double2Decimals (NumGamesPerCourse); + HTM_TD_End (); + + HTM_TR_End (); + + /***** End table and box *****/ + Box_BoxTableEnd (); + } + /*****************************************************************************/ /*************************** Show stats about games **************************/ /*****************************************************************************/ diff --git a/swad_figure.h b/swad_figure.h index 268902ff..aea8d299 100644 --- a/swad_figure.h +++ b/swad_figure.h @@ -33,7 +33,7 @@ /************************** Public types and constants ***********************/ /*****************************************************************************/ -#define Fig_NUM_FIGURES 29 +#define Fig_NUM_FIGURES 30 typedef enum { Fig_USERS, // Number of users @@ -47,6 +47,7 @@ typedef enum Fig_ASSIGNMENTS, // Number of assignments Fig_PROJECTS, // Number of projects Fig_TESTS, // Number of test questions + Fig_EXAMS, // Number of exams Fig_GAMES, // Number of games Fig_SURVEYS, // Number of surveys Fig_TIMELINE, // Number of timeline notes diff --git a/swad_game.c b/swad_game.c index 0776c07f..0be4ff96 100644 --- a/swad_game.c +++ b/swad_game.c @@ -1696,7 +1696,7 @@ void Gam_ListTstQuestionsToSelect (void) { /***** List several test questions for selection *****/ Games.GamCod = Game.GamCod; - Tst_ListQuestionsToSelect (&Games); + Tst_ListQuestionsToSelectForGame (&Games); } else Lay_NoPermissionExit (); diff --git a/swad_help_URL.c b/swad_help_URL.c index 5519c11f..72c428ef 100644 --- a/swad_help_URL.c +++ b/swad_help_URL.c @@ -1390,6 +1390,132 @@ const char *Hlp_ASSESSMENT_Tests_results = "ASSESSMENT.Tests.en#results"; #endif +const char *Hlp_ASSESSMENT_Exams = +#if L==1 + "ASSESSMENT.Exams.es"; +#elif L==2 + "ASSESSMENT.Exams.en"; +#elif L==3 + "ASSESSMENT.Exams.en"; +#elif L==4 + "ASSESSMENT.Exams.es"; +#elif L==5 + "ASSESSMENT.Exams.en"; +#elif L==6 + "ASSESSMENT.Exams.es"; +#elif L==7 + "ASSESSMENT.Exams.en"; +#elif L==8 + "ASSESSMENT.Exams.en"; +#elif L==9 + "ASSESSMENT.Exams.en"; +#endif + +const char *Hlp_ASSESSMENT_Exams_edit_exam = +#if L==1 + "ASSESSMENT.Exams.es#editar-examen"; +#elif L==2 + "ASSESSMENT.Exams.en#edit-exam"; +#elif L==3 + "ASSESSMENT.Exams.en#edit-exam"; +#elif L==4 + "ASSESSMENT.Exams.es#editar-examen"; +#elif L==5 + "ASSESSMENT.Exams.en#edit-exam"; +#elif L==6 + "ASSESSMENT.Exams.es#editar-examen"; +#elif L==7 + "ASSESSMENT.Exams.en#edit-exam"; +#elif L==8 + "ASSESSMENT.Exams.en#edit-exam"; +#elif L==9 + "ASSESSMENT.Exams.en#edit-exam"; +#endif + +const char *Hlp_ASSESSMENT_Exams_events = +#if L==1 + "ASSESSMENT.Exams.es#eventos"; +#elif L==2 + "ASSESSMENT.Exams.en#events"; +#elif L==3 + "ASSESSMENT.Exams.en#events"; +#elif L==4 + "ASSESSMENT.Exams.es#eventos"; +#elif L==5 + "ASSESSMENT.Exams.en#events"; +#elif L==6 + "ASSESSMENT.Exams.es#eventos"; +#elif L==7 + "ASSESSMENT.Exams.en#events"; +#elif L==8 + "ASSESSMENT.Exams.en#events"; +#elif L==9 + "ASSESSMENT.Exams.en#events"; +#endif + +const char *Hlp_ASSESSMENT_Exams_new_exam = +#if L==1 + "ASSESSMENT.Exams.es#nuevo-examen"; +#elif L==2 + "ASSESSMENT.Exams.en#new-exam"; +#elif L==3 + "ASSESSMENT.Exams.en#new-exam"; +#elif L==4 + "ASSESSMENT.Exams.es#nuevo-examen"; +#elif L==5 + "ASSESSMENT.Exams.en#new-exam"; +#elif L==6 + "ASSESSMENT.Exams.es#nuevo-examen"; +#elif L==7 + "ASSESSMENT.Exams.en#new-exam"; +#elif L==8 + "ASSESSMENT.Exams.en#new-exam"; +#elif L==9 + "ASSESSMENT.Exams.en#new-exam"; +#endif + +const char *Hlp_ASSESSMENT_Exams_questions = +#if L==1 + "ASSESSMENT.Exams.es#preguntas"; +#elif L==2 + "ASSESSMENT.Exams.en#questions"; +#elif L==3 + "ASSESSMENT.Exams.en#questions"; +#elif L==4 + "ASSESSMENT.Exams.es#preguntas"; +#elif L==5 + "ASSESSMENT.Exams.en#questions"; +#elif L==6 + "ASSESSMENT.Exams.es#preguntas"; +#elif L==7 + "ASSESSMENT.Exams.en#questions"; +#elif L==8 + "ASSESSMENT.Exams.en#questions"; +#elif L==9 + "ASSESSMENT.Exams.en#questions"; +#endif + +const char *Hlp_ASSESSMENT_Exams_results = +#if L==1 + "ASSESSMENT.Exams.es#resultados"; +#elif L==2 + "ASSESSMENT.Exams.en#results"; +#elif L==3 + "ASSESSMENT.Exams.en#results"; +#elif L==4 + "ASSESSMENT.Exams.es#resultados"; +#elif L==5 + "ASSESSMENT.Exams.en#results"; +#elif L==6 + "ASSESSMENT.Exams.es#resultados"; +#elif L==7 + "ASSESSMENT.Exams.en#results"; +#elif L==8 + "ASSESSMENT.Exams.en#results"; +#elif L==9 + "ASSESSMENT.Exams.en#results"; +#endif + const char *Hlp_ASSESSMENT_Games = #if L==1 "ASSESSMENT.Games.es"; diff --git a/swad_match.c b/swad_match.c index e5121147..ddafabdf 100644 --- a/swad_match.c +++ b/swad_match.c @@ -229,7 +229,7 @@ static void Mch_GetNumPlayers (struct Mch_Match *Match); static void Mch_RemoveMyAnswerToMatchQuestion (const struct Mch_Match *Match); -static void Mch_ComputeScore (struct TstExa_Exam *Result); +static void Mch_ComputeScore (struct TstRes_Result *Result); static unsigned Mch_GetNumUsrsWhoHaveAnswerMch (long MchCod); @@ -1589,7 +1589,7 @@ static void Mch_ReorderAnswer (long MchCod,unsigned QstInd, long LongNum; unsigned AnsInd; char StrOneAnswer[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; - char StrAnswersOneQst[TstExa_MAX_BYTES_ANSWERS_ONE_QST + 1]; + char StrAnswersOneQst[TstRes_MAX_BYTES_ANSWERS_ONE_QST + 1]; /***** Initialize list of answers to empty string *****/ StrAnswersOneQst[0] = '\0'; @@ -1622,9 +1622,9 @@ static void Mch_ReorderAnswer (long MchCod,unsigned QstInd, /* Concatenate answer index to list of answers */ if (NumAns) Str_Concat (StrAnswersOneQst,",", - TstExa_MAX_BYTES_ANSWERS_ONE_QST); + TstRes_MAX_BYTES_ANSWERS_ONE_QST); Str_Concat (StrAnswersOneQst,StrOneAnswer, - TstExa_MAX_BYTES_ANSWERS_ONE_QST); + TstRes_MAX_BYTES_ANSWERS_ONE_QST); } /***** Free structure that stores the query result *****/ @@ -1648,7 +1648,7 @@ void Mch_GetIndexes (long MchCod,unsigned QstInd, { MYSQL_RES *mysql_res; MYSQL_ROW row; - char StrIndexesOneQst[TstExa_MAX_BYTES_INDEXES_ONE_QST + 1]; + char StrIndexesOneQst[TstRes_MAX_BYTES_INDEXES_ONE_QST + 1]; /***** Get indexes for a question from database *****/ if (!DB_QuerySELECT (&mysql_res,"can not get data of a question", @@ -1661,14 +1661,14 @@ void Mch_GetIndexes (long MchCod,unsigned QstInd, /* Get indexes (row[0]) */ Str_Copy (StrIndexesOneQst,row[0], - TstExa_MAX_BYTES_INDEXES_ONE_QST); + TstRes_MAX_BYTES_INDEXES_ONE_QST); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); /***** Get indexes from string *****/ Par_ReplaceCommaBySeparatorMultiple (StrIndexesOneQst); - TstExa_GetIndexesFromStr (StrIndexesOneQst,Indexes); + TstRes_GetIndexesFromStr (StrIndexesOneQst,Indexes); } /*****************************************************************************/ @@ -3828,7 +3828,7 @@ void Mch_ReceiveQuestionAnswer (void) unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION]; struct Mch_UsrAnswer PreviousUsrAnswer; struct Mch_UsrAnswer UsrAnswer; - struct TstExa_Exam Result; + struct TstRes_Result Result; /***** Get data of the match from database *****/ Match.MchCod = Mch_GetMchCodBeingPlayed (); @@ -3946,7 +3946,7 @@ static void Mch_RemoveMyAnswerToMatchQuestion (const struct Mch_Match *Match) /******************** Compute match score for a student **********************/ /*****************************************************************************/ -static void Mch_ComputeScore (struct TstExa_Exam *Result) +static void Mch_ComputeScore (struct TstRes_Result *Result) { unsigned NumQst; struct Tst_Question Question; @@ -3961,7 +3961,7 @@ static void Mch_ComputeScore (struct TstExa_Exam *Result) Question.Answer.Type = Tst_ANS_UNIQUE_CHOICE; /***** Compute score for this answer ******/ - TstExa_ComputeChoiceAnsScore (Result,NumQst,&Question); + TstRes_ComputeChoiceAnsScore (Result,NumQst,&Question); /***** Update total score *****/ Result->Score += Result->Questions[NumQst].Score; diff --git a/swad_match_result.c b/swad_match_result.c index b3118dc6..91e7144d 100644 --- a/swad_match_result.c +++ b/swad_match_result.c @@ -101,7 +101,7 @@ static void MchRes_ShowMchResultsSummaryRow (unsigned NumResults, double TotalScoreOfAllResults, double TotalGrade); static void MchRes_GetMatchResultDataByMchCod (long MchCod,long UsrCod, - struct TstExa_Exam *Exam); + struct TstRes_Result *Result); static bool MchRes_CheckIfICanSeeMatchResult (struct Mch_Match *Match,long UsrCod); static bool MchRes_CheckIfICanViewScore (bool ICanViewResult,unsigned Visibility); @@ -300,7 +300,7 @@ static void MchRes_ListAllMchResultsInSelectedGames (struct Gam_Games *Games) Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64); Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat); if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) - if (Usr_CheckIfICanViewMch (&Gbl.Usrs.Other.UsrDat)) + if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat)) { /***** Show matches results *****/ Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat); @@ -414,7 +414,7 @@ static void MchRes_ListAllMchResultsInGam (struct Gam_Games *Games,long GamCod) /* Get match code (row[0]) */ if ((Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0])) > 0) if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) - if (Usr_CheckIfICanViewMch (&Gbl.Usrs.Other.UsrDat)) + if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat)) { /***** Show matches results *****/ Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat); @@ -504,7 +504,7 @@ static void MchRes_ListAllMchResultsInMch (struct Gam_Games *Games,long MchCod) /* Get match code (row[0]) */ if ((Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0])) > 0) if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) - if (Usr_CheckIfICanViewMch (&Gbl.Usrs.Other.UsrDat)) + if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat)) { /***** Show matches results *****/ Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat); @@ -927,8 +927,8 @@ static void MchRes_ShowMchResults (struct Gam_Games *Games, HTM_TD_Begin ("class=\"DAT RT COLOR%u\"",Gbl.RowEvenOdd); if (ICanViewScore) { - Grade = TstExa_ComputeGrade (NumQstsInThisResult,ScoreInThisResult,MaxGrade); - TstExa_ShowGrade (Grade,MaxGrade); + Grade = TstRes_ComputeGrade (NumQstsInThisResult,ScoreInThisResult,MaxGrade); + TstRes_ShowGrade (Grade,MaxGrade); TotalGrade += Grade; } else @@ -1061,7 +1061,7 @@ void MchRes_ShowOneMchResult (void) struct UsrData *UsrDat; Dat_StartEndTime_t StartEndTime; char *Id; - struct TstExa_Exam Exam; + struct TstRes_Result Result; bool ShowPhoto; char PhotoURL[PATH_MAX + 1]; bool ICanViewResult; @@ -1089,8 +1089,8 @@ void MchRes_ShowOneMchResult (void) } /***** Get match result data *****/ - TstExa_ResetExam (&Exam); - MchRes_GetMatchResultDataByMchCod (Match.MchCod,UsrDat->UsrCod,&Exam); + TstRes_ResetResult (&Result); + MchRes_GetMatchResultDataByMchCod (Match.MchCod,UsrDat->UsrCod,&Result); /***** Check if I can view this match result *****/ switch (Gbl.Usrs.Me.Role.Logged) @@ -1121,7 +1121,7 @@ void MchRes_ShowOneMchResult (void) { /***** Get questions and user's answers of the match result from database *****/ MchRes_GetMatchResultQuestionsFromDB (Match.MchCod,UsrDat->UsrCod, - &Exam); + &Result); /***** Begin box *****/ Box_BoxBegin (NULL,Match.Title, @@ -1139,7 +1139,7 @@ void MchRes_ShowOneMchResult (void) /* Get data of the user who answer the match */ if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (UsrDat,Usr_DONT_GET_PREFS)) Lay_ShowErrorAndExit (Txt_The_user_does_not_exist); - if (!Usr_CheckIfICanViewTst (UsrDat)) + if (!Usr_CheckIfICanViewTstExaMchResult (UsrDat)) Lay_NoPermissionExit (); /* User */ @@ -1179,7 +1179,7 @@ void MchRes_ShowOneMchResult (void) if (asprintf (&Id,"match_%u",(unsigned) StartEndTime) < 0) Lay_NotEnoughMemoryExit (); HTM_TD_Begin ("id=\"%s\" class=\"DAT LT\"",Id); - Dat_WriteLocalDateHMSFromUTC (Id,Exam.TimeUTC[StartEndTime], + Dat_WriteLocalDateHMSFromUTC (Id,Result.TimeUTC[StartEndTime], Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA, true,true,true,0x7); HTM_TD_End (); @@ -1197,8 +1197,8 @@ void MchRes_ShowOneMchResult (void) HTM_TD_Begin ("class=\"DAT LT\""); HTM_TxtF ("%u (%u %s)", - Exam.NumQsts, - Exam.NumQstsNotBlank,Txt_non_blank_QUESTIONS); + Result.NumQsts, + Result.NumQstsNotBlank,Txt_non_blank_QUESTIONS); HTM_TD_End (); HTM_TR_End (); @@ -1212,7 +1212,7 @@ void MchRes_ShowOneMchResult (void) HTM_TD_Begin ("class=\"DAT LT\""); if (ICanViewScore) - HTM_Double2Decimals (Exam.Score); + HTM_Double2Decimals (Result.Score); else Ico_PutIconNotVisible (); HTM_TD_End (); @@ -1228,9 +1228,8 @@ void MchRes_ShowOneMchResult (void) HTM_TD_Begin ("class=\"DAT LT\""); if (ICanViewScore) - TstExa_ComputeAndShowGrade (Exam.NumQsts, - Exam.Score, - Game.MaxGrade); + TstRes_ComputeAndShowGrade (Result.NumQsts,Result.Score, + Game.MaxGrade); else Ico_PutIconNotVisible (); HTM_TD_End (); @@ -1251,7 +1250,7 @@ void MchRes_ShowOneMchResult (void) HTM_TR_End (); /***** Write answers and solutions *****/ - TstExa_ShowExamAnswers (UsrDat,&Exam,Game.Visibility); + TstRes_ShowExamAnswers (UsrDat,&Result,Game.Visibility); /***** End table *****/ HTM_TABLE_End (); @@ -1261,10 +1260,11 @@ void MchRes_ShowOneMchResult (void) { HTM_DIV_Begin ("class=\"DAT_N_BOLD CM\""); HTM_TxtColonNBSP (Txt_Score); - HTM_Double2Decimals (Exam.Score); + HTM_Double2Decimals (Result.Score); HTM_BR (); HTM_TxtColonNBSP (Txt_Grade); - TstExa_ComputeAndShowGrade (Exam.NumQsts,Exam.Score,Game.MaxGrade); + TstRes_ComputeAndShowGrade (Result.NumQsts,Result.Score, + Game.MaxGrade); HTM_DIV_End (); } @@ -1280,7 +1280,7 @@ void MchRes_ShowOneMchResult (void) /*****************************************************************************/ void MchRes_GetMatchResultQuestionsFromDB (long MchCod,long UsrCod, - struct TstExa_Exam *Exam) + struct TstRes_Result *Result) { MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -1290,27 +1290,27 @@ void MchRes_GetMatchResultQuestionsFromDB (long MchCod,long UsrCod, struct Mch_UsrAnswer UsrAnswer; /***** Get questions and answers of a match result *****/ - Exam->NumQsts = (unsigned) - DB_QuerySELECT (&mysql_res,"can not get questions and answers" - " of a match result", - "SELECT gam_questions.QstCod," // row[0] - "gam_questions.QstInd," // row[1] - "mch_indexes.Indexes" // row[2] - " FROM mch_matches,gam_questions,mch_indexes" - " WHERE mch_matches.MchCod=%ld" - " AND mch_matches.GamCod=gam_questions.GamCod" - " AND mch_matches.MchCod=mch_indexes.MchCod" - " AND gam_questions.QstInd=mch_indexes.QstInd" - " ORDER BY gam_questions.QstInd", - MchCod); - for (NumQst = 0, Exam->NumQstsNotBlank = 0; - NumQst < Exam->NumQsts; + Result->NumQsts = (unsigned) + DB_QuerySELECT (&mysql_res,"can not get questions and answers" + " of a match result", + "SELECT gam_questions.QstCod," // row[0] + "gam_questions.QstInd," // row[1] + "mch_indexes.Indexes" // row[2] + " FROM mch_matches,gam_questions,mch_indexes" + " WHERE mch_matches.MchCod=%ld" + " AND mch_matches.GamCod=gam_questions.GamCod" + " AND mch_matches.MchCod=mch_indexes.MchCod" + " AND gam_questions.QstInd=mch_indexes.QstInd" + " ORDER BY gam_questions.QstInd", + MchCod); + for (NumQst = 0, Result->NumQstsNotBlank = 0; + NumQst < Result->NumQsts; NumQst++) { row = mysql_fetch_row (mysql_res); /* Get question code (row[0]) */ - if ((Exam->Questions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0) + if ((Result->Questions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0) Lay_ShowErrorAndExit ("Wrong code of question."); /* Get question index (row[1]) */ @@ -1319,24 +1319,24 @@ void MchRes_GetMatchResultQuestionsFromDB (long MchCod,long UsrCod, QstInd = (unsigned) LongNum; /* Get indexes for this question (row[2]) */ - Str_Copy (Exam->Questions[NumQst].StrIndexes,row[2], - TstExa_MAX_BYTES_INDEXES_ONE_QST); + Str_Copy (Result->Questions[NumQst].StrIndexes,row[2], + TstRes_MAX_BYTES_INDEXES_ONE_QST); /* Get answers selected by user for this question */ Mch_GetQstAnsFromDB (MchCod,UsrCod,QstInd,&UsrAnswer); if (UsrAnswer.AnsInd >= 0) // UsrAnswer.AnsInd >= 0 ==> answer selected { - snprintf (Exam->Questions[NumQst].StrAnswers,TstExa_MAX_BYTES_ANSWERS_ONE_QST + 1, + snprintf (Result->Questions[NumQst].StrAnswers,TstRes_MAX_BYTES_ANSWERS_ONE_QST + 1, "%d",UsrAnswer.AnsInd); - Exam->NumQstsNotBlank++; + Result->NumQstsNotBlank++; } else // UsrAnswer.AnsInd < 0 ==> no answer selected - Exam->Questions[NumQst].StrAnswers[0] = '\0'; // Empty answer + Result->Questions[NumQst].StrAnswers[0] = '\0'; // Empty answer /* Replace each comma by a separator of multiple parameters */ /* In database commas are used as separators instead of special chars */ - Par_ReplaceCommaBySeparatorMultiple (Exam->Questions[NumQst].StrIndexes); - Par_ReplaceCommaBySeparatorMultiple (Exam->Questions[NumQst].StrAnswers); + Par_ReplaceCommaBySeparatorMultiple (Result->Questions[NumQst].StrIndexes); + Par_ReplaceCommaBySeparatorMultiple (Result->Questions[NumQst].StrAnswers); } /***** Free structure that stores the query result *****/ @@ -1348,7 +1348,7 @@ void MchRes_GetMatchResultQuestionsFromDB (long MchCod,long UsrCod, /*****************************************************************************/ static void MchRes_GetMatchResultDataByMchCod (long MchCod,long UsrCod, - struct TstExa_Exam *Exam) + struct TstRes_Result *Result) { MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -1377,27 +1377,27 @@ static void MchRes_GetMatchResultDataByMchCod (long MchCod,long UsrCod, for (StartEndTime = (Dat_StartEndTime_t) 0; StartEndTime <= (Dat_StartEndTime_t) (Dat_NUM_START_END_TIME - 1); StartEndTime++) - Exam->TimeUTC[StartEndTime] = Dat_GetUNIXTimeFromStr (row[StartEndTime]); + Result->TimeUTC[StartEndTime] = Dat_GetUNIXTimeFromStr (row[StartEndTime]); /* Get number of questions (row[2]) */ - if (sscanf (row[2],"%u",&Exam->NumQsts) != 1) - Exam->NumQsts = 0; + if (sscanf (row[2],"%u",&Result->NumQsts) != 1) + Result->NumQsts = 0; /* Get number of questions not blank (row[3]) */ - if (sscanf (row[3],"%u",&Exam->NumQstsNotBlank) != 1) - Exam->NumQstsNotBlank = 0; + if (sscanf (row[3],"%u",&Result->NumQstsNotBlank) != 1) + Result->NumQstsNotBlank = 0; /* Get score (row[4]) */ Str_SetDecimalPointToUS (); // To get the decimal point as a dot - if (sscanf (row[4],"%lf",&Exam->Score) != 1) - Exam->Score = 0.0; + if (sscanf (row[4],"%lf",&Result->Score) != 1) + Result->Score = 0.0; Str_SetDecimalPointToLocal (); // Return to local system } else { - Exam->NumQsts = 0; - Exam->NumQstsNotBlank = 0; - Exam->Score = 0.0; + Result->NumQsts = 0; + Result->NumQstsNotBlank = 0; + Result->Score = 0.0; } /***** Free structure that stores the query result *****/ diff --git a/swad_match_result.h b/swad_match_result.h index cefb0d91..4e773737 100644 --- a/swad_match_result.h +++ b/swad_match_result.h @@ -51,6 +51,6 @@ void MchRes_ShowAllMchResultsInMch (void); void MchRes_ShowOneMchResult (void); void MchRes_GetMatchResultQuestionsFromDB (long MchCod,long UsrCod, - struct TstExa_Exam *Exam); + struct TstRes_Result *Result); #endif diff --git a/swad_menu.c b/swad_menu.c index 78561b6a..c9a3c76c 100644 --- a/swad_menu.c +++ b/swad_menu.c @@ -116,9 +116,10 @@ static const Act_Action_t Mnu_MenuActions[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_ [ 1] = ActSeeAsg, [ 2] = ActSeePrj, [ 3] = ActReqTst, - [ 4] = ActSeeAllGam, - [ 5] = ActSeeAllSvy, - [ 6] = ActSeeAllExaAnn, + [ 4] = ActSeeAllExa, + [ 5] = ActSeeAllGam, + [ 6] = ActSeeAllSvy, + [ 7] = ActSeeAllExaAnn, }, [TabFil] = { [ 0] = ActSeeAdmDocIns, diff --git a/swad_pagination.c b/swad_pagination.c index 3fcb091a..37a4a518 100644 --- a/swad_pagination.c +++ b/swad_pagination.c @@ -34,6 +34,7 @@ #include "swad_agenda.h" #include "swad_attendance.h" #include "swad_database.h" +#include "swad_exam.h" #include "swad_form.h" #include "swad_forum.h" #include "swad_game.h" @@ -62,6 +63,7 @@ static const char *Pag_ParamNumPag[Pag_NUM_WHAT_PAGINATE] = { [Pag_ASSIGNMENTS ] = "NumPagAsg", [Pag_PROJECTS ] = "NumPagPrj", + [Pag_EXAMS ] = "NumPagExa", [Pag_GAMES ] = "NumPagGam", [Pag_SURVEYS ] = "NumPagSvy", [Pag_ATT_EVENTS ] = "NumPagAtt", @@ -187,6 +189,13 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate, 1, Cod); break; + case Pag_EXAMS: + Frm_StartFormAnchor (ActSeeAllExa,Pagination->Anchor); + Pag_PutHiddenParamPagNum (WhatPaginate,1); + Dat_PutHiddenParamOrder (((struct Exa_Exams *) Context)->SelectedOrder); + WhichGroups = Grp_GetParamWhichGroups (); + Grp_PutParamWhichGroups (&WhichGroups); + break; case Pag_GAMES: Frm_StartFormAnchor (ActSeeAllGam,Pagination->Anchor); Pag_PutHiddenParamPagNum (WhatPaginate,1); @@ -305,6 +314,13 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate, 1, Cod); break; + case Pag_EXAMS: + Frm_StartFormAnchor (ActSeeAllExa,Pagination->Anchor); + Pag_PutHiddenParamPagNum (WhatPaginate,1); + Dat_PutHiddenParamOrder (((struct Exa_Exams *) Context)->SelectedOrder); + WhichGroups = Grp_GetParamWhichGroups (); + Grp_PutParamWhichGroups (&WhichGroups); + break; case Pag_GAMES: Frm_StartFormAnchor (ActSeeAllGam,Pagination->Anchor); Pag_PutHiddenParamPagNum (WhatPaginate,1); @@ -409,6 +425,13 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate, Pagination->LeftPage, Cod); break; + case Pag_EXAMS: + Frm_StartFormAnchor (ActSeeAllExa,Pagination->Anchor); + Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->LeftPage); + Dat_PutHiddenParamOrder (((struct Exa_Exams *) Context)->SelectedOrder); + WhichGroups = Grp_GetParamWhichGroups (); + Grp_PutParamWhichGroups (&WhichGroups); + break; case Pag_GAMES: Frm_StartFormAnchor (ActSeeAllGam,Pagination->Anchor); Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->LeftPage); @@ -525,6 +548,13 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate, NumPage, Cod); break; + case Pag_EXAMS: + Frm_StartFormAnchor (ActSeeAllExa,Pagination->Anchor); + Pag_PutHiddenParamPagNum (WhatPaginate,NumPage); + Dat_PutHiddenParamOrder (((struct Exa_Exams *) Context)->SelectedOrder); + WhichGroups = Grp_GetParamWhichGroups (); + Grp_PutParamWhichGroups (&WhichGroups); + break; case Pag_GAMES: Frm_StartFormAnchor (ActSeeAllGam,Pagination->Anchor); Pag_PutHiddenParamPagNum (WhatPaginate,NumPage); @@ -628,6 +658,13 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate, Pagination->RightPage, Cod); break; + case Pag_EXAMS: + Frm_StartFormAnchor (ActSeeAllExa,Pagination->Anchor); + Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->RightPage); + Dat_PutHiddenParamOrder (((struct Exa_Exams *) Context)->SelectedOrder); + WhichGroups = Grp_GetParamWhichGroups (); + Grp_PutParamWhichGroups (&WhichGroups); + break; case Pag_GAMES: Frm_StartFormAnchor (ActSeeAllGam,Pagination->Anchor); Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->RightPage); @@ -732,6 +769,13 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate, Pagination->NumPags, Cod); break; + case Pag_EXAMS: + Frm_StartFormAnchor (ActSeeAllExa,Pagination->Anchor); + Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->NumPags); + Dat_PutHiddenParamOrder (((struct Exa_Exams *) Context)->SelectedOrder); + WhichGroups = Grp_GetParamWhichGroups (); + Grp_PutParamWhichGroups (&WhichGroups); + break; case Pag_GAMES: Frm_StartFormAnchor (ActSeeAllGam,Pagination->Anchor); Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->NumPags); diff --git a/swad_pagination.h b/swad_pagination.h index 1595033a..dffc1c95 100644 --- a/swad_pagination.h +++ b/swad_pagination.h @@ -39,20 +39,21 @@ /******************************** Public types *******************************/ /*****************************************************************************/ -#define Pag_NUM_WHAT_PAGINATE 11 +#define Pag_NUM_WHAT_PAGINATE 12 typedef enum { Pag_ASSIGNMENTS = 0, Pag_PROJECTS = 1, - Pag_GAMES = 2, - Pag_SURVEYS = 3, - Pag_ATT_EVENTS = 4, - Pag_THREADS_FORUM = 5, - Pag_POSTS_FORUM = 6, - Pag_MESSAGES_RECEIVED = 7, - Pag_MESSAGES_SENT = 8, - Pag_MY_AGENDA = 9, - Pag_ANOTHER_AGENDA = 10, + Pag_EXAMS = 2, + Pag_GAMES = 3, + Pag_SURVEYS = 4, + Pag_ATT_EVENTS = 5, + Pag_THREADS_FORUM = 6, + Pag_POSTS_FORUM = 7, + Pag_MESSAGES_RECEIVED = 8, + Pag_MESSAGES_SENT = 9, + Pag_MY_AGENDA = 10, + Pag_ANOTHER_AGENDA = 11, } Pag_WhatPaginate_t; struct Pagination // Used for threads and messages pagination diff --git a/swad_record.c b/swad_record.c index e06cddf8..4de4d8ae 100644 --- a/swad_record.c +++ b/swad_record.c @@ -2528,7 +2528,7 @@ static void Rec_PutIconsCommands (__attribute__((unused)) void *Args) if (Gbl.Record.UsrDat->Roles.InCurrentCrs.Role == Rol_STD) // He/she is a student in current course { /***** Button to view student's test exams *****/ - if (Usr_CheckIfICanViewTst (Gbl.Record.UsrDat)) + if (Usr_CheckIfICanViewTstExaMchResult (Gbl.Record.UsrDat)) { if (ItsMe) Lay_PutContextualLinkOnlyIcon (ActSeeMyTstRes,NULL, diff --git a/swad_test.c b/swad_test.c index d2a9c79e..7f0949b3 100644 --- a/swad_test.c +++ b/swad_test.c @@ -132,15 +132,15 @@ static void Tst_ShowFormRequestTest (struct Tst_Test *Test); static void Tst_PutCheckBoxAllowTeachers (bool AllowTeachers); -static void Tst_GetAnswersFromForm (struct TstExa_Exam *Exam); +static void Tst_GetAnswersFromForm (struct TstRes_Result *Result); static bool Tst_CheckIfNextTstAllowed (void); static unsigned Tst_GetNumExamsGeneratedByMe (void); -static void Tst_ShowTestExamToFillIt (struct TstExa_Exam *Exam, +static void Tst_ShowTestExamToFillIt (struct TstRes_Result *Result, unsigned NumExamsGeneratedByMe, Tst_RequestOrConfirm_t RequestOrConfirm); -static void Tst_WriteQstAndAnsSeeing (const struct TstExa_Exam *Exam, +static void Tst_WriteQstAndAnsSeeing (const struct TstRes_Result *Result, unsigned NumQst, const struct Tst_Question *Question); @@ -150,6 +150,8 @@ static void Tst_IncreaseMyNumAccessTst (void); static void Tst_UpdateLastAccTst (unsigned NumQsts); static void Tst_ShowFormRequestEditTests (struct Tst_Test *Test); +static void Tst_ShowFormRequestSelectTestsForExam (struct Exa_Exams *Exams, + struct Tst_Test *Test); static void Tst_ShowFormRequestSelectTestsForGame (struct Gam_Games *Games, struct Tst_Test *Test); static bool Tst_CheckIfICanEditTests (void); @@ -174,8 +176,8 @@ static void Tst_PutInputFieldNumQst (const char *Field,const char *Label, static void Tst_ShowFormAnswerTypes (const struct Tst_AnswerTypes *AnswerTypes); static void Tst_GetQuestions (struct Tst_Test *Test,MYSQL_RES **mysql_res); static void Tst_GetQuestionsForNewTestFromDB (struct Tst_Test *Test, - struct TstExa_Exam *Exam); -static void Tst_GenerateChoiceIndexesDependingOnShuffle (struct TstExa_Exam *Exam, + struct TstRes_Result *Result); +static void Tst_GenerateChoiceIndexesDependingOnShuffle (struct TstRes_Result *Result, unsigned NumQst, bool Shuffle); @@ -184,34 +186,37 @@ static void Tst_ListOneOrMoreQuestionsForEdition (struct Tst_Test *Test, MYSQL_RES *mysql_res); static void Tst_WriteHeadingRowQuestionsForEdition (const struct Tst_Test *Test); static void Tst_WriteQuestionListing (struct Tst_Test *Test,unsigned NumQst); -static void Tst_ListOneOrMoreQuestionsForSelection (struct Gam_Games *Games, +static void Tst_ListOneOrMoreQuestionsForSelectionForExam (struct Exa_Exams *Exams, + unsigned NumQsts, + MYSQL_RES *mysql_res); +static void Tst_ListOneOrMoreQuestionsForSelectionForGame (struct Gam_Games *Games, unsigned NumQsts, MYSQL_RES *mysql_res); static void Tst_WriteQuestionRowForSelection (unsigned NumQst, struct Tst_Question *Question); -static void Tst_WriteAnswersSeeing (const struct TstExa_Exam *Exam, +static void Tst_WriteAnswersSeeing (const struct TstRes_Result *Result, unsigned NumQst, const struct Tst_Question *Question); static void Tst_WriteIntAnsListing (const struct Tst_Question *Question); -static void Tst_WriteIntAnsSeeing (const struct TstExa_Exam *Exam, +static void Tst_WriteIntAnsSeeing (const struct TstRes_Result *Result, unsigned NumQst); static void Tst_WriteFloatAnsEdit (const struct Tst_Question *Question); -static void Tst_WriteFloatAnsSeeing (const struct TstExa_Exam *Exam, +static void Tst_WriteFloatAnsSeeing (const struct TstRes_Result *Result, unsigned NumQst); static void Tst_WriteTFAnsListing (const struct Tst_Question *Question); -static void Tst_WriteTFAnsSeeing (const struct TstExa_Exam *Exam, +static void Tst_WriteTFAnsSeeing (const struct TstRes_Result *Result, unsigned NumQst); static void Tst_WriteChoiceAnsListing (const struct Tst_Question *Question); -static void Tst_WriteChoiceAnsSeeing (const struct TstExa_Exam *Exam, +static void Tst_WriteChoiceAnsSeeing (const struct TstRes_Result *Result, unsigned NumQst, const struct Tst_Question *Question); -static void Tst_WriteTextAnsSeeing (const struct TstExa_Exam *Exam, +static void Tst_WriteTextAnsSeeing (const struct TstRes_Result *Result, unsigned NumQst); static void Tst_WriteParamQstCod (unsigned NumQst,long QstCod); @@ -441,7 +446,7 @@ void Tst_ShowNewTest (void) { extern const char *Txt_No_questions_found_matching_your_search_criteria; struct Tst_Test Test; - struct TstExa_Exam Exam; + struct TstRes_Result Exam; unsigned NumExamsGeneratedByMe; /***** Create test *****/ @@ -456,7 +461,7 @@ void Tst_ShowNewTest (void) if (Tst_GetParamsTst (&Test,Tst_SHOW_TEST_TO_ANSWER)) // Get parameters from form { /***** Get questions *****/ - TstExa_ResetExam (&Exam); + TstRes_ResetResult (&Exam); Tst_GetQuestionsForNewTestFromDB (&Test,&Exam); if (Exam.NumQsts) { @@ -465,8 +470,8 @@ void Tst_ShowNewTest (void) NumExamsGeneratedByMe = Tst_GetNumExamsGeneratedByMe (); /***** Create new test exam in database *****/ - TstExa_CreateExamInDB (&Exam); - TstExa_ComputeScoresAndStoreExamQuestions (&Exam, + TstRes_CreateExamInDB (&Exam); + TstRes_ComputeScoresAndStoreExamQuestions (&Exam, false); // Don't update question score /***** Show test exam to be answered *****/ @@ -519,46 +524,46 @@ void Tst_ReceiveTestDraft (void) { extern const char *Txt_The_test_X_has_already_been_assessed_previously; unsigned NumTst; - struct TstExa_Exam Exam; + struct TstRes_Result Result; /***** Read test configuration from database *****/ TstCfg_GetConfigFromDB (); /***** Get basic parameters of the exam *****/ /* Get test exam code from form */ - TstExa_ResetExam (&Exam); - if ((Exam.ExaCod = TstExa_GetParamExaCod ()) <= 0) + TstRes_ResetResult (&Result); + if ((Result.ResCod = TstRes_GetParamExaCod ()) <= 0) Lay_ShowErrorAndExit ("Wrong test exam."); /* Get number of this test from form */ NumTst = Tst_GetParamNumTst (); /***** Get test exam from database *****/ - TstExa_GetExamDataByExaCod (&Exam); + TstRes_GetExamDataByExaCod (&Result); /****** Get test status in database for this session-course-num.test *****/ - if (Exam.Sent) + if (Result.Sent) Ale_ShowAlert (Ale_WARNING,Txt_The_test_X_has_already_been_assessed_previously, NumTst); else // Exam not yet sent { /***** Get test exam questions from database *****/ - TstExa_GetExamQuestionsFromDB (&Exam); + TstRes_GetExamQuestionsFromDB (&Result); /***** Get answers from form to assess a test *****/ - Tst_GetAnswersFromForm (&Exam); + Tst_GetAnswersFromForm (&Result); /***** Update test exam in database *****/ - TstExa_ComputeScoresAndStoreExamQuestions (&Exam, + TstRes_ComputeScoresAndStoreExamQuestions (&Result, false); // Don't update question score - TstExa_UpdateExamInDB (&Exam); + TstRes_UpdateExamInDB (&Result); /***** Show question and button to send the test *****/ /* Start alert */ Ale_ShowAlert (Ale_WARNING,"Por favor, revise sus respuestas antes de enviar el examen:"); // TODO: Need translation!!! /* Show the same test exam to be answered */ - Tst_ShowTestExamToFillIt (&Exam,NumTst,Tst_CONFIRM); + Tst_ShowTestExamToFillIt (&Result,NumTst,Tst_CONFIRM); } } @@ -575,43 +580,43 @@ void Tst_AssessTest (void) extern const char *Txt_Grade; extern const char *Txt_The_test_X_has_already_been_assessed_previously; unsigned NumTst; - struct TstExa_Exam Exam; + struct TstRes_Result Result; /***** Read test configuration from database *****/ TstCfg_GetConfigFromDB (); /***** Get basic parameters of the exam *****/ /* Get test exam code from form */ - TstExa_ResetExam (&Exam); - if ((Exam.ExaCod = TstExa_GetParamExaCod ()) <= 0) + TstRes_ResetResult (&Result); + if ((Result.ResCod = TstRes_GetParamExaCod ()) <= 0) Lay_ShowErrorAndExit ("Wrong test exam."); /* Get number of this test from form */ NumTst = Tst_GetParamNumTst (); /***** Get test exam from database *****/ - TstExa_GetExamDataByExaCod (&Exam); + TstRes_GetExamDataByExaCod (&Result); /****** Get test status in database for this session-course-num.test *****/ - if (Exam.Sent) + if (Result.Sent) Ale_ShowAlert (Ale_WARNING,Txt_The_test_X_has_already_been_assessed_previously, NumTst); else // Exam not yet sent { /***** Get test exam questions from database *****/ - TstExa_GetExamQuestionsFromDB (&Exam); + TstRes_GetExamQuestionsFromDB (&Result); /***** Get answers from form to assess a test *****/ - Tst_GetAnswersFromForm (&Exam); + Tst_GetAnswersFromForm (&Result); /***** Get if test exam will be visible by teachers *****/ - Exam.Sent = true; // The exam has been finished and sent by student - Exam.AllowTeachers = Par_GetParToBool ("AllowTchs"); + Result.Sent = true; // The exam has been finished and sent by student + Result.AllowTeachers = Par_GetParToBool ("AllowTchs"); /***** Update test exam in database *****/ - TstExa_ComputeScoresAndStoreExamQuestions (&Exam, + TstRes_ComputeScoresAndStoreExamQuestions (&Result, Gbl.Usrs.Me.Role.Logged == Rol_STD); // Update question score? - TstExa_UpdateExamInDB (&Exam); + TstRes_UpdateExamInDB (&Result); /***** Begin box *****/ Box_BoxBegin (NULL,Txt_Test_result, @@ -631,19 +636,19 @@ void Tst_AssessTest (void) } /***** Write answers and solutions *****/ - TstExa_ShowExamAfterAssess (&Exam); + TstRes_ShowExamAfterAssess (&Result); /***** Write total score and grade *****/ if (TstVis_IsVisibleTotalScore (TstCfg_GetConfigVisibility ())) { HTM_DIV_Begin ("class=\"DAT_N_BOLD CM\""); HTM_TxtColonNBSP (Txt_Score); - HTM_Double2Decimals (Exam.Score); + HTM_Double2Decimals (Result.Score); HTM_BR (); HTM_TxtColonNBSP (Txt_Grade); - TstExa_ComputeAndShowGrade (Exam.NumQsts, - Exam.Score, - TstExa_SCORE_MAX); + TstRes_ComputeAndShowGrade (Result.NumQsts, + Result.Score, + TstRes_SCORE_MAX); HTM_DIV_End (); } @@ -656,22 +661,22 @@ void Tst_AssessTest (void) /*********** Get questions and answers from form to assess a test ************/ /*****************************************************************************/ -static void Tst_GetAnswersFromForm (struct TstExa_Exam *Exam) +static void Tst_GetAnswersFromForm (struct TstRes_Result *Result) { unsigned NumQst; char StrAns[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x" /***** Loop for every question getting user's answers *****/ for (NumQst = 0; - NumQst < Exam->NumQsts; + NumQst < Result->NumQsts; NumQst++) { /* Get answers selected by user for this question */ snprintf (StrAns,sizeof (StrAns), "Ans%010u", NumQst); - Par_GetParMultiToText (StrAns,Exam->Questions[NumQst].StrAnswers, - TstExa_MAX_BYTES_ANSWERS_ONE_QST); /* If answer type == T/F ==> " ", "T", "F"; if choice ==> "0", "2",... */ + Par_GetParMultiToText (StrAns,Result->Questions[NumQst].StrAnswers, + TstRes_MAX_BYTES_ANSWERS_ONE_QST); /* If answer type == T/F ==> " ", "T", "F"; if choice ==> "0", "2",... */ } } @@ -783,7 +788,7 @@ static unsigned Tst_GetNumExamsGeneratedByMe (void) /************************ Show a test exam to be answered ********************/ /*****************************************************************************/ -static void Tst_ShowTestExamToFillIt (struct TstExa_Exam *Exam, +static void Tst_ShowTestExamToFillIt (struct TstRes_Result *Result, unsigned NumExamsGeneratedByMe, Tst_RequestOrConfirm_t RequestOrConfirm) { @@ -806,11 +811,11 @@ static void Tst_ShowTestExamToFillIt (struct TstExa_Exam *Exam, Gbl.Hierarchy.Deg.DegCod, Gbl.Hierarchy.Crs.CrsCod); - if (Exam->NumQsts) + if (Result->NumQsts) { /***** Begin form *****/ Frm_StartForm (Action[RequestOrConfirm]); - TstExa_PutParamExaCod (Exam->ExaCod); + TstRes_PutParamExaCod (Result->ResCod); Par_PutHiddenParamUnsigned (NULL,"NumTst",NumExamsGeneratedByMe); /***** Begin table *****/ @@ -818,21 +823,21 @@ static void Tst_ShowTestExamToFillIt (struct TstExa_Exam *Exam, /***** Write one row for each question *****/ for (NumQst = 0; - NumQst < Exam->NumQsts; + NumQst < Result->NumQsts; NumQst++) { Gbl.RowEvenOdd = NumQst % 2; /* Create test question */ Tst_QstConstructor (&Question); - Question.QstCod = Exam->Questions[NumQst].QstCod; + Question.QstCod = Result->Questions[NumQst].QstCod; /* Show question */ if (!Tst_GetQstDataFromDB (&Question)) // Question exists Lay_ShowErrorAndExit ("Wrong question."); /* Write question and answers */ - Tst_WriteQstAndAnsSeeing (Exam,NumQst,&Question); + Tst_WriteQstAndAnsSeeing (Result,NumQst,&Question); /* Destroy test question */ Tst_QstDestructor (&Question); @@ -846,7 +851,7 @@ static void Tst_ShowTestExamToFillIt (struct TstExa_Exam *Exam, { case Tst_REQUEST: /* Send button */ - Btn_PutConfirmButton ("He terminado"); // TODO: Need translation!!! + Btn_PutConfirmButton ("Continuar"); // TODO: Need translation!!! break; case Tst_CONFIRM: /* Will the test exam be visible by teachers? */ @@ -896,7 +901,7 @@ void Tst_ShowTagList (unsigned NumTags,MYSQL_RES *mysql_res) /********** Write a row of a test, with one question and its answer **********/ /*****************************************************************************/ -static void Tst_WriteQstAndAnsSeeing (const struct TstExa_Exam *Exam, +static void Tst_WriteQstAndAnsSeeing (const struct TstRes_Result *Result, unsigned NumQst, const struct Tst_Question *Question) { @@ -924,7 +929,7 @@ static void Tst_WriteQstAndAnsSeeing (const struct TstExa_Exam *Exam, "TEST_MED_SHOW"); /* Answers */ - Tst_WriteAnswersSeeing (Exam,NumQst,Question); + Tst_WriteAnswersSeeing (Result,NumQst,Question); HTM_TD_End (); @@ -1213,6 +1218,24 @@ static void Tst_ShowFormRequestEditTests (struct Tst_Test *Test) /******************* Select test questions for a game ************************/ /*****************************************************************************/ +void Tst_RequestSelectTestsForExam (struct Exa_Exams *Exams) + { + struct Tst_Test Test; + + /***** Create test *****/ + Tst_TstConstructor (&Test); + + /***** Show form to select test for exam *****/ + Tst_ShowFormRequestSelectTestsForExam (Exams,&Test); // No tags selected + + /***** Destroy test *****/ + Tst_TstDestructor (&Test); + } + +/*****************************************************************************/ +/******************* Select test questions for a game ************************/ +/*****************************************************************************/ + void Tst_RequestSelectTestsForGame (struct Gam_Games *Games) { struct Tst_Test Test; @@ -1227,6 +1250,65 @@ void Tst_RequestSelectTestsForGame (struct Gam_Games *Games) Tst_TstDestructor (&Test); } +/*****************************************************************************/ +/************** Show form to select test questions for a exam ****************/ +/*****************************************************************************/ + +static void Tst_ShowFormRequestSelectTestsForExam (struct Exa_Exams *Exams, + struct Tst_Test *Test) + { + extern const char *Hlp_ASSESSMENT_Exams_questions; + extern const char *Txt_No_test_questions; + extern const char *Txt_Select_questions; + extern const char *Txt_Show_questions; + MYSQL_RES *mysql_res; + static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] = + { + [Dat_START_TIME] = Dat_HMS_DO_NOT_SET, + [Dat_END_TIME ] = Dat_HMS_DO_NOT_SET + }; + + /***** Begin box *****/ + Box_BoxBegin (NULL,Txt_Select_questions, + NULL,NULL, + Hlp_ASSESSMENT_Exams_questions,Box_NOT_CLOSABLE); + + /***** Get tags already present in the table of questions *****/ + if ((Test->Tags.Num = Tst_GetAllTagsFromCurrentCrs (&mysql_res))) + { + Frm_StartForm (ActExaLstTstQst); + Exa_PutParams (Exams); + + HTM_TABLE_BeginPadding (2); + + /***** Selection of tags *****/ + Tst_ShowFormSelTags (&Test->Tags,mysql_res,false); + + /***** Starting and ending dates in the search *****/ + Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (SetHMS); + + HTM_TABLE_End (); + + /***** Send button *****/ + Btn_PutConfirmButton (Txt_Show_questions); + Frm_EndForm (); + } + else // No test questions + { + /***** Warning message *****/ + Ale_ShowAlert (Ale_INFO,Txt_No_test_questions); + + /***** Button to create a new question *****/ + Tst_PutButtonToAddQuestion (); + } + + /***** End box *****/ + Box_BoxEnd (); + + /* Free structure that stores the query result */ + DB_FreeMySQLResult (&mysql_res); + } + /*****************************************************************************/ /************** Show form to select test questions for a game ****************/ /*****************************************************************************/ @@ -2141,10 +2223,10 @@ void Tst_ListQuestionsToEdit (void) } /*****************************************************************************/ -/**************** List several test questions for selection ******************/ +/************ List several test questions for selection for exam *************/ /*****************************************************************************/ -void Tst_ListQuestionsToSelect (struct Gam_Games *Games) +void Tst_ListQuestionsToSelectForExam (struct Exa_Exams *Exams) { struct Tst_Test Test; MYSQL_RES *mysql_res; @@ -2158,7 +2240,38 @@ void Tst_ListQuestionsToSelect (struct Gam_Games *Games) Tst_GetQuestions (&Test,&mysql_res); // Query database if (Test.NumQsts) /* Show the table with the questions */ - Tst_ListOneOrMoreQuestionsForSelection (Games,Test.NumQsts,mysql_res); + Tst_ListOneOrMoreQuestionsForSelectionForExam (Exams,Test.NumQsts,mysql_res); + + /***** Free structure that stores the query result *****/ + DB_FreeMySQLResult (&mysql_res); + } + else + /* Show the form again */ + Tst_ShowFormRequestSelectTestsForExam (Exams,&Test); + + /***** Destroy test *****/ + Tst_TstDestructor (&Test); + } + +/*****************************************************************************/ +/************ List several test questions for selection for game *************/ +/*****************************************************************************/ + +void Tst_ListQuestionsToSelectForGame (struct Gam_Games *Games) + { + struct Tst_Test Test; + MYSQL_RES *mysql_res; + + /***** Create test *****/ + Tst_TstConstructor (&Test); + + /***** Get parameters, query the database and list the questions *****/ + if (Tst_GetParamsTst (&Test,Tst_SELECT_QUESTIONS_FOR_GAME)) // Get parameters from the form + { + Tst_GetQuestions (&Test,&mysql_res); // Query database + if (Test.NumQsts) + /* Show the table with the questions */ + Tst_ListOneOrMoreQuestionsForSelectionForGame (Games,Test.NumQsts,mysql_res); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -2335,7 +2448,7 @@ static void Tst_GetQuestions (struct Tst_Test *Test,MYSQL_RES **mysql_res) /*****************************************************************************/ static void Tst_GetQuestionsForNewTestFromDB (struct Tst_Test *Test, - struct TstExa_Exam *Exam) + struct TstRes_Result *Result) { MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -2448,14 +2561,14 @@ static void Tst_GetQuestionsForNewTestFromDB (struct Tst_Test *Test, Lay_ShowAlert (Lay_INFO,Query); */ /* Make the query */ - Exam->NumQsts = + Result->NumQsts = Test->NumQsts = (unsigned) DB_QuerySELECT (&mysql_res,"can not get questions", "%s", Query); /***** Get questions and answers from database *****/ for (NumQst = 0; - NumQst < Exam->NumQsts; + NumQst < Result->NumQsts; NumQst++) { /* Get question row */ @@ -2467,7 +2580,7 @@ static void Tst_GetQuestionsForNewTestFromDB (struct Tst_Test *Test, */ /* Get question code (row[0]) */ - if ((Exam->Questions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0) + if ((Result->Questions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0) Lay_ShowErrorAndExit ("Wrong code of question."); /* Get answer type (row[1]) */ @@ -2483,13 +2596,13 @@ static void Tst_GetQuestionsForNewTestFromDB (struct Tst_Test *Test, case Tst_ANS_FLOAT: case Tst_ANS_TRUE_FALSE: case Tst_ANS_TEXT: - Exam->Questions[NumQst].StrIndexes[0] = '\0'; + Result->Questions[NumQst].StrIndexes[0] = '\0'; break; case Tst_ANS_UNIQUE_CHOICE: case Tst_ANS_MULTIPLE_CHOICE: /* If answer type is unique or multiple option, generate indexes of answers depending on shuffle */ - Tst_GenerateChoiceIndexesDependingOnShuffle (Exam,NumQst,Shuffle); + Tst_GenerateChoiceIndexesDependingOnShuffle (Result,NumQst,Shuffle); break; default: break; @@ -2499,18 +2612,18 @@ static void Tst_GetQuestionsForNewTestFromDB (struct Tst_Test *Test, Initially user has not answered the question ==> initially all the answers will be blank. If the user does not confirm the submission of their exam ==> ==> the exam may be half filled ==> the answers displayed will be those selected by the user. */ - Exam->Questions[NumQst].StrAnswers[0] = '\0'; + Result->Questions[NumQst].StrAnswers[0] = '\0'; } /***** Get if test exam will be visible by teachers *****/ - Exam->AllowTeachers = Par_GetParToBool ("AllowTchs"); + Result->AllowTeachers = Par_GetParToBool ("AllowTchs"); } /*****************************************************************************/ /********* Get single or multiple choice answer when seeing a test ***********/ /*****************************************************************************/ -static void Tst_GenerateChoiceIndexesDependingOnShuffle (struct TstExa_Exam *Exam, +static void Tst_GenerateChoiceIndexesDependingOnShuffle (struct TstRes_Result *Result, unsigned NumQst, bool Shuffle) { @@ -2525,7 +2638,7 @@ static void Tst_GenerateChoiceIndexesDependingOnShuffle (struct TstExa_Exam *Exa /***** Create test question *****/ Tst_QstConstructor (&Question); - Question.QstCod = Exam->Questions[NumQst].QstCod; + Question.QstCod = Result->Questions[NumQst].QstCod; /***** Get answers of question from database *****/ Tst_GetAnswersQst (&Question,&mysql_res,Shuffle); @@ -2562,8 +2675,8 @@ static void Tst_GenerateChoiceIndexesDependingOnShuffle (struct TstExa_Exam *Exa snprintf (StrInd,sizeof (StrInd),"%u",Index); else snprintf (StrInd,sizeof (StrInd),"%s%u",Par_SEPARATOR_PARAM_MULTIPLE,Index); - Str_Concat (Exam->Questions[NumQst].StrIndexes,StrInd, - TstExa_MAX_BYTES_INDEXES_ONE_QST); + Str_Concat (Result->Questions[NumQst].StrIndexes,StrInd, + TstRes_MAX_BYTES_INDEXES_ONE_QST); } /***** Free structure that stores the query result *****/ @@ -2851,13 +2964,96 @@ static void Tst_WriteQuestionListing (struct Tst_Test *Test,unsigned NumQst) } } + /*****************************************************************************/ /*************** List for selection one or more test questions ***************/ /*****************************************************************************/ -static void Tst_ListOneOrMoreQuestionsForSelection (struct Gam_Games *Games, - unsigned NumQsts, - MYSQL_RES *mysql_res) +static void Tst_ListOneOrMoreQuestionsForSelectionForExam (struct Exa_Exams *Exams, + unsigned NumQsts, + MYSQL_RES *mysql_res) + { + extern const char *Hlp_ASSESSMENT_Exams_questions; + extern const char *Txt_Questions; + extern const char *Txt_No_INDEX; + extern const char *Txt_Code; + extern const char *Txt_Date; + extern const char *Txt_Tags; + extern const char *Txt_Type; + extern const char *Txt_Shuffle; + extern const char *Txt_Question; + extern const char *Txt_Add_questions; + unsigned NumQst; + struct Tst_Question Question; + MYSQL_ROW row; + + /***** Begin box *****/ + Box_BoxBegin (NULL,Txt_Questions, + NULL,NULL, + Hlp_ASSESSMENT_Exams_questions,Box_NOT_CLOSABLE); + + /***** Begin form *****/ + Frm_StartForm (ActAddTstQstToExa); + Exa_PutParams (Exams); + + /***** Write the heading *****/ + HTM_TABLE_BeginWideMarginPadding (2); + HTM_TR_Begin (NULL); + + HTM_TH_Empty (1); + + HTM_TH (1,1,"CT",Txt_No_INDEX); + HTM_TH (1,1,"CT",Txt_Code); + HTM_TH (1,1,"CT",Txt_Date); + HTM_TH (1,1,"LT",Txt_Tags); + HTM_TH (1,1,"CT",Txt_Type); + HTM_TH (1,1,"CT",Txt_Shuffle); + HTM_TH (1,1,"CT",Txt_Question); + + HTM_TR_End (); + + /***** Write rows *****/ + for (NumQst = 0; + NumQst < NumQsts; + NumQst++) + { + Gbl.RowEvenOdd = NumQst % 2; + + /* Create test question */ + Tst_QstConstructor (&Question); + + /* Get question code (row[0]) */ + row = mysql_fetch_row (mysql_res); + if ((Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0) + Lay_ShowErrorAndExit ("Wrong code of question."); + + /* Write question row */ + Tst_WriteQuestionRowForSelection (NumQst,&Question); + + /* Destroy test question */ + Tst_QstDestructor (&Question); + } + + /***** End table *****/ + HTM_TABLE_End (); + + /***** Button to add questions *****/ + Btn_PutConfirmButton (Txt_Add_questions); + + /***** End form *****/ + Frm_EndForm (); + + /***** End box *****/ + Box_BoxEnd (); + } + +/*****************************************************************************/ +/*************** List for selection one or more test questions ***************/ +/*****************************************************************************/ + +static void Tst_ListOneOrMoreQuestionsForSelectionForGame (struct Gam_Games *Games, + unsigned NumQsts, + MYSQL_RES *mysql_res) { extern const char *Hlp_ASSESSMENT_Games_questions; extern const char *Txt_Questions; @@ -3100,7 +3296,7 @@ void Tst_WriteAnswersListing (const struct Tst_Question *Question) /************** Write answers of a question when seeing a test ***************/ /*****************************************************************************/ -static void Tst_WriteAnswersSeeing (const struct TstExa_Exam *Exam, +static void Tst_WriteAnswersSeeing (const struct TstRes_Result *Result, unsigned NumQst, const struct Tst_Question *Question) { @@ -3108,20 +3304,20 @@ static void Tst_WriteAnswersSeeing (const struct TstExa_Exam *Exam, switch (Question->Answer.Type) { case Tst_ANS_INT: - Tst_WriteIntAnsSeeing (Exam,NumQst); + Tst_WriteIntAnsSeeing (Result,NumQst); break; case Tst_ANS_FLOAT: - Tst_WriteFloatAnsSeeing (Exam,NumQst); + Tst_WriteFloatAnsSeeing (Result,NumQst); break; case Tst_ANS_TRUE_FALSE: - Tst_WriteTFAnsSeeing (Exam,NumQst); + Tst_WriteTFAnsSeeing (Result,NumQst); break; case Tst_ANS_UNIQUE_CHOICE: case Tst_ANS_MULTIPLE_CHOICE: - Tst_WriteChoiceAnsSeeing (Exam,NumQst,Question); + Tst_WriteChoiceAnsSeeing (Result,NumQst,Question); break; case Tst_ANS_TEXT: - Tst_WriteTextAnsSeeing (Exam,NumQst); + Tst_WriteTextAnsSeeing (Result,NumQst); break; default: break; @@ -3157,7 +3353,7 @@ static void Tst_WriteIntAnsListing (const struct Tst_Question *Question) /****************** Write integer answer when seeing a test ******************/ /*****************************************************************************/ -static void Tst_WriteIntAnsSeeing (const struct TstExa_Exam *Exam, +static void Tst_WriteIntAnsSeeing (const struct TstRes_Result *Exam, unsigned NumQst) { char StrAns[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x" @@ -3189,7 +3385,7 @@ static void Tst_WriteFloatAnsEdit (const struct Tst_Question *Question) /****************** Write float answer when seeing a test ********************/ /*****************************************************************************/ -static void Tst_WriteFloatAnsSeeing (const struct TstExa_Exam *Exam, +static void Tst_WriteFloatAnsSeeing (const struct TstRes_Result *Exam, unsigned NumQst) { char StrAns[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x" @@ -3220,7 +3416,7 @@ static void Tst_WriteTFAnsListing (const struct Tst_Question *Question) /************** Write false / true answer when seeing a test ****************/ /*****************************************************************************/ -static void Tst_WriteTFAnsSeeing (const struct TstExa_Exam *Exam, +static void Tst_WriteTFAnsSeeing (const struct TstRes_Result *Exam, unsigned NumQst) { extern const char *Txt_TF_QST[2]; @@ -3353,7 +3549,7 @@ static void Tst_WriteChoiceAnsListing (const struct Tst_Question *Question) /******** Write single or multiple choice answer when seeing a test **********/ /*****************************************************************************/ -static void Tst_WriteChoiceAnsSeeing (const struct TstExa_Exam *Exam, +static void Tst_WriteChoiceAnsSeeing (const struct TstRes_Result *Exam, unsigned NumQst, const struct Tst_Question *Question) { @@ -3363,10 +3559,10 @@ static void Tst_WriteChoiceAnsSeeing (const struct TstExa_Exam *Exam, char StrAns[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x" /***** Get indexes for this question from string *****/ - TstExa_GetIndexesFromStr (Exam->Questions[NumQst].StrIndexes,Indexes); + TstRes_GetIndexesFromStr (Exam->Questions[NumQst].StrIndexes,Indexes); /***** Get the user's answers for this question from string *****/ - TstExa_GetAnswersFromStr (Exam->Questions[NumQst].StrAnswers,UsrAnswers); + TstRes_GetAnswersFromStr (Exam->Questions[NumQst].StrAnswers,UsrAnswers); /***** Begin table *****/ HTM_TABLE_BeginPadding (2); @@ -3494,7 +3690,7 @@ void Tst_GetChoiceAns (struct Tst_Question *Question,MYSQL_RES *mysql_res) /******************** Write text answer when seeing a test *******************/ /*****************************************************************************/ -static void Tst_WriteTextAnsSeeing (const struct TstExa_Exam *Exam, +static void Tst_WriteTextAnsSeeing (const struct TstRes_Result *Result, unsigned NumQst) { char StrAns[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x" @@ -3503,7 +3699,7 @@ static void Tst_WriteTextAnsSeeing (const struct TstExa_Exam *Exam, snprintf (StrAns,sizeof (StrAns), "Ans%010u", NumQst); - HTM_INPUT_TEXT (StrAns,TstExa_MAX_CHARS_ANSWERS_ONE_QST,Exam->Questions[NumQst].StrAnswers,false, + HTM_INPUT_TEXT (StrAns,TstRes_MAX_CHARS_ANSWERS_ONE_QST,Result->Questions[NumQst].StrAnswers,false, "size=\"40\""); } @@ -4761,7 +4957,7 @@ static void Tst_GetQstFromForm (struct Tst_Question *Question) char TagStr[6 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; char AnsStr[6 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; char FbStr[5 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; - char StrMultiAns[TstExa_MAX_BYTES_ANSWERS_ONE_QST + 1]; + char StrMultiAns[TstRes_MAX_BYTES_ANSWERS_ONE_QST + 1]; char TF[1 + 1]; // (T)rue or (F)alse const char *Ptr; unsigned NumCorrectAns; @@ -4913,7 +5109,7 @@ static void Tst_GetQstFromForm (struct Tst_Question *Question) } else if (Question->Answer.Type == Tst_ANS_MULTIPLE_CHOICE) { - Par_GetParMultiToText ("AnsMulti",StrMultiAns,TstExa_MAX_BYTES_ANSWERS_ONE_QST); + Par_GetParMultiToText ("AnsMulti",StrMultiAns,TstRes_MAX_BYTES_ANSWERS_ONE_QST); Ptr = StrMultiAns; while (*Ptr) { diff --git a/swad_test.h b/swad_test.h index 0daa0cc4..20f773e6 100644 --- a/swad_test.h +++ b/swad_test.h @@ -27,10 +27,10 @@ /********************************* Headers ***********************************/ /*****************************************************************************/ +#include "swad_exam.h" #include "swad_game.h" #include "swad_media.h" #include "swad_test_config.h" -// #include "swad_test_exam.h" /*****************************************************************************/ /***************************** Public constants ******************************/ @@ -166,10 +166,12 @@ void Tst_WriteQstStem (const char *Stem,const char *ClassStem,bool Visible); void Tst_WriteQstFeedback (const char *Feedback,const char *ClassFeedback); void Tst_RequestEditTests (void); +void Tst_RequestSelectTestsForExam (struct Exa_Exams *Exams); void Tst_RequestSelectTestsForGame (struct Gam_Games *Games); void Tst_ListQuestionsToEdit (void); -void Tst_ListQuestionsToSelect (struct Gam_Games *Games); +void Tst_ListQuestionsToSelectForExam (struct Exa_Exams *Exams); +void Tst_ListQuestionsToSelectForGame (struct Gam_Games *Games); void Tst_WriteParamEditQst (const struct Tst_Test *Test); unsigned Tst_GetNumAnswersQst (long QstCod); diff --git a/swad_test_exam.c b/swad_test_exam.c index a4158c5c..9abd99f3 100644 --- a/swad_test_exam.c +++ b/swad_test_exam.c @@ -70,117 +70,117 @@ extern struct Globals Gbl; /***************************** Private prototypes ****************************/ /*****************************************************************************/ -static void TstExa_ResetExamExceptExaCod (struct TstExa_Exam *Exam); +static void TstRes_ResetExamExceptExaCod (struct TstRes_Result *Result); -static void TstExa_WriteQstAndAnsExam (struct UsrData *UsrDat, - struct TstExa_Exam *Exam, +static void TstRes_WriteQstAndAnsExam (struct UsrData *UsrDat, + struct TstRes_Result *Result, unsigned NumQst, struct Tst_Question *Question, unsigned Visibility); -static void TstExa_ComputeAnswerScore (struct TstExa_Exam *Exam, +static void TstRes_ComputeAnswerScore (struct TstRes_Result *Result, unsigned NumQst, struct Tst_Question *Question); -static void TstExa_ComputeIntAnsScore (struct TstExa_Exam *Exam, +static void TstRes_ComputeIntAnsScore (struct TstRes_Result *Result, unsigned NumQst, struct Tst_Question *Question); -static void TstExa_GetCorrectIntAnswerFromDB (struct Tst_Question *Question); -static void TstExa_ComputeFloatAnsScore (struct TstExa_Exam *Exam, +static void TstRes_GetCorrectIntAnswerFromDB (struct Tst_Question *Question); +static void TstRes_ComputeFloatAnsScore (struct TstRes_Result *Result, unsigned NumQst, struct Tst_Question *Question); -static void TstExa_GetCorrectFloatAnswerFromDB (struct Tst_Question *Question); -static void TstExa_ComputeTFAnsScore (struct TstExa_Exam *Exam, +static void TstRes_GetCorrectFloatAnswerFromDB (struct Tst_Question *Question); +static void TstRes_ComputeTFAnsScore (struct TstRes_Result *Result, unsigned NumQst, struct Tst_Question *Question); -static void TstExa_GetCorrectTFAnswerFromDB (struct Tst_Question *Question); -static void TstExa_GetCorrectChoiceAnswerFromDB (struct Tst_Question *Question); +static void TstRes_GetCorrectTFAnswerFromDB (struct Tst_Question *Question); +static void TstRes_GetCorrectChoiceAnswerFromDB (struct Tst_Question *Question); -static void TstExa_ComputeScoreQst (struct TstExa_Exam *Exam, +static void TstRes_ComputeScoreQst (struct TstRes_Result *Result, unsigned NumQst, const struct Tst_Question *Question, unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION], // Indexes of all answers of this question bool UsrAnswers[Tst_MAX_OPTIONS_PER_QUESTION]); -static void TstExa_ComputeTextAnsScore (struct TstExa_Exam *Exam, +static void TstRes_ComputeTextAnsScore (struct TstRes_Result *Result, unsigned NumQst, struct Tst_Question *Question); -static void TstExa_GetCorrectTextAnswerFromDB (struct Tst_Question *Question); +static void TstRes_GetCorrectTextAnswerFromDB (struct Tst_Question *Question); -static void TstExa_WriteAnswersExam (struct UsrData *UsrDat, - const struct TstExa_Exam *Exam, +static void TstRes_WriteAnswersExam (struct UsrData *UsrDat, + const struct TstRes_Result *Result, unsigned NumQst, struct Tst_Question *Question, unsigned Visibility); -static void TstExa_WriteIntAnsExam (struct UsrData *UsrDat, - const struct TstExa_Exam *Exam, +static void TstRes_WriteIntAnsExam (struct UsrData *UsrDat, + const struct TstRes_Result *Result, unsigned NumQst, const struct Tst_Question *Question, unsigned Visibility); -static void TstExa_WriteFloatAnsExam (struct UsrData *UsrDat, - const struct TstExa_Exam *Exam, +static void TstRes_WriteFloatAnsExam (struct UsrData *UsrDat, + const struct TstRes_Result *Result, unsigned NumQst, const struct Tst_Question *Question, unsigned Visibility); -static void TstExa_WriteTFAnsExam (struct UsrData *UsrDat, - const struct TstExa_Exam *Exam, +static void TstRes_WriteTFAnsExam (struct UsrData *UsrDat, + const struct TstRes_Result *Result, unsigned NumQst, const struct Tst_Question *Question, unsigned Visibility); -static void TstExa_WriteChoiceAnsExam (struct UsrData *UsrDat, - const struct TstExa_Exam *Exam, +static void TstRes_WriteChoiceAnsExam (struct UsrData *UsrDat, + const struct TstRes_Result *Result, unsigned NumQst, struct Tst_Question *Question, unsigned Visibility); -static void TstExa_WriteTextAnsExam (struct UsrData *UsrDat, - const struct TstExa_Exam *Exam, +static void TstRes_WriteTextAnsExam (struct UsrData *UsrDat, + const struct TstRes_Result *Result, unsigned NumQst, struct Tst_Question *Question, unsigned Visibility); -static void TstExa_WriteHeadUserCorrect (struct UsrData *UsrDat); +static void TstRes_WriteHeadUserCorrect (struct UsrData *UsrDat); -static void TstExa_StoreOneExamQstInDB (const struct TstExa_Exam *Exam, +static void TstRes_StoreOneExamQstInDB (const struct TstRes_Result *Result, unsigned NumQst); -static void Tst_UpdateQstScoreInDB (const struct TstExa_Exam *Exam,unsigned NumQst); +static void Tst_UpdateQstScoreInDB (const struct TstRes_Result *Result,unsigned NumQst); -static void TstExa_PutFormToSelectUsrsToViewUsrsExams (__attribute__((unused)) void *Args); +static void TstRes_PutFormToSelectUsrsToViewUsrsExams (__attribute__((unused)) void *Args); -static void TstExa_ShowUsrsExams (__attribute__((unused)) void *Args); -static void TstExa_ShowHeaderExams (void); -static void TstExa_ShowExams (struct UsrData *UsrDat); -static void TstExa_ShowExamsSummaryRow (bool ItsMe, +static void TstRes_ShowUsrsExams (__attribute__((unused)) void *Args); +static void TstRes_ShowHeaderExams (void); +static void TstRes_ShowExams (struct UsrData *UsrDat); +static void TstRes_ShowExamsSummaryRow (bool ItsMe, unsigned NumExams, unsigned NumTotalQsts, unsigned NumTotalQstsNotBlank, double TotalScoreOfAllTests); -static void TstExa_ShowTagsPresentInAnExam (long ExaCod); +static void TstRes_ShowTagsPresentInAnExam (long ResCod); /*****************************************************************************/ /******************************** Reset exam *********************************/ /*****************************************************************************/ -void TstExa_ResetExam (struct TstExa_Exam *Exam) +void TstRes_ResetResult (struct TstRes_Result *Result) { - Exam->ExaCod = -1L; - TstExa_ResetExamExceptExaCod (Exam); + Result->ResCod = -1L; + TstRes_ResetExamExceptExaCod (Result); } -static void TstExa_ResetExamExceptExaCod (struct TstExa_Exam *Exam) +static void TstRes_ResetExamExceptExaCod (struct TstRes_Result *Result) { - Exam->TimeUTC[Dat_START_TIME] = - Exam->TimeUTC[Dat_END_TIME ] = (time_t) 0; - Exam->NumQsts = - Exam->NumQstsNotBlank = 0; - Exam->Sent = false; // After creating an exam, it's not sent - Exam->AllowTeachers = false; // Teachers can't seen the exam if student don't allow it - Exam->Score = 0.0; + Result->TimeUTC[Dat_START_TIME] = + Result->TimeUTC[Dat_END_TIME ] = (time_t) 0; + Result->NumQsts = + Result->NumQstsNotBlank = 0; + Result->Sent = false; // After creating an exam, it's not sent + Result->AllowTeachers = false; // Teachers can't seen the exam if student don't allow it + Result->Score = 0.0; } /*****************************************************************************/ /***************** Create new blank test exam in database ********************/ /*****************************************************************************/ -void TstExa_CreateExamInDB (struct TstExa_Exam *Exam) +void TstRes_CreateExamInDB (struct TstRes_Result *Exam) { /***** Insert new test exam into table *****/ - Exam->ExaCod = + Exam->ResCod = DB_QueryINSERTandReturnCode ("can not create new test exam", "INSERT INTO tst_exams" " (CrsCod,UsrCod,StartTime,EndTime,NumQsts," @@ -197,7 +197,7 @@ void TstExa_CreateExamInDB (struct TstExa_Exam *Exam) /********************** Update test exam in database *************************/ /*****************************************************************************/ -void TstExa_UpdateExamInDB (const struct TstExa_Exam *Exam) +void TstRes_UpdateExamInDB (const struct TstRes_Result *Exam) { /***** Update score in test exam *****/ Str_SetDecimalPointToUS (); // To print the floating point as a dot @@ -216,7 +216,7 @@ void TstExa_UpdateExamInDB (const struct TstExa_Exam *Exam) Exam->AllowTeachers ? 'Y' : 'N', Exam->Score, - Exam->ExaCod, + Exam->ResCod, Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod); Str_SetDecimalPointToLocal (); // Return to local system @@ -226,7 +226,7 @@ void TstExa_UpdateExamInDB (const struct TstExa_Exam *Exam) /********************* Show test exam after assessing it *********************/ /*****************************************************************************/ -void TstExa_ShowExamAfterAssess (struct TstExa_Exam *Exam) +void TstRes_ShowExamAfterAssess (struct TstRes_Result *Result) { unsigned NumQst; struct Tst_Question Question; @@ -235,39 +235,39 @@ void TstExa_ShowExamAfterAssess (struct TstExa_Exam *Exam) HTM_TABLE_BeginWideMarginPadding (10); /***** Initialize score and number of questions not blank *****/ - Exam->NumQstsNotBlank = 0; - Exam->Score = 0.0; + Result->NumQstsNotBlank = 0; + Result->Score = 0.0; for (NumQst = 0; - NumQst < Exam->NumQsts; + NumQst < Result->NumQsts; NumQst++) { Gbl.RowEvenOdd = NumQst % 2; /***** Create test question *****/ Tst_QstConstructor (&Question); - Question.QstCod = Exam->Questions[NumQst].QstCod; + Question.QstCod = Result->Questions[NumQst].QstCod; /***** Get question data *****/ if (Tst_GetQstDataFromDB (&Question)) // Question exists { /***** Write question and answers *****/ - TstExa_WriteQstAndAnsExam (&Gbl.Usrs.Me.UsrDat, - Exam,NumQst, + TstRes_WriteQstAndAnsExam (&Gbl.Usrs.Me.UsrDat, + Result,NumQst, &Question, TstCfg_GetConfigVisibility ()); /***** Store test exam question in database *****/ - TstExa_StoreOneExamQstInDB (Exam,NumQst); + TstRes_StoreOneExamQstInDB (Result,NumQst); /***** Compute total score *****/ - Exam->Score += Exam->Questions[NumQst].Score; - if (Exam->Questions[NumQst].AnswerIsNotBlank) - Exam->NumQstsNotBlank++; + Result->Score += Result->Questions[NumQst].Score; + if (Result->Questions[NumQst].AnswerIsNotBlank) + Result->NumQstsNotBlank++; /***** Update the number of accesses and the score of this question *****/ if (Gbl.Usrs.Me.Role.Logged == Rol_STD) - Tst_UpdateQstScoreInDB (Exam,NumQst); + Tst_UpdateQstScoreInDB (Result,NumQst); } /***** Destroy test question *****/ @@ -282,8 +282,8 @@ void TstExa_ShowExamAfterAssess (struct TstExa_Exam *Exam) /********** Write a row of a test, with one question and its answer **********/ /*****************************************************************************/ -static void TstExa_WriteQstAndAnsExam (struct UsrData *UsrDat, - struct TstExa_Exam *Exam, +static void TstRes_WriteQstAndAnsExam (struct UsrData *UsrDat, + struct TstRes_Result *Result, unsigned NumQst, struct Tst_Question *Question, unsigned Visibility) @@ -301,7 +301,7 @@ static void TstExa_WriteQstAndAnsExam (struct UsrData *UsrDat, /***** If this question has been edited later than test time ==> don't show question ****/ if (QuestionExists) - QuestionUneditedAfterExam = (Question->EditTime < Exam->TimeUTC[Dat_START_TIME]); + QuestionUneditedAfterExam = (Question->EditTime < Result->TimeUTC[Dat_START_TIME]); else QuestionUneditedAfterExam = false; @@ -331,8 +331,8 @@ static void TstExa_WriteQstAndAnsExam (struct UsrData *UsrDat, "TEST_MED_SHOW"); /* Answers */ - TstExa_ComputeAnswerScore (Exam,NumQst,Question); - TstExa_WriteAnswersExam (UsrDat,Exam,NumQst,Question,Visibility); + TstRes_ComputeAnswerScore (Result,NumQst,Question); + TstRes_WriteAnswersExam (UsrDat,Result,NumQst,Question,Visibility); } else Ale_ShowAlert (Ale_WARNING,Txt_Question_modified); @@ -346,11 +346,11 @@ static void TstExa_WriteQstAndAnsExam (struct UsrData *UsrDat, HTM_DIV_Begin ("class=\"DAT_SMALL LM\""); HTM_TxtColonNBSP (Txt_Score); HTM_SPAN_Begin ("class=\"%s\"", - Exam->Questions[NumQst].StrAnswers[0] ? - (Exam->Questions[NumQst].Score > 0 ? "ANS_OK" : // Correct/semicorrect + Result->Questions[NumQst].StrAnswers[0] ? + (Result->Questions[NumQst].Score > 0 ? "ANS_OK" : // Correct/semicorrect "ANS_BAD") : // Wrong "ANS_0"); // Blank answer - HTM_Double2Decimals (Exam->Questions[NumQst].Score); + HTM_Double2Decimals (Result->Questions[NumQst].Score); HTM_SPAN_End (); HTM_DIV_End (); } @@ -370,7 +370,7 @@ static void TstExa_WriteQstAndAnsExam (struct UsrData *UsrDat, /*********** Compute score of each question and store in database ************/ /*****************************************************************************/ -void TstExa_ComputeScoresAndStoreExamQuestions (struct TstExa_Exam *Exam, +void TstRes_ComputeScoresAndStoreExamQuestions (struct TstRes_Result *Exam, bool UpdateQstScore) { unsigned NumQst; @@ -389,11 +389,11 @@ void TstExa_ComputeScoresAndStoreExamQuestions (struct TstExa_Exam *Exam, Tst_QstConstructor (&Question); Question.QstCod = Exam->Questions[NumQst].QstCod; Question.Answer.Type = Tst_GetQstAnswerType (Question.QstCod); - TstExa_ComputeAnswerScore (Exam,NumQst,&Question); + TstRes_ComputeAnswerScore (Exam,NumQst,&Question); Tst_QstDestructor (&Question); /* Store test exam question in database */ - TstExa_StoreOneExamQstInDB (Exam, + TstRes_StoreOneExamQstInDB (Exam, NumQst); // 0, 1, 2, 3... /* Accumulate total score */ @@ -411,7 +411,7 @@ void TstExa_ComputeScoresAndStoreExamQuestions (struct TstExa_Exam *Exam, /************* Write answers of a question when assessing a test *************/ /*****************************************************************************/ -static void TstExa_ComputeAnswerScore (struct TstExa_Exam *Exam, +static void TstRes_ComputeAnswerScore (struct TstRes_Result *Result, unsigned NumQst, struct Tst_Question *Question) { @@ -419,20 +419,20 @@ static void TstExa_ComputeAnswerScore (struct TstExa_Exam *Exam, switch (Question->Answer.Type) { case Tst_ANS_INT: - TstExa_ComputeIntAnsScore (Exam,NumQst,Question); + TstRes_ComputeIntAnsScore (Result,NumQst,Question); break; case Tst_ANS_FLOAT: - TstExa_ComputeFloatAnsScore (Exam,NumQst,Question); + TstRes_ComputeFloatAnsScore (Result,NumQst,Question); break; case Tst_ANS_TRUE_FALSE: - TstExa_ComputeTFAnsScore (Exam,NumQst,Question); + TstRes_ComputeTFAnsScore (Result,NumQst,Question); break; case Tst_ANS_UNIQUE_CHOICE: case Tst_ANS_MULTIPLE_CHOICE: - TstExa_ComputeChoiceAnsScore (Exam,NumQst,Question); + TstRes_ComputeChoiceAnsScore (Result,NumQst,Question); break; case Tst_ANS_TEXT: - TstExa_ComputeTextAnsScore (Exam,NumQst,Question); + TstRes_ComputeTextAnsScore (Result,NumQst,Question); break; default: break; @@ -443,25 +443,25 @@ static void TstExa_ComputeAnswerScore (struct TstExa_Exam *Exam, /**************** Write integer answer when assessing a test *****************/ /*****************************************************************************/ -static void TstExa_ComputeIntAnsScore (struct TstExa_Exam *Exam, +static void TstRes_ComputeIntAnsScore (struct TstRes_Result *Result, unsigned NumQst, struct Tst_Question *Question) { long AnswerUsr; /***** Get the numerical value of the correct answer *****/ - TstExa_GetCorrectIntAnswerFromDB (Question); + TstRes_GetCorrectIntAnswerFromDB (Question); /***** Compute score *****/ - Exam->Questions[NumQst].Score = 0.0; // Default score for blank or wrong answer - Exam->Questions[NumQst].AnswerIsNotBlank = (Exam->Questions[NumQst].StrAnswers[0] != '\0'); - if (Exam->Questions[NumQst].AnswerIsNotBlank) // If user has answered the answer - if (sscanf (Exam->Questions[NumQst].StrAnswers,"%ld",&AnswerUsr) == 1) + Result->Questions[NumQst].Score = 0.0; // Default score for blank or wrong answer + Result->Questions[NumQst].AnswerIsNotBlank = (Result->Questions[NumQst].StrAnswers[0] != '\0'); + if (Result->Questions[NumQst].AnswerIsNotBlank) // If user has answered the answer + if (sscanf (Result->Questions[NumQst].StrAnswers,"%ld",&AnswerUsr) == 1) if (AnswerUsr == Question->Answer.Integer) // Correct answer - Exam->Questions[NumQst].Score = 1.0; + Result->Questions[NumQst].Score = 1.0; } -static void TstExa_GetCorrectIntAnswerFromDB (struct Tst_Question *Question) +static void TstRes_GetCorrectIntAnswerFromDB (struct Tst_Question *Question) { MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -490,29 +490,29 @@ static void TstExa_GetCorrectIntAnswerFromDB (struct Tst_Question *Question) /***************** Write float answer when assessing a test ******************/ /*****************************************************************************/ -static void TstExa_ComputeFloatAnsScore (struct TstExa_Exam *Exam, +static void TstRes_ComputeFloatAnsScore (struct TstRes_Result *Result, unsigned NumQst, struct Tst_Question *Question) { double AnswerUsr; /***** Get the numerical value of the minimum and maximum correct answers *****/ - TstExa_GetCorrectFloatAnswerFromDB (Question); + TstRes_GetCorrectFloatAnswerFromDB (Question); /***** Compute score *****/ - Exam->Questions[NumQst].Score = 0.0; // Default score for blank or wrong answer - Exam->Questions[NumQst].AnswerIsNotBlank = (Exam->Questions[NumQst].StrAnswers[0] != '\0'); - if (Exam->Questions[NumQst].AnswerIsNotBlank) // If user has answered the answer + Result->Questions[NumQst].Score = 0.0; // Default score for blank or wrong answer + Result->Questions[NumQst].AnswerIsNotBlank = (Result->Questions[NumQst].StrAnswers[0] != '\0'); + if (Result->Questions[NumQst].AnswerIsNotBlank) // If user has answered the answer { - AnswerUsr = Str_GetDoubleFromStr (Exam->Questions[NumQst].StrAnswers); + AnswerUsr = Str_GetDoubleFromStr (Result->Questions[NumQst].StrAnswers); // A bad formatted floating point answer will interpreted as 0.0 - Exam->Questions[NumQst].Score = (AnswerUsr >= Question->Answer.FloatingPoint[0] && - AnswerUsr <= Question->Answer.FloatingPoint[1]) ? 1.0 : // If correct (inside the interval) - 0.0; // If wrong (outside the interval) + Result->Questions[NumQst].Score = (AnswerUsr >= Question->Answer.FloatingPoint[0] && + AnswerUsr <= Question->Answer.FloatingPoint[1]) ? 1.0 : // If correct (inside the interval) + 0.0; // If wrong (outside the interval) } } -static void TstExa_GetCorrectFloatAnswerFromDB (struct Tst_Question *Question) +static void TstRes_GetCorrectFloatAnswerFromDB (struct Tst_Question *Question) { MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -556,23 +556,23 @@ static void TstExa_GetCorrectFloatAnswerFromDB (struct Tst_Question *Question) /************** Write false / true answer when assessing a test **************/ /*****************************************************************************/ -static void TstExa_ComputeTFAnsScore (struct TstExa_Exam *Exam, +static void TstRes_ComputeTFAnsScore (struct TstRes_Result *Result, unsigned NumQst, struct Tst_Question *Question) { /***** Get answer true or false *****/ - TstExa_GetCorrectTFAnswerFromDB (Question); + TstRes_GetCorrectTFAnswerFromDB (Question); /***** Compute score *****/ - Exam->Questions[NumQst].AnswerIsNotBlank = (Exam->Questions[NumQst].StrAnswers[0] != '\0'); - if (Exam->Questions[NumQst].AnswerIsNotBlank) // User has selected T or F - Exam->Questions[NumQst].Score = (Exam->Questions[NumQst].StrAnswers[0] == Question->Answer.TF) ? 1.0 : // Correct - -1.0; // Wrong + Result->Questions[NumQst].AnswerIsNotBlank = (Result->Questions[NumQst].StrAnswers[0] != '\0'); + if (Result->Questions[NumQst].AnswerIsNotBlank) // User has selected T or F + Result->Questions[NumQst].Score = (Result->Questions[NumQst].StrAnswers[0] == Question->Answer.TF) ? 1.0 : // Correct + -1.0; // Wrong else - Exam->Questions[NumQst].Score = 0.0; + Result->Questions[NumQst].Score = 0.0; } -static void TstExa_GetCorrectTFAnswerFromDB (struct Tst_Question *Question) +static void TstRes_GetCorrectTFAnswerFromDB (struct Tst_Question *Question) { MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -600,7 +600,7 @@ static void TstExa_GetCorrectTFAnswerFromDB (struct Tst_Question *Question) /************ Compute score for single or multiple choice answer *************/ /*****************************************************************************/ -void TstExa_ComputeChoiceAnsScore (struct TstExa_Exam *Exam, +void TstRes_ComputeChoiceAnsScore (struct TstRes_Result *Exam, unsigned NumQst, struct Tst_Question *Question) { @@ -608,19 +608,19 @@ void TstExa_ComputeChoiceAnsScore (struct TstExa_Exam *Exam, bool UsrAnswers[Tst_MAX_OPTIONS_PER_QUESTION]; /***** Get correct options of test question from database *****/ - TstExa_GetCorrectChoiceAnswerFromDB (Question); + TstRes_GetCorrectChoiceAnswerFromDB (Question); /***** Get indexes for this question from string *****/ - TstExa_GetIndexesFromStr (Exam->Questions[NumQst].StrIndexes,Indexes); + TstRes_GetIndexesFromStr (Exam->Questions[NumQst].StrIndexes,Indexes); /***** Get the user's answers for this question from string *****/ - TstExa_GetAnswersFromStr (Exam->Questions[NumQst].StrAnswers,UsrAnswers); + TstRes_GetAnswersFromStr (Exam->Questions[NumQst].StrAnswers,UsrAnswers); /***** Compute the total score of this question *****/ - TstExa_ComputeScoreQst (Exam,NumQst,Question,Indexes,UsrAnswers); + TstRes_ComputeScoreQst (Exam,NumQst,Question,Indexes,UsrAnswers); } -static void TstExa_GetCorrectChoiceAnswerFromDB (struct Tst_Question *Question) +static void TstRes_GetCorrectChoiceAnswerFromDB (struct Tst_Question *Question) { MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -653,7 +653,7 @@ static void TstExa_GetCorrectChoiceAnswerFromDB (struct Tst_Question *Question) /********************* Get vector of indexes from string *********************/ /*****************************************************************************/ -void TstExa_GetIndexesFromStr (const char StrIndexesOneQst[TstExa_MAX_BYTES_INDEXES_ONE_QST + 1], // 0 1 2 3, 3 0 2 1, etc. +void TstRes_GetIndexesFromStr (const char StrIndexesOneQst[TstRes_MAX_BYTES_INDEXES_ONE_QST + 1], // 0 1 2 3, 3 0 2 1, etc. unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION]) { unsigned NumOpt; @@ -685,7 +685,7 @@ void TstExa_GetIndexesFromStr (const char StrIndexesOneQst[TstExa_MAX_BYTES_INDE /****************** Get vector of user's answers from string *****************/ /*****************************************************************************/ -void TstExa_GetAnswersFromStr (const char StrAnswersOneQst[TstExa_MAX_BYTES_ANSWERS_ONE_QST + 1], +void TstRes_GetAnswersFromStr (const char StrAnswersOneQst[TstRes_MAX_BYTES_ANSWERS_ONE_QST + 1], bool UsrAnswers[Tst_MAX_OPTIONS_PER_QUESTION]) { unsigned NumOpt; @@ -720,7 +720,7 @@ void TstExa_GetAnswersFromStr (const char StrAnswersOneQst[TstExa_MAX_BYTES_ANSW /*********************** Compute the score of a question *********************/ /*****************************************************************************/ -static void TstExa_ComputeScoreQst (struct TstExa_Exam *Exam, +static void TstRes_ComputeScoreQst (struct TstRes_Result *Result, unsigned NumQst, const struct Tst_Question *Question, unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION], // Indexes of all answers of this question @@ -751,64 +751,64 @@ static void TstExa_ComputeScoreQst (struct TstExa_Exam *Exam, } /* The answer is blank? */ - Exam->Questions[NumQst].AnswerIsNotBlank = NumAnsGood != 0 || NumAnsBad != 0; - if (Exam->Questions[NumQst].AnswerIsNotBlank) + Result->Questions[NumQst].AnswerIsNotBlank = NumAnsGood != 0 || NumAnsBad != 0; + if (Result->Questions[NumQst].AnswerIsNotBlank) { /* Compute the score */ if (Question->Answer.Type == Tst_ANS_UNIQUE_CHOICE) { if (NumOptTotInQst >= 2) // It should be 2 options at least - Exam->Questions[NumQst].Score = (double) NumAnsGood - - (double) NumAnsBad / (double) (NumOptTotInQst - 1); - else // 0 or 1 options (impossible) - Exam->Questions[NumQst].Score = (double) NumAnsGood; + Result->Questions[NumQst].Score = (double) NumAnsGood - + (double) NumAnsBad / (double) (NumOptTotInQst - 1); + else // 0 or 1 options (impossible) + Result->Questions[NumQst].Score = (double) NumAnsGood; } else // AnswerType == Tst_ANS_MULTIPLE_CHOICE { if (NumOptCorrInQst) // There are correct options in the question { if (NumOptCorrInQst < NumOptTotInQst) // If there are correct options and wrong options (typical case) - Exam->Questions[NumQst].Score = (double) NumAnsGood / (double) NumOptCorrInQst - - (double) NumAnsBad / (double) (NumOptTotInQst - NumOptCorrInQst); - else // Si todas the opciones son correctas (caso raro) - Exam->Questions[NumQst].Score = (double) NumAnsGood / (double) NumOptCorrInQst; + Result->Questions[NumQst].Score = (double) NumAnsGood / (double) NumOptCorrInQst - + (double) NumAnsBad / (double) (NumOptTotInQst - NumOptCorrInQst); + else // If all options are correct (extrange case) + Result->Questions[NumQst].Score = (double) NumAnsGood / (double) NumOptCorrInQst; } else { if (NumOptTotInQst) // There are options but none is correct (extrange case) - Exam->Questions[NumQst].Score = - (double) NumAnsBad / (double) NumOptTotInQst; - else // There are no options (impossible!) - Exam->Questions[NumQst].Score = 0.0; + Result->Questions[NumQst].Score = - (double) NumAnsBad / (double) NumOptTotInQst; + else // There are no options (impossible!) + Result->Questions[NumQst].Score = 0.0; } } } else // Answer is blank - Exam->Questions[NumQst].Score = 0.0; + Result->Questions[NumQst].Score = 0.0; } /*****************************************************************************/ /********************* Compute score for text answer *************************/ /*****************************************************************************/ -static void TstExa_ComputeTextAnsScore (struct TstExa_Exam *Exam, +static void TstRes_ComputeTextAnsScore (struct TstRes_Result *Result, unsigned NumQst, struct Tst_Question *Question) { unsigned NumOpt; - char TextAnsUsr[TstExa_MAX_BYTES_ANSWERS_ONE_QST + 1]; - char TextAnsOK[TstExa_MAX_BYTES_ANSWERS_ONE_QST + 1]; + char TextAnsUsr[TstRes_MAX_BYTES_ANSWERS_ONE_QST + 1]; + char TextAnsOK[TstRes_MAX_BYTES_ANSWERS_ONE_QST + 1]; /***** Get correct answers for this question from database *****/ - TstExa_GetCorrectTextAnswerFromDB (Question); + TstRes_GetCorrectTextAnswerFromDB (Question); /***** Compute score *****/ - Exam->Questions[NumQst].Score = 0.0; // Default score for blank or wrong answer - Exam->Questions[NumQst].AnswerIsNotBlank = (Exam->Questions[NumQst].StrAnswers[0] != '\0'); - if (Exam->Questions[NumQst].AnswerIsNotBlank) // If user has answered the answer + Result->Questions[NumQst].Score = 0.0; // Default score for blank or wrong answer + Result->Questions[NumQst].AnswerIsNotBlank = (Result->Questions[NumQst].StrAnswers[0] != '\0'); + if (Result->Questions[NumQst].AnswerIsNotBlank) // If user has answered the answer { /* Filter the user answer */ - Str_Copy (TextAnsUsr,Exam->Questions[NumQst].StrAnswers, - TstExa_MAX_BYTES_ANSWERS_ONE_QST); + Str_Copy (TextAnsUsr,Result->Questions[NumQst].StrAnswers, + TstRes_MAX_BYTES_ANSWERS_ONE_QST); /* In order to compare student answer to stored answer, the text answers are stored avoiding two or more consecurive spaces */ @@ -821,17 +821,17 @@ static void TstExa_ComputeTextAnsScore (struct TstExa_Exam *Exam, { /* Filter this correct answer */ Str_Copy (TextAnsOK,Question->Answer.Options[NumOpt].Text, - TstExa_MAX_BYTES_ANSWERS_ONE_QST); + TstRes_MAX_BYTES_ANSWERS_ONE_QST); Str_ConvertToComparable (TextAnsOK); /* Check is user answer is correct */ if (!strcoll (TextAnsUsr,TextAnsOK)) - Exam->Questions[NumQst].Score = 1.0; // Correct answer + Result->Questions[NumQst].Score = 1.0; // Correct answer } } } -static void TstExa_GetCorrectTextAnswerFromDB (struct Tst_Question *Question) +static void TstRes_GetCorrectTextAnswerFromDB (struct Tst_Question *Question) { MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -874,16 +874,16 @@ static void TstExa_GetCorrectTextAnswerFromDB (struct Tst_Question *Question) /************ Compute and show total grade out of maximum grade **************/ /*****************************************************************************/ -void TstExa_ComputeAndShowGrade (unsigned NumQsts,double Score,double MaxGrade) +void TstRes_ComputeAndShowGrade (unsigned NumQsts,double Score,double MaxGrade) { - TstExa_ShowGrade (TstExa_ComputeGrade (NumQsts,Score,MaxGrade),MaxGrade); + TstRes_ShowGrade (TstRes_ComputeGrade (NumQsts,Score,MaxGrade),MaxGrade); } /*****************************************************************************/ /**************** Compute total grade out of maximum grade *******************/ /*****************************************************************************/ -double TstExa_ComputeGrade (unsigned NumQsts,double Score,double MaxGrade) +double TstRes_ComputeGrade (unsigned NumQsts,double Score,double MaxGrade) { double MaxScore; double Grade; @@ -904,7 +904,7 @@ double TstExa_ComputeGrade (unsigned NumQsts,double Score,double MaxGrade) /****************** Show total grade out of maximum grade ********************/ /*****************************************************************************/ -void TstExa_ShowGrade (double Grade,double MaxGrade) +void TstRes_ShowGrade (double Grade,double MaxGrade) { /***** Write grade over maximum grade *****/ HTM_Double2Decimals (Grade); @@ -916,8 +916,8 @@ void TstExa_ShowGrade (double Grade,double MaxGrade) /************* Write answers of a question when assessing a test *************/ /*****************************************************************************/ -static void TstExa_WriteAnswersExam (struct UsrData *UsrDat, - const struct TstExa_Exam *Exam, +static void TstRes_WriteAnswersExam (struct UsrData *UsrDat, + const struct TstRes_Result *Result, unsigned NumQst, struct Tst_Question *Question, unsigned Visibility) @@ -926,20 +926,20 @@ static void TstExa_WriteAnswersExam (struct UsrData *UsrDat, switch (Question->Answer.Type) { case Tst_ANS_INT: - TstExa_WriteIntAnsExam (UsrDat,Exam,NumQst,Question,Visibility); + TstRes_WriteIntAnsExam (UsrDat,Result,NumQst,Question,Visibility); break; case Tst_ANS_FLOAT: - TstExa_WriteFloatAnsExam (UsrDat,Exam,NumQst,Question,Visibility); + TstRes_WriteFloatAnsExam (UsrDat,Result,NumQst,Question,Visibility); break; case Tst_ANS_TRUE_FALSE: - TstExa_WriteTFAnsExam (UsrDat,Exam,NumQst,Question,Visibility); + TstRes_WriteTFAnsExam (UsrDat,Result,NumQst,Question,Visibility); break; case Tst_ANS_UNIQUE_CHOICE: case Tst_ANS_MULTIPLE_CHOICE: - TstExa_WriteChoiceAnsExam (UsrDat,Exam,NumQst,Question,Visibility); + TstRes_WriteChoiceAnsExam (UsrDat,Result,NumQst,Question,Visibility); break; case Tst_ANS_TEXT: - TstExa_WriteTextAnsExam (UsrDat,Exam,NumQst,Question,Visibility); + TstRes_WriteTextAnsExam (UsrDat,Result,NumQst,Question,Visibility); break; default: break; @@ -950,8 +950,8 @@ static void TstExa_WriteAnswersExam (struct UsrData *UsrDat, /******************* Write integer answer in a test exam *********************/ /*****************************************************************************/ -static void TstExa_WriteIntAnsExam (struct UsrData *UsrDat, - const struct TstExa_Exam *Exam, +static void TstRes_WriteIntAnsExam (struct UsrData *UsrDat, + const struct TstRes_Result *Result, unsigned NumQst, const struct Tst_Question *Question, unsigned Visibility) @@ -964,15 +964,15 @@ static void TstExa_WriteIntAnsExam (struct UsrData *UsrDat, /***** Header with the title of each column *****/ HTM_TABLE_BeginPadding (2); HTM_TR_Begin (NULL); - TstExa_WriteHeadUserCorrect (UsrDat); + TstRes_WriteHeadUserCorrect (UsrDat); HTM_TR_End (); HTM_TR_Begin (NULL); /***** Write the user answer *****/ - if (Exam->Questions[NumQst].StrAnswers[0]) // If user has answered the question + if (Result->Questions[NumQst].StrAnswers[0]) // If user has answered the question { - if (sscanf (Exam->Questions[NumQst].StrAnswers,"%ld",&IntAnswerUsr) == 1) + if (sscanf (Result->Questions[NumQst].StrAnswers,"%ld",&IntAnswerUsr) == 1) { HTM_TD_Begin ("class=\"%s CM\"", TstVis_IsVisibleCorrectAns (Visibility) ? @@ -1010,8 +1010,8 @@ static void TstExa_WriteIntAnsExam (struct UsrData *UsrDat, /******************** Write float answer in an test exam *********************/ /*****************************************************************************/ -static void TstExa_WriteFloatAnsExam (struct UsrData *UsrDat, - const struct TstExa_Exam *Exam, +static void TstRes_WriteFloatAnsExam (struct UsrData *UsrDat, + const struct TstRes_Result *Result, unsigned NumQst, const struct Tst_Question *Question, unsigned Visibility) @@ -1025,15 +1025,15 @@ static void TstExa_WriteFloatAnsExam (struct UsrData *UsrDat, /***** Header with the title of each column *****/ HTM_TABLE_BeginPadding (2); HTM_TR_Begin (NULL); - TstExa_WriteHeadUserCorrect (UsrDat); + TstRes_WriteHeadUserCorrect (UsrDat); HTM_TR_End (); HTM_TR_Begin (NULL); /***** Write the user answer *****/ - if (Exam->Questions[NumQst].StrAnswers[0]) // If user has answered the question + if (Result->Questions[NumQst].StrAnswers[0]) // If user has answered the question { - FloatAnsUsr = Str_GetDoubleFromStr (Exam->Questions[NumQst].StrAnswers); + FloatAnsUsr = Str_GetDoubleFromStr (Result->Questions[NumQst].StrAnswers); // A bad formatted floating point answer will interpreted as 0.0 HTM_TD_Begin ("class=\"%s CM\"", TstVis_IsVisibleCorrectAns (Visibility) ? @@ -1071,8 +1071,8 @@ static void TstExa_WriteFloatAnsExam (struct UsrData *UsrDat, /***************** Write false / true answer in a test exam ******************/ /*****************************************************************************/ -static void TstExa_WriteTFAnsExam (struct UsrData *UsrDat, - const struct TstExa_Exam *Exam, +static void TstRes_WriteTFAnsExam (struct UsrData *UsrDat, + const struct TstRes_Result *Result, unsigned NumQst, const struct Tst_Question *Question, unsigned Visibility) @@ -1083,12 +1083,12 @@ static void TstExa_WriteTFAnsExam (struct UsrData *UsrDat, Tst_CheckIfNumberOfAnswersIsOne (Question); /***** Get answer true or false *****/ - AnsTFUsr = Exam->Questions[NumQst].StrAnswers[0]; + AnsTFUsr = Result->Questions[NumQst].StrAnswers[0]; /***** Header with the title of each column *****/ HTM_TABLE_BeginPadding (2); HTM_TR_Begin (NULL); - TstExa_WriteHeadUserCorrect (UsrDat); + TstRes_WriteHeadUserCorrect (UsrDat); HTM_TR_End (); HTM_TR_Begin (NULL); @@ -1120,8 +1120,8 @@ static void TstExa_WriteTFAnsExam (struct UsrData *UsrDat, /********** Write single or multiple choice answer in a test exam ************/ /*****************************************************************************/ -static void TstExa_WriteChoiceAnsExam (struct UsrData *UsrDat, - const struct TstExa_Exam *Exam, +static void TstRes_WriteChoiceAnsExam (struct UsrData *UsrDat, + const struct TstRes_Result *Result, unsigned NumQst, struct Tst_Question *Question, unsigned Visibility) @@ -1138,15 +1138,15 @@ static void TstExa_WriteChoiceAnsExam (struct UsrData *UsrDat, } Ans; /***** Get indexes for this question from string *****/ - TstExa_GetIndexesFromStr (Exam->Questions[NumQst].StrIndexes,Indexes); + TstRes_GetIndexesFromStr (Result->Questions[NumQst].StrIndexes,Indexes); /***** Get the user's answers for this question from string *****/ - TstExa_GetAnswersFromStr (Exam->Questions[NumQst].StrAnswers,UsrAnswers); + TstRes_GetAnswersFromStr (Result->Questions[NumQst].StrAnswers,UsrAnswers); /***** Begin table *****/ HTM_TABLE_BeginPadding (2); HTM_TR_Begin (NULL); - TstExa_WriteHeadUserCorrect (UsrDat); + TstRes_WriteHeadUserCorrect (UsrDat); HTM_TD_Empty (2); HTM_TR_End (); @@ -1249,15 +1249,15 @@ static void TstExa_WriteChoiceAnsExam (struct UsrData *UsrDat, /***************** Write text answer when assessing a test *******************/ /*****************************************************************************/ -static void TstExa_WriteTextAnsExam (struct UsrData *UsrDat, - const struct TstExa_Exam *Exam, +static void TstRes_WriteTextAnsExam (struct UsrData *UsrDat, + const struct TstRes_Result *Result, unsigned NumQst, struct Tst_Question *Question, unsigned Visibility) { unsigned NumOpt; - char TextAnsUsr[TstExa_MAX_BYTES_ANSWERS_ONE_QST + 1]; - char TextAnsOK[TstExa_MAX_BYTES_ANSWERS_ONE_QST + 1]; + char TextAnsUsr[TstRes_MAX_BYTES_ANSWERS_ONE_QST + 1]; + char TextAnsOK[TstRes_MAX_BYTES_ANSWERS_ONE_QST + 1]; bool Correct = false; /***** Get text and correctness of answers for this question from database (one row per answer) *****/ @@ -1282,17 +1282,17 @@ static void TstExa_WriteTextAnsExam (struct UsrData *UsrDat, /***** Header with the title of each column *****/ HTM_TABLE_BeginPadding (2); HTM_TR_Begin (NULL); - TstExa_WriteHeadUserCorrect (UsrDat); + TstRes_WriteHeadUserCorrect (UsrDat); HTM_TR_End (); HTM_TR_Begin (NULL); /***** Write the user answer *****/ - if (Exam->Questions[NumQst].StrAnswers[0]) // If user has answered the question + if (Result->Questions[NumQst].StrAnswers[0]) // If user has answered the question { /* Filter the user answer */ - Str_Copy (TextAnsUsr,Exam->Questions[NumQst].StrAnswers, - TstExa_MAX_BYTES_ANSWERS_ONE_QST); + Str_Copy (TextAnsUsr,Result->Questions[NumQst].StrAnswers, + TstRes_MAX_BYTES_ANSWERS_ONE_QST); /* In order to compare student answer to stored answer, the text answers are stored avoiding two or more consecurive spaces */ @@ -1306,7 +1306,7 @@ static void TstExa_WriteTextAnsExam (struct UsrData *UsrDat, { /* Filter this correct answer */ Str_Copy (TextAnsOK,Question->Answer.Options[NumOpt].Text, - TstExa_MAX_BYTES_ANSWERS_ONE_QST); + TstRes_MAX_BYTES_ANSWERS_ONE_QST); Str_ConvertToComparable (TextAnsOK); /* Check is user answer is correct */ @@ -1321,7 +1321,7 @@ static void TstExa_WriteTextAnsExam (struct UsrData *UsrDat, (Correct ? "ANS_OK" : "ANS_BAD") : "ANS_0"); - HTM_Txt (Exam->Questions[NumQst].StrAnswers); + HTM_Txt (Result->Questions[NumQst].StrAnswers); } else // If user has omitted the answer HTM_TD_Begin (NULL); @@ -1385,7 +1385,7 @@ static void TstExa_WriteTextAnsExam (struct UsrData *UsrDat, /********* one for the user's answer and other for the correct answer ********/ /*****************************************************************************/ -static void TstExa_WriteHeadUserCorrect (struct UsrData *UsrDat) +static void TstRes_WriteHeadUserCorrect (struct UsrData *UsrDat) { extern const char *Txt_User[Usr_NUM_SEXS]; extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; @@ -1403,16 +1403,16 @@ static void TstExa_WriteHeadUserCorrect (struct UsrData *UsrDat) /************* Store user's answers of an test exam into database ************/ /*****************************************************************************/ -static void TstExa_StoreOneExamQstInDB (const struct TstExa_Exam *Exam, +static void TstRes_StoreOneExamQstInDB (const struct TstRes_Result *Result, unsigned NumQst) { - char StrIndexes[TstExa_MAX_BYTES_INDEXES_ONE_QST + 1]; - char StrAnswers[TstExa_MAX_BYTES_ANSWERS_ONE_QST + 1]; + char StrIndexes[TstRes_MAX_BYTES_INDEXES_ONE_QST + 1]; + char StrAnswers[TstRes_MAX_BYTES_ANSWERS_ONE_QST + 1]; /***** Replace each separator of multiple parameters by a comma *****/ /* In database commas are used as separators instead of special chars */ - Par_ReplaceSeparatorMultipleByComma (Exam->Questions[NumQst].StrIndexes,StrIndexes); - Par_ReplaceSeparatorMultipleByComma (Exam->Questions[NumQst].StrAnswers,StrAnswers); + Par_ReplaceSeparatorMultipleByComma (Result->Questions[NumQst].StrIndexes,StrIndexes); + Par_ReplaceSeparatorMultipleByComma (Result->Questions[NumQst].StrAnswers,StrAnswers); /***** Insert question and user's answers into database *****/ Str_SetDecimalPointToUS (); // To print the floating point as a dot @@ -1421,9 +1421,9 @@ static void TstExa_StoreOneExamQstInDB (const struct TstExa_Exam *Exam, " (ExaCod,QstCod,QstInd,Score,Indexes,Answers)" " VALUES" " (%ld,%ld,%u,'%.15lg','%s','%s')", - Exam->ExaCod,Exam->Questions[NumQst].QstCod, + Result->ResCod,Result->Questions[NumQst].QstCod, NumQst, // 0, 1, 2, 3... - Exam->Questions[NumQst].Score, + Result->Questions[NumQst].Score, StrIndexes, StrAnswers); Str_SetDecimalPointToLocal (); // Return to local system @@ -1433,24 +1433,24 @@ static void TstExa_StoreOneExamQstInDB (const struct TstExa_Exam *Exam, /*********************** Update the score of a question **********************/ /*****************************************************************************/ -static void Tst_UpdateQstScoreInDB (const struct TstExa_Exam *Exam,unsigned NumQst) +static void Tst_UpdateQstScoreInDB (const struct TstRes_Result *Result,unsigned NumQst) { /***** Update number of clicks and score of the question *****/ Str_SetDecimalPointToUS (); // To print the floating point as a dot - if (Exam->Questions[NumQst].AnswerIsNotBlank) + if (Result->Questions[NumQst].AnswerIsNotBlank) DB_QueryUPDATE ("can not update the score of a question", "UPDATE tst_questions" " SET NumHits=NumHits+1,NumHitsNotBlank=NumHitsNotBlank+1," "Score=Score+(%.15lg)" " WHERE QstCod=%ld", - Exam->Questions[NumQst].Score, - Exam->Questions[NumQst].QstCod); + Result->Questions[NumQst].Score, + Result->Questions[NumQst].QstCod); else // The answer is blank DB_QueryUPDATE ("can not update the score of a question", "UPDATE tst_questions" " SET NumHits=NumHits+1" " WHERE QstCod=%ld", - Exam->Questions[NumQst].QstCod); + Result->Questions[NumQst].QstCod); Str_SetDecimalPointToLocal (); // Return to local system } @@ -1458,12 +1458,12 @@ static void Tst_UpdateQstScoreInDB (const struct TstExa_Exam *Exam,unsigned NumQ /************* Select users and dates to show their test exams ***************/ /*****************************************************************************/ -void TstExa_SelUsrsToViewUsrsExams (void) +void TstRes_SelUsrsToViewUsrsExams (void) { - TstExa_PutFormToSelectUsrsToViewUsrsExams (NULL); + TstRes_PutFormToSelectUsrsToViewUsrsExams (NULL); } -static void TstExa_PutFormToSelectUsrsToViewUsrsExams (__attribute__((unused)) void *Args) +static void TstRes_PutFormToSelectUsrsToViewUsrsExams (__attribute__((unused)) void *Args) { extern const char *Hlp_ASSESSMENT_Tests_results; extern const char *Txt_Results; @@ -1482,7 +1482,7 @@ static void TstExa_PutFormToSelectUsrsToViewUsrsExams (__attribute__((unused)) v /******************** Select dates to show my test exams *********************/ /*****************************************************************************/ -void TstExa_SelDatesToSeeMyExams (void) +void TstRes_SelDatesToSeeMyExams (void) { extern const char *Hlp_ASSESSMENT_Tests_results; extern const char *Txt_Results; @@ -1513,7 +1513,7 @@ void TstExa_SelDatesToSeeMyExams (void) /***************************** Show my test exams ****************************/ /*****************************************************************************/ -void TstExa_ShowMyExams (void) +void TstRes_ShowMyExams (void) { extern const char *Hlp_ASSESSMENT_Tests_results; extern const char *Txt_Results; @@ -1527,11 +1527,11 @@ void TstExa_ShowMyExams (void) Hlp_ASSESSMENT_Tests_results,Box_NOT_CLOSABLE,2); /***** Header of the table with the list of users *****/ - TstExa_ShowHeaderExams (); + TstRes_ShowHeaderExams (); /***** List my test exams *****/ TstCfg_GetConfigFromDB (); // To get feedback type - TstExa_ShowExams (&Gbl.Usrs.Me.UsrDat); + TstRes_ShowExams (&Gbl.Usrs.Me.UsrDat); /***** End table and box *****/ Box_BoxTableEnd (); @@ -1541,18 +1541,18 @@ void TstExa_ShowMyExams (void) /******************** Get users and show their test exams ********************/ /*****************************************************************************/ -void TstExa_GetUsrsAndShowExams (void) +void TstRes_GetUsrsAndShowExams (void) { Usr_GetSelectedUsrsAndGoToAct (&Gbl.Usrs.Selected, - TstExa_ShowUsrsExams,NULL, - TstExa_PutFormToSelectUsrsToViewUsrsExams,NULL); + TstRes_ShowUsrsExams,NULL, + TstRes_PutFormToSelectUsrsToViewUsrsExams,NULL); } /*****************************************************************************/ /********************* Show test exams for several users *********************/ /*****************************************************************************/ -static void TstExa_ShowUsrsExams (__attribute__((unused)) void *Args) +static void TstRes_ShowUsrsExams (__attribute__((unused)) void *Args) { extern const char *Hlp_ASSESSMENT_Tests_results; extern const char *Txt_Results; @@ -1567,7 +1567,7 @@ static void TstExa_ShowUsrsExams (__attribute__((unused)) void *Args) Hlp_ASSESSMENT_Tests_results,Box_NOT_CLOSABLE,2); /***** Header of the table with the list of users *****/ - TstExa_ShowHeaderExams (); + TstRes_ShowHeaderExams (); /***** List the test exams of the selected users *****/ Ptr = Gbl.Usrs.Selected.List[Rol_UNK]; @@ -1577,11 +1577,11 @@ static void TstExa_ShowUsrsExams (__attribute__((unused)) void *Args) Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64); Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat); if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) - if (Usr_CheckIfICanViewTst (&Gbl.Usrs.Other.UsrDat)) + if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat)) { /***** Show test exams *****/ Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat); - TstExa_ShowExams (&Gbl.Usrs.Other.UsrDat); + TstRes_ShowExams (&Gbl.Usrs.Other.UsrDat); } } @@ -1593,7 +1593,7 @@ static void TstExa_ShowUsrsExams (__attribute__((unused)) void *Args) /************************ Show header of my test exams ***********************/ /*****************************************************************************/ -static void TstExa_ShowHeaderExams (void) +static void TstRes_ShowHeaderExams (void) { extern const char *Txt_User[Usr_NUM_SEXS]; extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME]; @@ -1622,7 +1622,7 @@ static void TstExa_ShowHeaderExams (void) /************ Show the test exams of a user in the current course ************/ /*****************************************************************************/ -static void TstExa_ShowExams (struct UsrData *UsrDat) +static void TstRes_ShowExams (struct UsrData *UsrDat) { extern const char *Txt_View_test; MYSQL_RES *mysql_res; @@ -1632,7 +1632,7 @@ static void TstExa_ShowExams (struct UsrData *UsrDat) static unsigned UniqueId = 0; Dat_StartEndTime_t StartEndTime; char *Id; - struct TstExa_Exam Exam; + struct TstRes_Result Result; unsigned NumTotalQsts = 0; unsigned NumTotalQstsNotBlank = 0; double TotalScoreOfAllTests = 0.0; @@ -1686,35 +1686,35 @@ static void TstExa_ShowExams (struct UsrData *UsrDat) row = mysql_fetch_row (mysql_res); /* Get test code (row[0]) */ - TstExa_ResetExam (&Exam); - if ((Exam.ExaCod = Str_ConvertStrCodToLongCod (row[0])) < 0) + TstRes_ResetResult (&Result); + if ((Result.ResCod = Str_ConvertStrCodToLongCod (row[0])) < 0) Lay_ShowErrorAndExit ("Wrong code of test exam."); /* Get if exam has been sent (row[5]) */ - Exam.Sent = (row[5][0] == 'Y'); + Result.Sent = (row[5][0] == 'Y'); /* Get if teachers are allowed to see this test exam (row[6]) */ - Exam.AllowTeachers = (row[6][0] == 'Y'); - ClassDat = Exam.AllowTeachers ? "DAT" : + Result.AllowTeachers = (row[6][0] == 'Y'); + ClassDat = Result.AllowTeachers ? "DAT" : "DAT_LIGHT"; switch (Gbl.Usrs.Me.Role.Logged) { case Rol_STD: - ICanView.NumQsts = Exam.Sent && ItsMe; - ICanView.Score = Exam.Sent && ItsMe && + ICanView.NumQsts = Result.Sent && ItsMe; + ICanView.Score = Result.Sent && ItsMe && TstVis_IsVisibleTotalScore (TstCfg_GetConfigVisibility ()); - ICanView.Exam = Exam.Sent && ItsMe; + ICanView.Exam = Result.Sent && ItsMe; break; case Rol_NET: case Rol_TCH: case Rol_DEG_ADM: case Rol_CTR_ADM: case Rol_INS_ADM: - ICanView.NumQsts = Exam.Sent; // If the exam has been sent, + ICanView.NumQsts = Result.Sent; // If the exam has been sent, // teachers can see the number of questions ICanView.Score = - ICanView.Exam = Exam.Sent && (ItsMe || Exam.AllowTeachers); + ICanView.Exam = Result.Sent && (ItsMe || Result.AllowTeachers); break; case Rol_SYS_ADM: ICanView.NumQsts = @@ -1732,8 +1732,8 @@ static void TstExa_ShowExams (struct UsrData *UsrDat) HTM_TR_Begin (NULL); /* Write date and time (row[1] and row[2] hold UTC date-times) */ - Exam.TimeUTC[Dat_START_TIME] = Dat_GetUNIXTimeFromStr (row[1]); - Exam.TimeUTC[Dat_END_TIME ] = Dat_GetUNIXTimeFromStr (row[2]); + Result.TimeUTC[Dat_START_TIME] = Dat_GetUNIXTimeFromStr (row[1]); + Result.TimeUTC[Dat_END_TIME ] = Dat_GetUNIXTimeFromStr (row[2]); UniqueId++; for (StartEndTime = (Dat_StartEndTime_t) 0; StartEndTime <= (Dat_StartEndTime_t) (Dat_NUM_START_END_TIME - 1); @@ -1743,7 +1743,7 @@ static void TstExa_ShowExams (struct UsrData *UsrDat) Lay_NotEnoughMemoryExit (); HTM_TD_Begin ("id=\"%s\" class=\"%s LT COLOR%u\"", Id,ClassDat,Gbl.RowEvenOdd); - Dat_WriteLocalDateHMSFromUTC (Id,Exam.TimeUTC[StartEndTime], + Dat_WriteLocalDateHMSFromUTC (Id,Result.TimeUTC[StartEndTime], Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK, true,true,false,0x7); HTM_TD_End (); @@ -1751,57 +1751,56 @@ static void TstExa_ShowExams (struct UsrData *UsrDat) } /* Get number of questions (row[3]) */ - if (sscanf (row[3],"%u",&Exam.NumQsts) != 1) - Exam.NumQsts = 0; - if (Exam.AllowTeachers) - NumTotalQsts += Exam.NumQsts; + if (sscanf (row[3],"%u",&Result.NumQsts) != 1) + Result.NumQsts = 0; + if (Result.AllowTeachers) + NumTotalQsts += Result.NumQsts; /* Get number of questions not blank (row[4]) */ - if (sscanf (row[4],"%u",&Exam.NumQstsNotBlank) != 1) - Exam.NumQstsNotBlank = 0; - if (Exam.AllowTeachers) - NumTotalQstsNotBlank += Exam.NumQstsNotBlank; + if (sscanf (row[4],"%u",&Result.NumQstsNotBlank) != 1) + Result.NumQstsNotBlank = 0; + if (Result.AllowTeachers) + NumTotalQstsNotBlank += Result.NumQstsNotBlank; /* Get score (row[7]) */ Str_SetDecimalPointToUS (); // To get the decimal point as a dot - if (sscanf (row[7],"%lf",&Exam.Score) != 1) - Exam.Score = 0.0; + if (sscanf (row[7],"%lf",&Result.Score) != 1) + Result.Score = 0.0; Str_SetDecimalPointToLocal (); // Return to local system - if (Exam.AllowTeachers) - TotalScoreOfAllTests += Exam.Score; + if (Result.AllowTeachers) + TotalScoreOfAllTests += Result.Score; /* Write number of questions */ HTM_TD_Begin ("class=\"%s RT COLOR%u\"",ClassDat,Gbl.RowEvenOdd); if (ICanView.NumQsts) - HTM_Unsigned (Exam.NumQsts); + HTM_Unsigned (Result.NumQsts); HTM_TD_End (); /* Write number of questions not blank */ HTM_TD_Begin ("class=\"%s RT COLOR%u\"",ClassDat,Gbl.RowEvenOdd); if (ICanView.NumQsts) - HTM_Unsigned (Exam.NumQstsNotBlank); + HTM_Unsigned (Result.NumQstsNotBlank); HTM_TD_End (); /* Write score */ HTM_TD_Begin ("class=\"%s RT COLOR%u\"",ClassDat,Gbl.RowEvenOdd); if (ICanView.Score) - HTM_Double2Decimals (Exam.Score); + HTM_Double2Decimals (Result.Score); HTM_TD_End (); /* Write average score per question */ HTM_TD_Begin ("class=\"%s RT COLOR%u\"",ClassDat,Gbl.RowEvenOdd); if (ICanView.Score) - HTM_Double2Decimals (Exam.NumQsts ? Exam.Score / - (double) Exam.NumQsts : - 0.0); + HTM_Double2Decimals (Result.NumQsts ? Result.Score / + (double) Result.NumQsts : + 0.0); HTM_TD_End (); /* Write grade */ HTM_TD_Begin ("class=\"%s RT COLOR%u\"",ClassDat,Gbl.RowEvenOdd); if (ICanView.Score) - TstExa_ComputeAndShowGrade (Exam.NumQsts, - Exam.Score, - TstExa_SCORE_MAX); + TstRes_ComputeAndShowGrade (Result.NumQsts,Result.Score, + TstRes_SCORE_MAX); HTM_TD_End (); /* Link to show this test exam */ @@ -1810,19 +1809,19 @@ static void TstExa_ShowExams (struct UsrData *UsrDat) { Frm_StartForm (Gbl.Action.Act == ActSeeMyTstRes ? ActSeeOneTstResMe : ActSeeOneTstResOth); - TstExa_PutParamExaCod (Exam.ExaCod); + TstRes_PutParamExaCod (Result.ResCod); Ico_PutIconLink ("tasks.svg",Txt_View_test); Frm_EndForm (); } HTM_TD_End (); HTM_TR_End (); - if (Exam.AllowTeachers) + if (Result.AllowTeachers) NumExamsVisibleByTchs++; } /***** Write totals for this user *****/ - TstExa_ShowExamsSummaryRow (ItsMe,NumExamsVisibleByTchs, + TstRes_ShowExamsSummaryRow (ItsMe,NumExamsVisibleByTchs, NumTotalQsts,NumTotalQstsNotBlank, TotalScoreOfAllTests); } @@ -1842,7 +1841,7 @@ static void TstExa_ShowExams (struct UsrData *UsrDat) /****************** Write parameter with code of test exam *******************/ /*****************************************************************************/ -void TstExa_PutParamExaCod (long ExaCod) +void TstRes_PutParamExaCod (long ExaCod) { Par_PutHiddenParamLong (NULL,"ExaCod",ExaCod); } @@ -1851,7 +1850,7 @@ void TstExa_PutParamExaCod (long ExaCod) /****************** Get parameter with code of test exam *********************/ /*****************************************************************************/ -long TstExa_GetParamExaCod (void) +long TstRes_GetParamExaCod (void) { /***** Get code of exam *****/ return Par_GetParToLong ("ExaCod"); @@ -1861,7 +1860,7 @@ long TstExa_GetParamExaCod (void) /**************** Show row with summary of user's test exams *****************/ /*****************************************************************************/ -static void TstExa_ShowExamsSummaryRow (bool ItsMe, +static void TstRes_ShowExamsSummaryRow (bool ItsMe, unsigned NumExams, unsigned NumTotalQsts, unsigned NumTotalQstsNotBlank, @@ -1929,9 +1928,8 @@ static void TstExa_ShowExamsSummaryRow (bool ItsMe, /***** Write score over Tst_SCORE_MAX *****/ HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); if (ICanViewTotalScore) - TstExa_ComputeAndShowGrade (NumTotalQsts, - TotalScoreOfAllTests, - TstExa_SCORE_MAX); + TstRes_ComputeAndShowGrade (NumTotalQsts,TotalScoreOfAllTests, + TstRes_SCORE_MAX); HTM_TD_End (); /***** Last cell *****/ @@ -1946,7 +1944,7 @@ static void TstExa_ShowExamsSummaryRow (bool ItsMe, /******************** Show one test exam of another user *********************/ /*****************************************************************************/ -void TstExa_ShowOneExam (void) +void TstRes_ShowOneExam (void) { extern const char *Hlp_ASSESSMENT_Tests_results; extern const char *Txt_Test_result; @@ -1958,7 +1956,7 @@ void TstExa_ShowOneExam (void) extern const char *Txt_Score; extern const char *Txt_Grade; extern const char *Txt_Tags; - struct TstExa_Exam Exam; + struct TstRes_Result Result; bool ShowPhoto; char PhotoURL[PATH_MAX + 1]; Dat_StartEndTime_t StartEndTime; @@ -1968,12 +1966,12 @@ void TstExa_ShowOneExam (void) bool ICanViewScore; /***** Get the code of the test *****/ - TstExa_ResetExam (&Exam); - if ((Exam.ExaCod = TstExa_GetParamExaCod ()) == -1L) + TstRes_ResetResult (&Result); + if ((Result.ResCod = TstRes_GetParamExaCod ()) == -1L) Lay_ShowErrorAndExit ("Code of test is missing."); /***** Get test exam data *****/ - TstExa_GetExamDataByExaCod (&Exam); + TstRes_GetExamDataByExaCod (&Result); TstCfg_SetConfigVisibility (TstVis_MAX_VISIBILITY); /***** Check if I can view this test exam *****/ @@ -2003,7 +2001,7 @@ void TstExa_ShowOneExam (void) case ActSeeOneTstResOth: ICanViewTest = ICanViewScore = ItsMe || - Exam.AllowTeachers; + Result.AllowTeachers; break; default: ICanViewTest = @@ -2024,7 +2022,7 @@ void TstExa_ShowOneExam (void) if (ICanViewTest) // I am allowed to view this test exam { /***** Get questions and user's answers of the test exam from database *****/ - TstExa_GetExamQuestionsFromDB (&Exam); + TstRes_GetExamQuestionsFromDB (&Result); /***** Begin box *****/ Box_BoxBegin (NULL,Txt_Test_result, @@ -2042,7 +2040,7 @@ void TstExa_ShowOneExam (void) /* Get data of the user who made the test */ if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) Lay_ShowErrorAndExit (Txt_The_user_does_not_exist); - if (!Usr_CheckIfICanViewTst (&Gbl.Usrs.Other.UsrDat)) + if (!Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat)) Lay_NoPermissionExit (); /* User */ @@ -2083,7 +2081,7 @@ void TstExa_ShowOneExam (void) HTM_TD_End (); HTM_TD_Begin ("id=\"%s\" class=\"DAT LT\"",Id); - Dat_WriteLocalDateHMSFromUTC (Id,Exam.TimeUTC[StartEndTime], + Dat_WriteLocalDateHMSFromUTC (Id,Result.TimeUTC[StartEndTime], Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA, true,true,true,0x7); HTM_TD_End (); @@ -2102,8 +2100,8 @@ void TstExa_ShowOneExam (void) HTM_TD_Begin ("class=\"DAT LT\""); HTM_TxtF ("%u (%u %s)", - Exam.NumQsts, - Exam.NumQstsNotBlank,Txt_non_blank_QUESTIONS); + Result.NumQsts, + Result.NumQstsNotBlank,Txt_non_blank_QUESTIONS); HTM_TD_End (); HTM_TR_End (); @@ -2117,7 +2115,7 @@ void TstExa_ShowOneExam (void) HTM_TD_Begin ("class=\"DAT LT\""); if (ICanViewScore) - HTM_Double2Decimals (Exam.Score); + HTM_Double2Decimals (Result.Score); else Ico_PutIconNotVisible (); HTM_TD_End (); @@ -2131,9 +2129,8 @@ void TstExa_ShowOneExam (void) HTM_TD_Begin ("class=\"DAT LT\""); if (ICanViewScore) - TstExa_ComputeAndShowGrade (Exam.NumQsts, - Exam.Score, - TstExa_SCORE_MAX); + TstRes_ComputeAndShowGrade (Result.NumQsts,Result.Score, + TstRes_SCORE_MAX); else Ico_PutIconNotVisible (); HTM_TD_End (); @@ -2148,14 +2145,13 @@ void TstExa_ShowOneExam (void) HTM_TD_End (); HTM_TD_Begin ("class=\"DAT LT\""); - TstExa_ShowTagsPresentInAnExam (Exam.ExaCod); + TstRes_ShowTagsPresentInAnExam (Result.ResCod); HTM_TD_End (); HTM_TR_End (); /***** Write answers and solutions *****/ - TstExa_ShowExamAnswers (&Gbl.Usrs.Other.UsrDat, - &Exam, + TstRes_ShowExamAnswers (&Gbl.Usrs.Other.UsrDat,&Result, TstCfg_GetConfigVisibility ()); /***** End table *****/ @@ -2166,12 +2162,11 @@ void TstExa_ShowOneExam (void) { HTM_DIV_Begin ("class=\"DAT_N_BOLD CM\""); HTM_TxtColonNBSP (Txt_Score); - HTM_Double2Decimals (Exam.Score); + HTM_Double2Decimals (Result.Score); HTM_BR (); HTM_TxtColonNBSP (Txt_Grade); - TstExa_ComputeAndShowGrade (Exam.NumQsts, - Exam.Score, - TstExa_SCORE_MAX); + TstRes_ComputeAndShowGrade (Result.NumQsts,Result.Score, + TstRes_SCORE_MAX); HTM_DIV_End (); } @@ -2186,7 +2181,7 @@ void TstExa_ShowOneExam (void) /********************* Show test tags in this test exam **********************/ /*****************************************************************************/ -static void TstExa_ShowTagsPresentInAnExam (long ExaCod) +static void TstRes_ShowTagsPresentInAnExam (long ResCod) { MYSQL_RES *mysql_res; unsigned NumTags; @@ -2204,7 +2199,7 @@ static void TstExa_ShowTagsPresentInAnExam (long ExaCod) " AS TagsCods,tst_tags" " WHERE TagsCods.TagCod=tst_tags.TagCod" " ORDER BY tst_tags.TagTxt", - ExaCod); + ResCod); Tst_ShowTagList (NumTags,mysql_res); /***** Free structure that stores the query result *****/ @@ -2215,27 +2210,27 @@ static void TstExa_ShowTagsPresentInAnExam (long ExaCod) /************** Show user's and correct answers of a test exam ***************/ /*****************************************************************************/ -void TstExa_ShowExamAnswers (struct UsrData *UsrDat, - struct TstExa_Exam *Exam, +void TstRes_ShowExamAnswers (struct UsrData *UsrDat, + struct TstRes_Result *Result, unsigned Visibility) { unsigned NumQst; struct Tst_Question Question; for (NumQst = 0; - NumQst < Exam->NumQsts; + NumQst < Result->NumQsts; NumQst++) { Gbl.RowEvenOdd = NumQst % 2; /***** Create test question *****/ Tst_QstConstructor (&Question); - Question.QstCod = Exam->Questions[NumQst].QstCod; + Question.QstCod = Result->Questions[NumQst].QstCod; /***** Get question data *****/ if (Tst_GetQstDataFromDB (&Question)) // Question exists? /***** Write questions and answers *****/ - TstExa_WriteQstAndAnsExam (UsrDat,Exam,NumQst,&Question,Visibility); + TstRes_WriteQstAndAnsExam (UsrDat,Result,NumQst,&Question,Visibility); /***** Destroy test question *****/ Tst_QstDestructor (&Question); @@ -2246,7 +2241,7 @@ void TstExa_ShowExamAnswers (struct UsrData *UsrDat, /************ Get data of a test exam using its test exam code ***************/ /*****************************************************************************/ -void TstExa_GetExamDataByExaCod (struct TstExa_Exam *Exam) +void TstRes_GetExamDataByExaCod (struct TstRes_Result *Result) { MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -2263,7 +2258,7 @@ void TstExa_GetExamDataByExaCod (struct TstExa_Exam *Exam) "Score" // row[7] " FROM tst_exams" " WHERE ExaCod=%ld AND CrsCod=%ld", - Exam->ExaCod, + Result->ResCod, Gbl.Hierarchy.Crs.CrsCod) == 1) { row = mysql_fetch_row (mysql_res); @@ -2272,31 +2267,31 @@ void TstExa_GetExamDataByExaCod (struct TstExa_Exam *Exam) Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]); /* Get date-time (row[1] and row[2] hold UTC date-time) */ - Exam->TimeUTC[Dat_START_TIME] = Dat_GetUNIXTimeFromStr (row[1]); - Exam->TimeUTC[Dat_END_TIME ] = Dat_GetUNIXTimeFromStr (row[2]); + Result->TimeUTC[Dat_START_TIME] = Dat_GetUNIXTimeFromStr (row[1]); + Result->TimeUTC[Dat_END_TIME ] = Dat_GetUNIXTimeFromStr (row[2]); /* Get number of questions (row[3]) */ - if (sscanf (row[3],"%u",&Exam->NumQsts) != 1) - Exam->NumQsts = 0; + if (sscanf (row[3],"%u",&Result->NumQsts) != 1) + Result->NumQsts = 0; /* Get number of questions not blank (row[4]) */ - if (sscanf (row[4],"%u",&Exam->NumQstsNotBlank) != 1) - Exam->NumQstsNotBlank = 0; + if (sscanf (row[4],"%u",&Result->NumQstsNotBlank) != 1) + Result->NumQstsNotBlank = 0; /* Get if exam has been sent (row[5]) */ - Exam->Sent = (row[5][0] == 'Y'); + Result->Sent = (row[5][0] == 'Y'); /* Get if teachers are allowed to see this test exam (row[6]) */ - Exam->AllowTeachers = (row[6][0] == 'Y'); + Result->AllowTeachers = (row[6][0] == 'Y'); /* Get score (row[7]) */ Str_SetDecimalPointToUS (); // To get the decimal point as a dot - if (sscanf (row[7],"%lf",&Exam->Score) != 1) - Exam->Score = 0.0; + if (sscanf (row[7],"%lf",&Result->Score) != 1) + Result->Score = 0.0; Str_SetDecimalPointToLocal (); // Return to local system } else - TstExa_ResetExamExceptExaCod (Exam); + TstRes_ResetExamExceptExaCod (Result); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -2306,7 +2301,7 @@ void TstExa_GetExamDataByExaCod (struct TstExa_Exam *Exam) /************* Get the questions of a test exam from database ****************/ /*****************************************************************************/ -void TstExa_GetExamQuestionsFromDB (struct TstExa_Exam *Exam) +void TstRes_GetExamQuestionsFromDB (struct TstRes_Result *Result) { MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -2323,12 +2318,12 @@ void TstExa_GetExamQuestionsFromDB (struct TstExa_Exam *Exam) " FROM tst_exam_questions" " WHERE ExaCod=%ld" " ORDER BY QstInd", - Exam->ExaCod); + Result->ResCod); /***** List questions *****/ // The number of questions in table of exam questions // should match the number of questions got from exam - if (NumQsts == Exam->NumQsts) + if (NumQsts == Result->NumQsts) for (NumQst = 0; NumQst < NumQsts; NumQst++) @@ -2336,27 +2331,27 @@ void TstExa_GetExamQuestionsFromDB (struct TstExa_Exam *Exam) row = mysql_fetch_row (mysql_res); /* Get question code */ - if ((Exam->Questions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0) + if ((Result->Questions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0) Lay_ShowErrorAndExit ("Wrong code of question."); /* Get indexes for this question (row[1]) */ - Str_Copy (Exam->Questions[NumQst].StrIndexes,row[1], - TstExa_MAX_BYTES_INDEXES_ONE_QST); + Str_Copy (Result->Questions[NumQst].StrIndexes,row[1], + TstRes_MAX_BYTES_INDEXES_ONE_QST); /* Get answers selected by user for this question (row[2]) */ - Str_Copy (Exam->Questions[NumQst].StrAnswers,row[2], - TstExa_MAX_BYTES_ANSWERS_ONE_QST); + Str_Copy (Result->Questions[NumQst].StrAnswers,row[2], + TstRes_MAX_BYTES_ANSWERS_ONE_QST); /* Replace each comma by a separator of multiple parameters */ /* In database commas are used as separators instead of special chars */ - Par_ReplaceCommaBySeparatorMultiple (Exam->Questions[NumQst].StrIndexes); - Par_ReplaceCommaBySeparatorMultiple (Exam->Questions[NumQst].StrAnswers); + Par_ReplaceCommaBySeparatorMultiple (Result->Questions[NumQst].StrIndexes); + Par_ReplaceCommaBySeparatorMultiple (Result->Questions[NumQst].StrAnswers); } /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); - if (NumQsts != Exam->NumQsts) + if (NumQsts != Result->NumQsts) Lay_ShowErrorAndExit ("Wrong exam."); } @@ -2364,7 +2359,7 @@ void TstExa_GetExamQuestionsFromDB (struct TstExa_Exam *Exam) /********************** Remove test exams made by a user *********************/ /*****************************************************************************/ -void TstExa_RemoveExamsMadeByUsrInAllCrss (long UsrCod) +void TstRes_RemoveExamsMadeByUsrInAllCrss (long UsrCod) { /***** Remove test exams made by the specified user *****/ DB_QueryDELETE ("can not remove test exams made by a user", @@ -2384,7 +2379,7 @@ void TstExa_RemoveExamsMadeByUsrInAllCrss (long UsrCod) /*************** Remove test exams made by a user in a course ****************/ /*****************************************************************************/ -void TstExa_RemoveExamsMadeByUsrInCrs (long UsrCod,long CrsCod) +void TstRes_RemoveExamsMadeByUsrInCrs (long UsrCod,long CrsCod) { /***** Remove test exams made by the given user *****/ DB_QueryDELETE ("can not remove test exams made by a user in a course", @@ -2404,7 +2399,7 @@ void TstExa_RemoveExamsMadeByUsrInCrs (long UsrCod,long CrsCod) /******************* Remove all test exams made in a course ******************/ /*****************************************************************************/ -void TstExa_RemoveCrsExams (long CrsCod) +void TstRes_RemoveCrsExams (long CrsCod) { /***** Remove questions of test exams made in the course *****/ DB_QueryDELETE ("can not remove test exams made in a course", diff --git a/swad_test_exam.h b/swad_test_exam.h index 969210e0..ea64f467 100644 --- a/swad_test_exam.h +++ b/swad_test_exam.h @@ -34,32 +34,32 @@ /***************************** Public constants ******************************/ /*****************************************************************************/ -#define TstExa_MAX_BYTES_INDEXES_ONE_QST (Tst_MAX_OPTIONS_PER_QUESTION * (3 + 1)) +#define TstRes_MAX_BYTES_INDEXES_ONE_QST (Tst_MAX_OPTIONS_PER_QUESTION * (3 + 1)) -#define TstExa_MAX_CHARS_ANSWERS_ONE_QST (128 - 1) // 127 -#define TstExa_MAX_BYTES_ANSWERS_ONE_QST ((TstExa_MAX_CHARS_ANSWERS_ONE_QST + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047 +#define TstRes_MAX_CHARS_ANSWERS_ONE_QST (128 - 1) // 127 +#define TstRes_MAX_BYTES_ANSWERS_ONE_QST ((TstRes_MAX_CHARS_ANSWERS_ONE_QST + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047 -#define TstExa_SCORE_MAX 10 // Maximum score of a test (10 in Spain). Must be unsigned! // TODO: Make this configurable by teachers +#define TstRes_SCORE_MAX 10 // Maximum score of a test (10 in Spain). Must be unsigned! // TODO: Make this configurable by teachers /*****************************************************************************/ /******************************* Public types ********************************/ /*****************************************************************************/ -struct TstExa_Exam +struct TstRes_Result { - long ExaCod; // Test exam code + long ResCod; // Test result code time_t TimeUTC[Dat_NUM_START_END_TIME]; unsigned NumQsts; // Number of questions unsigned NumQstsNotBlank; // Number of questions not blank - bool Sent; // This test exam has been sent or not? + bool Sent; // This test result has been sent or not? // "Sent" means that user has clicked "Send" button after finishing - bool AllowTeachers; // Are teachers allowed to see this test exam? - double Score; // Total score of the test exam + bool AllowTeachers; // Are teachers allowed to see this test result? + double Score; // Total score of the test result struct { long QstCod; // Question code - char StrIndexes[TstExa_MAX_BYTES_INDEXES_ONE_QST + 1]; // 0 1 2 3, 3 0 2 1, etc. - char StrAnswers[TstExa_MAX_BYTES_ANSWERS_ONE_QST + 1]; // Answers selected by user + char StrIndexes[TstRes_MAX_BYTES_INDEXES_ONE_QST + 1]; // 0 1 2 3, 3 0 2 1, etc. + char StrAnswers[TstRes_MAX_BYTES_ANSWERS_ONE_QST + 1]; // Answers selected by user double Score; // Question score bool AnswerIsNotBlank; // Answer not blank? } Questions[TstCfg_MAX_QUESTIONS_PER_TEST]; @@ -69,43 +69,43 @@ struct TstExa_Exam /***************************** Public prototypes *****************************/ /*****************************************************************************/ -void TstExa_ResetExam (struct TstExa_Exam *Exam); -void TstExa_CreateExamInDB (struct TstExa_Exam *Exam); -void TstExa_UpdateExamInDB (const struct TstExa_Exam *Exam); +void TstRes_ResetResult (struct TstRes_Result *Result); +void TstRes_CreateExamInDB (struct TstRes_Result *Exam); +void TstRes_UpdateExamInDB (const struct TstRes_Result *Exam); -void TstExa_ShowExamAfterAssess (struct TstExa_Exam *Exam); +void TstRes_ShowExamAfterAssess (struct TstRes_Result *Exam); -void TstExa_ComputeScoresAndStoreExamQuestions (struct TstExa_Exam *Exam, +void TstRes_ComputeScoresAndStoreExamQuestions (struct TstRes_Result *Exam, bool UpdateQstScore); -void TstExa_ComputeChoiceAnsScore (struct TstExa_Exam *Result, +void TstRes_ComputeChoiceAnsScore (struct TstRes_Result *Result, unsigned NumQst, struct Tst_Question *Question); -void TstExa_GetIndexesFromStr (const char StrIndexesOneQst[TstExa_MAX_BYTES_INDEXES_ONE_QST + 1], // 0 1 2 3, 3 0 2 1, etc. +void TstRes_GetIndexesFromStr (const char StrIndexesOneQst[TstRes_MAX_BYTES_INDEXES_ONE_QST + 1], // 0 1 2 3, 3 0 2 1, etc. unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION]); -void TstExa_GetAnswersFromStr (const char StrAnswersOneQst[TstExa_MAX_BYTES_ANSWERS_ONE_QST + 1], +void TstRes_GetAnswersFromStr (const char StrAnswersOneQst[TstRes_MAX_BYTES_ANSWERS_ONE_QST + 1], bool UsrAnswers[Tst_MAX_OPTIONS_PER_QUESTION]); -void TstExa_ComputeAndShowGrade (unsigned NumQsts,double Score,double MaxGrade); -double TstExa_ComputeGrade (unsigned NumQsts,double Score,double MaxGrade); -void TstExa_ShowGrade (double Grade,double MaxGrade); +void TstRes_ComputeAndShowGrade (unsigned NumQsts,double Score,double MaxGrade); +double TstRes_ComputeGrade (unsigned NumQsts,double Score,double MaxGrade); +void TstRes_ShowGrade (double Grade,double MaxGrade); -void TstExa_SelUsrsToViewUsrsExams (void); -void TstExa_SelDatesToSeeMyExams (void); -void TstExa_ShowMyExams (void); -void TstExa_GetUsrsAndShowExams (void); +void TstRes_SelUsrsToViewUsrsExams (void); +void TstRes_SelDatesToSeeMyExams (void); +void TstRes_ShowMyExams (void); +void TstRes_GetUsrsAndShowExams (void); -void TstExa_PutParamExaCod (long ExaCod); -long TstExa_GetParamExaCod (void); +void TstRes_PutParamExaCod (long ExaCod); +long TstRes_GetParamExaCod (void); -void TstExa_ShowOneExam (void); -void TstExa_ShowExamAnswers (struct UsrData *UsrDat, - struct TstExa_Exam *Exam, +void TstRes_ShowOneExam (void); +void TstRes_ShowExamAnswers (struct UsrData *UsrDat, + struct TstRes_Result *Result, unsigned Visibility); -void TstExa_GetExamDataByExaCod (struct TstExa_Exam *Exam); +void TstRes_GetExamDataByExaCod (struct TstRes_Result *Result); -void TstExa_GetExamQuestionsFromDB (struct TstExa_Exam *Exam); -void TstExa_RemoveExamsMadeByUsrInAllCrss (long UsrCod); -void TstExa_RemoveExamsMadeByUsrInCrs (long UsrCod,long CrsCod); -void TstExa_RemoveCrsExams (long CrsCod); +void TstRes_GetExamQuestionsFromDB (struct TstRes_Result *Result); +void TstRes_RemoveExamsMadeByUsrInAllCrss (long UsrCod); +void TstRes_RemoveExamsMadeByUsrInCrs (long UsrCod,long CrsCod); +void TstRes_RemoveCrsExams (long CrsCod); #endif diff --git a/swad_text.c b/swad_text.c index feefc063..a5d0693c 100644 --- a/swad_text.c +++ b/swad_text.c @@ -1507,6 +1507,27 @@ const char *Txt_Already_existed_an_event_with_the_title_X = // Warning: it is ve "Já existe um evento com o título %s."; #endif +const char *Txt_Already_existed_an_exam_with_the_title_X = // Warning: it is very important to include %s in the following sentences +#if L==1 // ca + "Ja existia un examen amb el títol %s."; +#elif L==2 // de + "Es gibt bereits einen Prüfung mit dem Namen %s."; +#elif L==3 // en + "Already existed an exam with the title %s."; +#elif L==4 // es + "Ya existía un examen con el título %s."; +#elif L==5 // fr + "Il existe déjà un examen du titre %s."; +#elif L==6 // gn + "Ya existía un examen con el título %s."; // Okoteve traducción +#elif L==7 // it + "Esiste già un esame con il titolo %s."; +#elif L==8 // pl + "Istniala juz egzamin z tytulu %s."; +#elif L==9 // pt + "Já existe um exame com o título %s."; +#endif + const char *Txt_Altitude = #if L==1 // ca "Altitud"; @@ -5858,6 +5879,27 @@ const char *Txt_Create_event = "Criar evento"; #endif +const char *Txt_Create_exam = +#if L==1 // ca + "Crear examen"; +#elif L==2 // de + "Prüfung erstellen"; +#elif L==3 // en + "Create exam"; +#elif L==4 // es + "Crear examen"; +#elif L==5 // fr + "Créer exam"; +#elif L==6 // gn + "Crear examen"; // Okoteve traducción +#elif L==7 // it + "Crea esame"; +#elif L==8 // pl + "Utwórz egzamin"; +#elif L==9 // pt + "Criar exame"; +#endif + const char *Txt_Create_folder = #if L==1 // ca "Crear carpeta"; // Necessita traduccio @@ -6490,7 +6532,7 @@ const char *Txt_Created_new_email_domain_X = // Warning: it is very important to const char *Txt_Created_new_event_X = // Warning: it is very important to include %s in the following sentences #if L==1 // ca - "Creado nuevo evento %s."; // Necessita traduccio + "reat nou esdeveniment %s."; #elif L==2 // de "Neues Ereignis %s eingegeben."; #elif L==3 // en @@ -6509,6 +6551,27 @@ const char *Txt_Created_new_event_X = // Warning: it is very important to includ "Criado novo evento %s."; #endif +const char *Txt_Created_new_exam_X = // Warning: it is very important to include %s in the following sentences +#if L==1 // ca + "reat nou examen %s."; +#elif L==2 // de + "Neues Prüfung %s eingegeben."; +#elif L==3 // en + "Created new exam %s."; +#elif L==4 // es + "Creado nuevo examen %s."; +#elif L==5 // fr + "Créé nouveau examen %s."; +#elif L==6 // gn + "Creado nuevo examen %s."; // Okoteve traducción +#elif L==7 // it + "Creato nuovo esame %s."; +#elif L==8 // pl + "Utworzono nowe egzaminu %s."; +#elif L==9 // pt + "Criado novo exame %s."; +#endif + const char *Txt_Created_new_game_X = // Warning: it is very important to include %s in the following sentences #if L==1 // ca "Creada novo joc %s."; @@ -8799,6 +8862,27 @@ const char *Txt_Do_you_really_want_to_remove_the_event_X = // Warning: it is ver "Você realmente deseja remover o evento %s?"; #endif +const char *Txt_Do_you_really_want_to_remove_the_exam_X = // Warning: it is very important to include %s in the following sentences +#if L==1 // ca + "De veres voleu eliminar l'examen %s?"; +#elif L==2 // de + "Wollen Sie der Prüfung %s wirklich entfernen?"; +#elif L==3 // en + "Do you really want to remove the exam %s?"; +#elif L==4 // es + "¿Realmente desea eliminar el examen %s?"; +#elif L==5 // fr + "Voulez-vous vraiment supprimer l'examen %s?"; +#elif L==6 // gn + "¿Realmente desea eliminar el examen %s?"; // Okoteve traducción +#elif L==7 // it + "Vuoi realmente rimuovere l'esame %s?"; +#elif L==8 // pl + "Czy na pewno chcesz usunac egzaminu %s?"; +#elif L==9 // pt + "Você realmente deseja remover o exame %s?"; +#endif + const char *Txt_Do_you_really_want_to_remove_the_field_X_from_the_records_of_Y_Z_ = // Warning: it is very important to include two %s and one %u in the following sentences #if L==1 // ca "¿Realmente desea eliminar el campo %s" @@ -9981,6 +10065,27 @@ const char *Txt_Edit_event = "Editar evento"; #endif +const char *Txt_Edit_exam = +#if L==1 // ca + "Editar exam"; +#elif L==2 // de + "Editar exam"; +#elif L==3 // en + "Editar exam"; +#elif L==4 // es + "Editar examen"; +#elif L==5 // fr + "Editar exam"; +#elif L==6 // gn + "Editar examen"; // Okoteve traducción +#elif L==7 // it + "Editar exam"; +#elif L==8 // pl + "Editar exam"; +#elif L==9 // pt + "Editar exam"; +#endif + const char *Txt_Edit_game = #if L==1 // ca "Editar joc"; @@ -11248,7 +11353,7 @@ const char *Txt_Events = const char *Txt_Exam = #if L==1 // ca - "exàmen"; + "Exàmen"; #elif L==2 // de "Prüfung"; #elif L==3 // en @@ -11582,6 +11687,180 @@ const char *Txt_Exam_of_X = // Warning: it is very important to include %s in th "Exame de %s"; #endif +const char *Txt_Exam_X_removed = // Warning: it is very important to include %s in the following sentences +#if L==1 // ca + "Examen %s eliminat."; +#elif L==2 // de + "Prüfung %s entfernt."; +#elif L==3 // en + "Exam %s removed."; +#elif L==4 // es + "Examen %s eliminado."; +#elif L==5 // fr + "Examen %s supprimé."; +#elif L==6 // gn + "Examen %s eliminado."; // Okoteve traducción +#elif L==7 // it + "Esame %s rimosso."; +#elif L==8 // pl + "Egzamin %s usuniete."; +#elif L==9 // pt + "Exame %s removido."; +#endif + +const char *Txt_Exams = +#if L==1 // ca + "Exàmens"; +#elif L==2 // de + "Prüfungen"; +#elif L==3 // en + "Exams"; +#elif L==4 // es + "Exámenes"; +#elif L==5 // fr + "Examens"; +#elif L==6 // gn + "Exámenes"; // Okoteve traducción +#elif L==7 // it + "Esami"; +#elif L==8 // pl + "Egzaminy"; +#elif L==9 // pt + "Exames"; +#endif + +const char *Txt_EXAMS_ORDER[Exa_NUM_ORDERS] = + { + [Exa_ORDER_BY_START_DATE] = +#if L==1 // ca + "Inici" +#elif L==2 // de + "Start" +#elif L==3 // en + "Start" +#elif L==4 // es + "Inicio" +#elif L==5 // fr + "Début" +#elif L==6 // gn + "Ñepyrũ" +#elif L==7 // it + "Inizio" +#elif L==8 // pl + "Początek" +#elif L==9 // pt + "Início" +#endif + , + [Exa_ORDER_BY_END_DATE] = +#if L==1 // ca + "Final" +#elif L==2 // de + "Ende" +#elif L==3 // en + "End" +#elif L==4 // es + "Final" +#elif L==5 // fr + "Fin" +#elif L==6 // gn + "Paha" +#elif L==7 // it + "Fine" +#elif L==8 // pl + "Koniec" +#elif L==9 // pt + "Fim" +#endif + , + [Exa_ORDER_BY_TITLE] = +#if L==1 // ca + "Exàmen" +#elif L==2 // de + "Prüfung" +#elif L==3 // en + "Exam" +#elif L==4 // es + "Examen" +#elif L==5 // fr + "Examen" +#elif L==6 // gn + "Kuaara'ã" +#elif L==7 // it + "Esame" +#elif L==8 // pl + "Egzamin" +#elif L==9 // pt + "Exame" +#endif + }; + +const char *Txt_EXAMS_ORDER_HELP[Gam_NUM_ORDERS] = + { + [Exa_ORDER_BY_START_DATE] = +#if L==1 // ca + "Ordenar per data de començament" +#elif L==2 // de + "Sortieren nach Startdatum" +#elif L==3 // en + "Sort by start date" +#elif L==4 // es + "Ordenar por fecha de comienzo" +#elif L==5 // fr + "Trier par date de début" +#elif L==6 // gn + "Ordenar por fecha de comienzo" // Okoteve traducción +#elif L==7 // it + "Ordina per data di inizio" +#elif L==8 // pl + "Sortuj wedlug daty rozpoczecia" +#elif L==9 // pt + "Classificar por data de início" +#endif + , + [Exa_ORDER_BY_END_DATE] = +#if L==1 // ca + "Ordenar per data de finalització" +#elif L==2 // de + "Sortieren nach Enddatum" +#elif L==3 // en + "Sort by end date" +#elif L==4 // es + "Ordenar por fecha de finalización" +#elif L==5 // fr + "Trier par date de fin" +#elif L==6 // gn + "Ordenar por fecha de finalización" // Okoteve traducción +#elif L==7 // it + "Ordina per data di fine" +#elif L==8 // pl + "Sortuj wedlug daty zakonczenia" +#elif L==9 // pt + "Classificar por data de término" +#endif + , + [Exa_ORDER_BY_TITLE] = +#if L==1 // ca + "Ordenar per títol del exàmen" +#elif L==2 // de + "Sortieren nach Prüfungtitel" +#elif L==3 // en + "Sort by exam title" +#elif L==4 // es + "Ordenar por título del examen" +#elif L==5 // fr + "Trier par titre de l'examen" +#elif L==6 // gn + "Ordenar por título del examen" // Okoteve traducción +#elif L==7 // it + "Ordina per titolo del gioco" +#elif L==8 // pl + "Sortuj według tytułu egzamin" +#elif L==9 // pt + "Classificar por título do exame" +#endif + }; + const char *Txt_Existing_question = #if L==1 // ca "Pregunta ja existent"; @@ -19672,7 +19951,28 @@ const char *Txt_MENU_TITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] = "Testes" #endif , - // 4: ActSeeAllGam + // 4: ActSeeAllExa +#if L==1 // ca + "Exàmens" +#elif L==2 // de + "Prüfungen" +#elif L==3 // en + "Exams" +#elif L==4 // es + "Exámenes" +#elif L==5 // fr + "Examens" +#elif L==6 // gn + "Exámenes" // Okoteve traducción +#elif L==7 // it + "Esami" +#elif L==8 // pl + "Egzaminy" +#elif L==9 // pt + "Exames" +#endif + , + // 5: ActSeeAllGam #if L==1 // ca "Jocs" #elif L==2 // de @@ -19693,7 +19993,7 @@ const char *Txt_MENU_TITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] = "Jogos" #endif , - // 5: ActSeeAllSvy + // 6: ActSeeAllSvy #if L==1 // ca "Enquestes" #elif L==2 // de @@ -19714,7 +20014,7 @@ const char *Txt_MENU_TITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] = "Inquéritos" #endif , - // 6: ActSeeAllExaAnn + // 7: ActSeeAllExaAnn #if L==1 // ca "Convocatòries" #elif L==2 // de @@ -19735,7 +20035,6 @@ const char *Txt_MENU_TITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] = "Chamadas" #endif , - NULL, // 7 NULL, // 8 NULL, // 9 NULL, // 10 @@ -24588,6 +24887,27 @@ const char *Txt_New_event = "Novo evento"; #endif +const char *Txt_New_exam = +#if L==1 // ca + "Nou examen"; +#elif L==2 // de + "Neue Prüfung"; +#elif L==3 // en + "New exam"; +#elif L==4 // es + "Nuevo examen"; +#elif L==5 // fr + "Nouveau examen"; +#elif L==6 // gn + "Nuevo examen"; // Okoteve traducción +#elif L==7 // it + "Nuovo esame"; +#elif L==8 // pl + "Nowe egzamin"; +#elif L==9 // pt + "Novo exame"; +#endif + const char *Txt_New_FILE_OR_FOLDER = #if L==1 // ca "Nou"; @@ -25596,6 +25916,27 @@ const char *Txt_No_events = "Não há eventos."; #endif +const char *Txt_No_exams = +#if L==1 // ca + "No hi ha exàmens."; +#elif L==2 // de + "Keine Prüfung."; +#elif L==3 // en + "No exams."; +#elif L==4 // es + "No hay exámenes."; +#elif L==5 // fr + "Il n'y a pas d'examens."; +#elif L==6 // gn + "No hay exámenes."; // Okoteve traducción +#elif L==7 // it + "Non ci sono esame."; +#elif L==8 // pl + "Brak egzaminów."; +#elif L==9 // pt + "Não há exames."; +#endif + const char *Txt_No_file_index_html_index_htm_found_within_the_ZIP_file = #if L==1 // ca "No se ha encontrado un archivo index.html / index.htm" @@ -33089,6 +33430,27 @@ const char *Txt_Remove_event = "Remover evento"; #endif +const char *Txt_Remove_exam = +#if L==1 // ca + "Eliminar examen"; +#elif L==2 // de + "Ereignis Prüfung"; +#elif L==3 // en + "Remove exam"; +#elif L==4 // es + "Eliminar examen"; +#elif L==5 // fr + "Supprimer examen"; +#elif L==6 // gn + "Eliminar examen"; // Okoteve traducción +#elif L==7 // it + "Rimuovere esame"; +#elif L==8 // pl + "Usuń egzamin"; +#elif L==9 // pt + "Remover exame"; +#endif + const char *Txt_Remove_file = #if L==1 // ca "Eliminar fitxer"; @@ -43012,6 +43374,27 @@ const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES] = "Testy" #elif L==9 // pt "Testes" +#endif + , + [Fig_EXAMS] = +#if L==1 // ca + "Exàmens" +#elif L==2 // de + "Prüfungen" +#elif L==3 // en + "Exams" +#elif L==4 // es + "Exámenes" +#elif L==5 // fr + "Examens" +#elif L==6 // gn + "Exámenes" // Okoteve traducción +#elif L==7 // it + "Esami" +#elif L==8 // pl + "Egzaminy" +#elif L==9 // pt + "Exames" #endif , [Fig_GAMES] = @@ -46361,6 +46744,27 @@ const char *Txt_The_event_has_been_modified = "O evento foi modificado."; #endif +const char *Txt_The_exam_has_been_modified = +#if L==1 // ca + "El examen ha sido modificado."; // Necessita traduccio +#elif L==2 // de + "Der Ereignis wurde geändert."; +#elif L==3 // en + "The exam has been modified."; +#elif L==4 // es + "El examen ha sido modificado."; +#elif L==5 // fr + "L'examen a été modifié."; +#elif L==6 // gn + "El examen ha sido modificado."; // Okoteve traducción +#elif L==7 // it + "L'esame è stata modificato."; +#elif L==8 // pl + "Egzamin został zmodyfikowany."; +#elif L==9 // pt + "O exame foi modificado."; +#endif + const char *Txt_The_file_could_not_be_processed_successfully = #if L==1 // ca "El fitxer no s'ha pogut processar correctament."; @@ -50918,6 +51322,27 @@ const char *Txt_There_was_a_problem_sending_an_email_automatically = "Ocorreu um problema ao enviar um email automaticamente."; #endif +const char *Txt_This_exam_has_no_questions = +#if L==1 // ca + "Aquest examen no té preguntes."; +#elif L==2 // de + "Dieses Prüfung hat keine Fragen."; +#elif L==3 // en + "This exam has no questions."; +#elif L==4 // es + "Este examen no tiene preguntas."; +#elif L==5 // fr + "Cet examen n'a pas de questions."; +#elif L==6 // gn + "Este examen no tiene preguntas."; // Okoteve traducción +#elif L==7 // it + "Questo esame non ha domande."; +#elif L==8 // pl + "Ten egzamin nie ma pytania."; +#elif L==9 // pt + "Este exame não tem perguntas."; +#endif + const char *Txt_This_game_has_no_questions = #if L==1 // ca "Aquest joc no té preguntes."; @@ -54919,6 +55344,27 @@ const char *Txt_View_event = "Ver evento"; #endif +const char *Txt_View_exam = +#if L==1 // ca + "Veure examen"; +#elif L==2 // de + "Anzeigen Prüfung"; +#elif L==3 // en + "View exam"; +#elif L==4 // es + "Ver examen"; +#elif L==5 // fr + "Voir examen"; +#elif L==6 // gn + "Ver examen"; // Okoteve traducción +#elif L==7 // it + "Vedi esame"; +#elif L==8 // pl + "Zobacz egzaminu"; +#elif L==9 // pt + "Ver exame"; +#endif + const char *Txt_View_game = #if L==1 // ca "Veure joc"; @@ -58259,13 +58705,34 @@ const char *Txt_You_must_specify_the_title_of_the_event = #elif L==6 // gn "Debe especificar el título del evento."; // Okoteve traducción #elif L==7 // it - "È necessario specificare il titolo del evento."; + "È necessario specificare il titolo dell'evento."; #elif L==8 // pl "Musisz podać tytuł wydarzenia."; #elif L==9 // pt "Você deve especificar o título do evento."; #endif +const char *Txt_You_must_specify_the_title_of_the_exam = +#if L==1 // ca + "Cal especificar el títol de l'examen."; +#elif L==2 // de + "Der Prüfung muss angegeben werden."; +#elif L==3 // en + "You must specify the title of the exam."; +#elif L==4 // es + "Debe especificar el título del examen."; +#elif L==5 // fr + "Vous devez spécifier le titre de l'examen."; +#elif L==6 // gn + "Debe especificar el título del examen."; // Okoteve traducción +#elif L==7 // it + "È necessario specificare il titolo dell'esame."; +#elif L==8 // pl + "Musisz podać tytuł egzaminu."; +#elif L==9 // pt + "Você deve especificar o título do exame."; +#endif + const char *Txt_You_must_specify_the_title_of_the_game = #if L==1 // ca "Cal especificar el títol del joc."; diff --git a/swad_user.c b/swad_user.c index e36482a6..35024e3d 100644 --- a/swad_user.c +++ b/swad_user.c @@ -1277,59 +1277,10 @@ bool Usr_CheckIfICanViewRecordTch (struct UsrData *UsrDat) } /*****************************************************************************/ -/************ Check if I can view test results of another user ***************/ +/********* Check if I can view test/exam/match result of another user ********/ /*****************************************************************************/ -bool Usr_CheckIfICanViewTst (const struct UsrData *UsrDat) - { - bool ItsMe; - - /***** 1. Fast check: Am I logged? *****/ - if (!Gbl.Usrs.Me.Logged) - return false; - - /***** 2. Fast check: Is it a valid user code? *****/ - if (UsrDat->UsrCod <= 0) - return false; - - /***** 3. Fast check: Is it a course selected? *****/ - if (Gbl.Hierarchy.Crs.CrsCod <= 0) - return false; - - /***** 4. Fast check: Am I a system admin? *****/ - if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM) - return true; - - /***** 5. Fast check: Do I belong to the current course? *****/ - if (!Gbl.Usrs.Me.IBelongToCurrentCrs) - return false; - - /***** 6. Fast check: It's me? *****/ - ItsMe = Usr_ItsMe (UsrDat->UsrCod); - if (ItsMe) - return true; - - /***** 7. Fast check: Does he/she belong to the current course? *****/ - if (!Usr_CheckIfUsrBelongsToCurrentCrs (UsrDat)) - return false; - - /***** 8. Fast / slow check depending on roles *****/ - switch (Gbl.Usrs.Me.Role.Logged) - { - case Rol_NET: - return Grp_CheckIfUsrSharesAnyOfMyGrpsInCurrentCrs (UsrDat); - case Rol_TCH: - return true; - default: - return false; - } - } - -/*****************************************************************************/ -/*********** Check if I can view matches results of another user *************/ -/*****************************************************************************/ - -bool Usr_CheckIfICanViewMch (const struct UsrData *UsrDat) +bool Usr_CheckIfICanViewTstExaMchResult (const struct UsrData *UsrDat) { bool ItsMe; diff --git a/swad_user.h b/swad_user.h index 89b8305c..090a6f32 100644 --- a/swad_user.h +++ b/swad_user.h @@ -324,8 +324,7 @@ bool Usr_CheckIfUsrHasAcceptedInCurrentCrs (const struct UsrData *UsrDat); bool Usr_CheckIfICanViewRecordStd (const struct UsrData *UsrDat); bool Usr_CheckIfICanViewRecordTch (struct UsrData *UsrDat); -bool Usr_CheckIfICanViewTst (const struct UsrData *UsrDat); -bool Usr_CheckIfICanViewMch (const struct UsrData *UsrDat); +bool Usr_CheckIfICanViewTstExaMchResult (const struct UsrData *UsrDat); bool Usr_CheckIfICanViewAsgWrk (const struct UsrData *UsrDat); bool Usr_CheckIfICanViewAtt (const struct UsrData *UsrDat); bool Usr_CheckIfICanViewUsrAgenda (struct UsrData *UsrDat);