mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-18 06:25:42 +02:00
Version 21.46.3: Oct 27, 2021 Queries moved to module swad_test_database.
This commit is contained in:
parent
5ad59021f1
commit
352b95589c
49
swad_API.c
49
swad_API.c
|
@ -259,7 +259,6 @@ static int API_GetMyLanguage (struct soap *soap);
|
|||
|
||||
static int API_SendMessageToUsr (long OriginalMsgCod,long SenderUsrCod,long ReplyUsrCod,long RecipientUsrCod,bool NotifyByEmail,const char *Subject,const char *Content);
|
||||
|
||||
static int API_GetTstConfig (long CrsCod);
|
||||
static unsigned API_GetNumTestQuestionsInCrs (long CrsCod);
|
||||
static int API_GetTstTags (struct soap *soap,
|
||||
long CrsCod,struct swad__getTestsOutput *getTestsOut);
|
||||
|
@ -3979,8 +3978,7 @@ int swad__getTestConfig (struct soap *soap,
|
|||
getTestConfigOut->feedback[0] = '\0';
|
||||
|
||||
/***** Get test configuration *****/
|
||||
if ((ReturnCode = API_GetTstConfig ((long) courseCode)) != SOAP_OK)
|
||||
return ReturnCode;
|
||||
TstCfg_GetConfig ();
|
||||
getTestConfigOut->pluggable = (TstCfg_GetConfigPluggable () == TstCfg_PLUGGABLE_YES) ? 1 :
|
||||
0;
|
||||
getTestConfigOut->minQuestions = (int) TstCfg_GetConfigMin ();
|
||||
|
@ -4014,46 +4012,6 @@ int swad__getTestConfig (struct soap *soap,
|
|||
return SOAP_OK;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****** Get configuration of tests from database giving a course code ********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static int API_GetTstConfig (long CrsCod)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
|
||||
/***** Query database *****/
|
||||
if (DB_QuerySELECT (&mysql_res,"can not get test configuration",
|
||||
"SELECT Pluggable," // row[0]
|
||||
"Min," // row[1]
|
||||
"Def," // row[2]
|
||||
"Max," // row[3]
|
||||
"MinTimeNxtTstPerQst," // row[4]
|
||||
"Visibility" // row[5]
|
||||
" FROM tst_config"
|
||||
" WHERE CrsCod=%ld",
|
||||
CrsCod))
|
||||
{
|
||||
/***** Get minimun, default and maximum *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
TstCfg_GetConfigFromRow (row);
|
||||
}
|
||||
else // NumRows == 0
|
||||
{
|
||||
TstCfg_SetConfigPluggable (TstCfg_PLUGGABLE_UNKNOWN);
|
||||
TstCfg_SetConfigMin (0);
|
||||
TstCfg_SetConfigDef (0);
|
||||
TstCfg_SetConfigMax (0);
|
||||
TstCfg_SetConfigVisibility (TstVis_VISIBILITY_DEFAULT);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
return SOAP_OK;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/** Get number of visible test questions from database giving a course code **/
|
||||
/*****************************************************************************/
|
||||
|
@ -4145,10 +4103,7 @@ int swad__getTests (struct soap *soap,
|
|||
getTestsOut->questionTagsArray.__ptr = NULL;
|
||||
|
||||
/***** Get test configuration *****/
|
||||
if ((ReturnCode = API_GetTstConfig ((long) courseCode)) != SOAP_OK)
|
||||
return ReturnCode;
|
||||
|
||||
if (TstCfg_GetConfigPluggable () == TstCfg_PLUGGABLE_YES)
|
||||
if (TstCfg_CheckIfPluggableIsUnknownAndCrsHasTests ())
|
||||
{
|
||||
/***** Get tags *****/
|
||||
if ((ReturnCode = API_GetTstTags (soap,
|
||||
|
|
|
@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par
|
|||
|
||||
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 21.46.2 (2021-10-26)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 21.46.3 (2021-10-27)"
|
||||
#define CSS_FILE "swad20.45.css"
|
||||
#define JS_FILE "swad20.69.1.js"
|
||||
/*
|
||||
TODO: Rename CENTRE to CENTER in help wiki.
|
||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||
|
||||
Version 21.46.3: Oct 27, 2021 Queries moved to module swad_test_database. (321054 lines)
|
||||
Version 21.46.2: Oct 26, 2021 Queries moved to module swad_test_database. (321062 lines)
|
||||
Version 21.46.1: Oct 26, 2021 Queries moved to module swad_test_database. (321058 lines)
|
||||
Version 21.46: Oct 26, 2021 New module swad_test_database for database queries related to self-assessment tests. (321036 lines)
|
||||
|
|
|
@ -4353,7 +4353,7 @@ unsigned Qst_GetNumCoursesWithQuestions (HieLvl_Level_t Scope,Qst_AnswerType_t A
|
|||
unsigned Qst_GetNumCoursesWithPluggableQuestions (HieLvl_Level_t Scope,Qst_AnswerType_t AnsType)
|
||||
{
|
||||
extern const char *Qst_DB_StrAnswerTypes[Qst_NUM_ANS_TYPES];
|
||||
extern const char *TstCfg_PluggableDB[TstCfg_NUM_OPTIONS_PLUGGABLE];
|
||||
extern const char *Tst_DB_Pluggable[TstCfg_NUM_OPTIONS_PLUGGABLE];
|
||||
|
||||
/***** Get number of courses with test questions from database *****/
|
||||
switch (Scope)
|
||||
|
@ -4367,7 +4367,7 @@ unsigned Qst_GetNumCoursesWithPluggableQuestions (HieLvl_Level_t Scope,Qst_Answe
|
|||
"tst_config"
|
||||
" WHERE tst_questions.CrsCod=tst_config.CrsCod"
|
||||
" AND tst_config.pluggable='%s'",
|
||||
TstCfg_PluggableDB[TstCfg_PLUGGABLE_YES]);
|
||||
Tst_DB_Pluggable[TstCfg_PLUGGABLE_YES]);
|
||||
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of courses with pluggable test questions",
|
||||
|
@ -4378,7 +4378,7 @@ unsigned Qst_GetNumCoursesWithPluggableQuestions (HieLvl_Level_t Scope,Qst_Answe
|
|||
" AND tst_questions.CrsCod=tst_config.CrsCod"
|
||||
" AND tst_config.pluggable='%s'",
|
||||
Qst_DB_StrAnswerTypes[AnsType],
|
||||
TstCfg_PluggableDB[TstCfg_PLUGGABLE_YES]);
|
||||
Tst_DB_Pluggable[TstCfg_PLUGGABLE_YES]);
|
||||
case HieLvl_CTY:
|
||||
if (AnsType == Qst_ANS_UNKNOWN) // Any type
|
||||
return (unsigned)
|
||||
|
@ -4398,7 +4398,7 @@ unsigned Qst_GetNumCoursesWithPluggableQuestions (HieLvl_Level_t Scope,Qst_Answe
|
|||
" AND tst_questions.CrsCod=tst_config.CrsCod"
|
||||
" AND tst_config.pluggable='%s'",
|
||||
Gbl.Hierarchy.Cty.CtyCod,
|
||||
TstCfg_PluggableDB[TstCfg_PLUGGABLE_YES]);
|
||||
Tst_DB_Pluggable[TstCfg_PLUGGABLE_YES]);
|
||||
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of courses with pluggable test questions",
|
||||
|
@ -4419,7 +4419,7 @@ unsigned Qst_GetNumCoursesWithPluggableQuestions (HieLvl_Level_t Scope,Qst_Answe
|
|||
" AND tst_config.pluggable='%s'",
|
||||
Gbl.Hierarchy.Cty.CtyCod,
|
||||
Qst_DB_StrAnswerTypes[AnsType],
|
||||
TstCfg_PluggableDB[TstCfg_PLUGGABLE_YES]);
|
||||
Tst_DB_Pluggable[TstCfg_PLUGGABLE_YES]);
|
||||
case HieLvl_INS:
|
||||
if (AnsType == Qst_ANS_UNKNOWN) // Any type
|
||||
return (unsigned)
|
||||
|
@ -4437,7 +4437,7 @@ unsigned Qst_GetNumCoursesWithPluggableQuestions (HieLvl_Level_t Scope,Qst_Answe
|
|||
" AND tst_questions.CrsCod=tst_config.CrsCod"
|
||||
" AND tst_config.pluggable='%s'",
|
||||
Gbl.Hierarchy.Ins.InsCod,
|
||||
TstCfg_PluggableDB[TstCfg_PLUGGABLE_YES]);
|
||||
Tst_DB_Pluggable[TstCfg_PLUGGABLE_YES]);
|
||||
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of courses with pluggable test questions",
|
||||
|
@ -4456,7 +4456,7 @@ unsigned Qst_GetNumCoursesWithPluggableQuestions (HieLvl_Level_t Scope,Qst_Answe
|
|||
" AND tst_config.pluggable='%s'",
|
||||
Gbl.Hierarchy.Ins.InsCod,
|
||||
Qst_DB_StrAnswerTypes[AnsType],
|
||||
TstCfg_PluggableDB[TstCfg_PLUGGABLE_YES]);
|
||||
Tst_DB_Pluggable[TstCfg_PLUGGABLE_YES]);
|
||||
case HieLvl_CTR:
|
||||
if (AnsType == Qst_ANS_UNKNOWN) // Any type
|
||||
return (unsigned)
|
||||
|
@ -4472,7 +4472,7 @@ unsigned Qst_GetNumCoursesWithPluggableQuestions (HieLvl_Level_t Scope,Qst_Answe
|
|||
" AND tst_questions.CrsCod=tst_config.CrsCod"
|
||||
" AND tst_config.pluggable='%s'",
|
||||
Gbl.Hierarchy.Ctr.CtrCod,
|
||||
TstCfg_PluggableDB[TstCfg_PLUGGABLE_YES]);
|
||||
Tst_DB_Pluggable[TstCfg_PLUGGABLE_YES]);
|
||||
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of courses with pluggable test questions",
|
||||
|
@ -4489,7 +4489,7 @@ unsigned Qst_GetNumCoursesWithPluggableQuestions (HieLvl_Level_t Scope,Qst_Answe
|
|||
" AND tst_config.pluggable='%s'",
|
||||
Gbl.Hierarchy.Ctr.CtrCod,
|
||||
Qst_DB_StrAnswerTypes[AnsType],
|
||||
TstCfg_PluggableDB[TstCfg_PLUGGABLE_YES]);
|
||||
Tst_DB_Pluggable[TstCfg_PLUGGABLE_YES]);
|
||||
case HieLvl_DEG:
|
||||
if (AnsType == Qst_ANS_UNKNOWN) // Any type
|
||||
return (unsigned)
|
||||
|
@ -4503,7 +4503,7 @@ unsigned Qst_GetNumCoursesWithPluggableQuestions (HieLvl_Level_t Scope,Qst_Answe
|
|||
" AND tst_questions.CrsCod=tst_config.CrsCod"
|
||||
" AND tst_config.pluggable='%s'",
|
||||
Gbl.Hierarchy.Deg.DegCod,
|
||||
TstCfg_PluggableDB[TstCfg_PLUGGABLE_YES]);
|
||||
Tst_DB_Pluggable[TstCfg_PLUGGABLE_YES]);
|
||||
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of courses with pluggable test questions",
|
||||
|
@ -4518,7 +4518,7 @@ unsigned Qst_GetNumCoursesWithPluggableQuestions (HieLvl_Level_t Scope,Qst_Answe
|
|||
" AND tst_config.pluggable='%s'",
|
||||
Gbl.Hierarchy.Deg.DegCod,
|
||||
Qst_DB_StrAnswerTypes[AnsType],
|
||||
TstCfg_PluggableDB[TstCfg_PLUGGABLE_YES]);
|
||||
Tst_DB_Pluggable[TstCfg_PLUGGABLE_YES]);
|
||||
case HieLvl_CRS:
|
||||
if (AnsType == Qst_ANS_UNKNOWN) // Any type
|
||||
return (unsigned)
|
||||
|
@ -4530,7 +4530,7 @@ unsigned Qst_GetNumCoursesWithPluggableQuestions (HieLvl_Level_t Scope,Qst_Answe
|
|||
" AND tst_questions.CrsCod=tst_config.CrsCod"
|
||||
" AND tst_config.pluggable='%s'",
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
TstCfg_PluggableDB[TstCfg_PLUGGABLE_YES]);
|
||||
Tst_DB_Pluggable[TstCfg_PLUGGABLE_YES]);
|
||||
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of courses with pluggable test questions",
|
||||
|
@ -4543,7 +4543,7 @@ unsigned Qst_GetNumCoursesWithPluggableQuestions (HieLvl_Level_t Scope,Qst_Answe
|
|||
" AND tst_config.pluggable='%s'",
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
Qst_DB_StrAnswerTypes[AnsType],
|
||||
TstCfg_PluggableDB[TstCfg_PLUGGABLE_YES]);
|
||||
Tst_DB_Pluggable[TstCfg_PLUGGABLE_YES]);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -27,25 +27,22 @@
|
|||
|
||||
#include <string.h> // For string functions
|
||||
|
||||
#include "swad_alert.h"
|
||||
#include "swad_box.h"
|
||||
#include "swad_database.h"
|
||||
#include "swad_form.h"
|
||||
#include "swad_global.h"
|
||||
#include "swad_parameter.h"
|
||||
#include "swad_question.h"
|
||||
#include "swad_tag_database.h"
|
||||
#include "swad_test.h"
|
||||
#include "swad_test_config.h"
|
||||
#include "swad_test_visibility.h"
|
||||
#include "swad_test_database.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
const char *TstCfg_PluggableDB[TstCfg_NUM_OPTIONS_PLUGGABLE] =
|
||||
{
|
||||
[TstCfg_PLUGGABLE_UNKNOWN] = "unknown",
|
||||
[TstCfg_PLUGGABLE_NO ] = "N",
|
||||
[TstCfg_PLUGGABLE_YES ] = "Y",
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************************** Private constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -84,6 +81,8 @@ static void TstCfg_ShowFormConfig (void);
|
|||
static void TstCfg_PutInputFieldNumQsts (const char *Field,const char *Label,
|
||||
unsigned Value);
|
||||
|
||||
static void TstCfg_GetConfigFromRow (MYSQL_ROW row);
|
||||
|
||||
static TstCfg_Pluggable_t TstCfg_GetPluggableFromForm (void);
|
||||
static void TstCfg_CheckAndCorrectMinDefMax (void);
|
||||
|
||||
|
@ -111,19 +110,14 @@ void TstCfg_CheckAndShowFormConfig (void)
|
|||
|
||||
bool TstCfg_CheckIfPluggableIsUnknownAndCrsHasTests (void)
|
||||
{
|
||||
extern const char *TstCfg_PluggableDB[TstCfg_NUM_OPTIONS_PLUGGABLE];
|
||||
extern const char *Tst_DB_Pluggable[TstCfg_NUM_OPTIONS_PLUGGABLE];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned NumRows;
|
||||
TstCfg_Pluggable_t Pluggable;
|
||||
|
||||
/***** Get pluggability of tests for current course from database *****/
|
||||
NumRows = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get configuration of test",
|
||||
"SELECT Pluggable" // row[0]
|
||||
" FROM tst_config"
|
||||
" WHERE CrsCod=%ld",
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
NumRows = Tst_DB_GetPluggableFromConfig (&mysql_res);
|
||||
|
||||
if (NumRows == 0)
|
||||
TstCfg_SetConfigPluggable (TstCfg_PLUGGABLE_UNKNOWN);
|
||||
|
@ -136,7 +130,7 @@ bool TstCfg_CheckIfPluggableIsUnknownAndCrsHasTests (void)
|
|||
for (Pluggable = TstCfg_PLUGGABLE_NO;
|
||||
Pluggable <= TstCfg_PLUGGABLE_YES;
|
||||
Pluggable++)
|
||||
if (!strcmp (row[0],TstCfg_PluggableDB[Pluggable]))
|
||||
if (!strcmp (row[0],Tst_DB_Pluggable[Pluggable]))
|
||||
{
|
||||
TstCfg_SetConfigPluggable (Pluggable);
|
||||
break;
|
||||
|
@ -317,34 +311,21 @@ void TstCfg_GetConfig (void)
|
|||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned long NumRows;
|
||||
|
||||
/***** Get configuration of test for current course from database *****/
|
||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get configuration of test",
|
||||
"SELECT Pluggable," // row[0]
|
||||
"Min," // row[1]
|
||||
"Def," // row[2]
|
||||
"Max," // row[3]
|
||||
"MinTimeNxtTstPerQst," // row[4]
|
||||
"Visibility" // row[5]
|
||||
" FROM tst_config"
|
||||
" WHERE CrsCod=%ld",
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
TstCfg_SetConfigMinTimeNxtTstPerQst (0UL);
|
||||
TstCfg_SetConfigVisibility (TstVis_VISIBILITY_DEFAULT);
|
||||
if (NumRows == 0)
|
||||
if (Tst_DB_GetConfig (&mysql_res,Gbl.Hierarchy.Crs.CrsCod))
|
||||
{
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
TstCfg_GetConfigFromRow (row);
|
||||
}
|
||||
else
|
||||
{
|
||||
TstCfg_SetConfigPluggable (TstCfg_PLUGGABLE_UNKNOWN);
|
||||
TstCfg_SetConfigMin (TstCfg_DEFAULT_MIN_QUESTIONS);
|
||||
TstCfg_SetConfigDef (TstCfg_DEFAULT_DEF_QUESTIONS);
|
||||
TstCfg_SetConfigMax (TstCfg_DEFAULT_MAX_QUESTIONS);
|
||||
}
|
||||
else // NumRows == 1
|
||||
{
|
||||
/***** Get minimun, default and maximum *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
TstCfg_GetConfigFromRow (row);
|
||||
TstCfg_SetConfigMinTimeNxtTstPerQst (0UL);
|
||||
TstCfg_SetConfigVisibility (TstVis_VISIBILITY_DEFAULT);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -355,8 +336,9 @@ void TstCfg_GetConfig (void)
|
|||
/************ Get configuration values from a database table row *************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TstCfg_GetConfigFromRow (MYSQL_ROW row)
|
||||
static void TstCfg_GetConfigFromRow (MYSQL_ROW row)
|
||||
{
|
||||
extern const char *Tst_DB_Pluggable[TstCfg_NUM_OPTIONS_PLUGGABLE];
|
||||
int IntNum;
|
||||
long LongNum;
|
||||
TstCfg_Pluggable_t Pluggable;
|
||||
|
@ -366,7 +348,7 @@ void TstCfg_GetConfigFromRow (MYSQL_ROW row)
|
|||
for (Pluggable = TstCfg_PLUGGABLE_NO;
|
||||
Pluggable <= TstCfg_PLUGGABLE_YES;
|
||||
Pluggable++)
|
||||
if (!strcmp (row[0],TstCfg_PluggableDB[Pluggable]))
|
||||
if (!strcmp (row[0],Tst_DB_Pluggable[Pluggable]))
|
||||
{
|
||||
TstCfg_SetConfigPluggable (Pluggable);
|
||||
break;
|
||||
|
@ -451,20 +433,7 @@ void TstCfg_ReceiveConfigTst (void)
|
|||
TstCfg_SetConfigVisibility (TstVis_GetVisibilityFromForm ());
|
||||
|
||||
/***** Update database *****/
|
||||
DB_QueryREPLACE ("can not save configuration of tests",
|
||||
"REPLACE INTO tst_config"
|
||||
" (CrsCod,Pluggable,Min,Def,Max,"
|
||||
"MinTimeNxtTstPerQst,Visibility)"
|
||||
" VALUES"
|
||||
" (%ld,'%s',%u,%u,%u,"
|
||||
"'%lu',%u)",
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
TstCfg_PluggableDB[TstCfg_GetConfigPluggable ()],
|
||||
TstCfg_GetConfigMin (),
|
||||
TstCfg_GetConfigDef (),
|
||||
TstCfg_GetConfigMax (),
|
||||
TstCfg_GetConfigMinTimeNxtTstPerQst (),
|
||||
TstCfg_GetConfigVisibility ());
|
||||
Tst_DB_SaveConfig ();
|
||||
|
||||
/***** Show confirmation message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_test_configuration_has_been_updated);
|
||||
|
|
|
@ -61,7 +61,6 @@ bool TstCfg_CheckIfPluggableIsUnknownAndCrsHasTests (void);
|
|||
|
||||
void TstCfg_GetConfig (void);
|
||||
|
||||
void TstCfg_GetConfigFromRow (MYSQL_ROW row);
|
||||
void TstCfg_ReceiveConfigTst (void);
|
||||
|
||||
void TstCfg_SetConfigPluggable (TstCfg_Pluggable_t Pluggable);
|
||||
|
|
|
@ -67,6 +67,13 @@
|
|||
/***************************** Public constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
const char *Tst_DB_Pluggable[TstCfg_NUM_OPTIONS_PLUGGABLE] =
|
||||
{
|
||||
[TstCfg_PLUGGABLE_UNKNOWN] = "unknown",
|
||||
[TstCfg_PLUGGABLE_NO ] = "N",
|
||||
[TstCfg_PLUGGABLE_YES ] = "Y",
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************************** Private constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -271,6 +278,61 @@ unsigned Tst_DB_GetQuestionsForNewTest (MYSQL_RES **mysql_res,
|
|||
Query);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** Save configuration of test for current course ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Tst_DB_SaveConfig (void)
|
||||
{
|
||||
DB_QueryREPLACE ("can not save configuration of tests",
|
||||
"REPLACE INTO tst_config"
|
||||
" (CrsCod,Pluggable,Min,Def,Max,"
|
||||
"MinTimeNxtTstPerQst,Visibility)"
|
||||
" VALUES"
|
||||
" (%ld,'%s',%u,%u,%u,"
|
||||
"'%lu',%u)",
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
Tst_DB_Pluggable[TstCfg_GetConfigPluggable ()],
|
||||
TstCfg_GetConfigMin (),
|
||||
TstCfg_GetConfigDef (),
|
||||
TstCfg_GetConfigMax (),
|
||||
TstCfg_GetConfigMinTimeNxtTstPerQst (),
|
||||
TstCfg_GetConfigVisibility ());
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Get configuration of test in a course *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Tst_DB_GetConfig (MYSQL_RES **mysql_res,long CrsCod)
|
||||
{
|
||||
return (unsigned)
|
||||
DB_QuerySELECT (mysql_res,"can not get configuration of test",
|
||||
"SELECT Pluggable," // row[0]
|
||||
"Min," // row[1]
|
||||
"Def," // row[2]
|
||||
"Max," // row[3]
|
||||
"MinTimeNxtTstPerQst," // row[4]
|
||||
"Visibility" // row[5]
|
||||
" FROM tst_config"
|
||||
" WHERE CrsCod=%ld",
|
||||
CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********* Get pluggability of tests for current course from database ********/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Tst_DB_GetPluggableFromConfig (MYSQL_RES **mysql_res)
|
||||
{
|
||||
return (unsigned)
|
||||
DB_QuerySELECT (mysql_res,"can not get configuration of test",
|
||||
"SELECT Pluggable" // row[0]
|
||||
" FROM tst_config"
|
||||
" WHERE CrsCod=%ld",
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Remove test configuration in a course ********************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -49,14 +49,22 @@
|
|||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
//----------------------- User's settings in course ---------------------------
|
||||
void Tst_DB_IncreaseNumMyPrints (void);
|
||||
void Tst_DB_UpdateLastAccTst (unsigned NumQsts);
|
||||
|
||||
unsigned Tst_DB_GetDateNextTstAllowed (MYSQL_RES **mysql_res);
|
||||
unsigned Tst_DB_GetNumPrintsGeneratedByMe (MYSQL_RES **mysql_res);
|
||||
|
||||
//---------------------------- Test questions ---------------------------------
|
||||
unsigned Tst_DB_GetQuestionsForNewTest (MYSQL_RES **mysql_res,
|
||||
const struct Qst_Questions *Questions);
|
||||
|
||||
//--------------------------- Test configuration ------------------------------
|
||||
void Tst_DB_SaveConfig (void);
|
||||
unsigned Tst_DB_GetConfig (MYSQL_RES **mysql_res,long CrsCod);
|
||||
unsigned Tst_DB_GetPluggableFromConfig (MYSQL_RES **mysql_res);
|
||||
|
||||
void Tst_DB_RemoveTstConfig (long CrsCod);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user