swad-core/swad_test_print.h

110 lines
4.7 KiB
C
Raw Normal View History

2020-05-07 18:33:26 +02:00
// swad_test_print.h: test exam prints made by users
2020-04-02 03:28:08 +02:00
2020-05-07 18:33:26 +02:00
#ifndef _SWAD_TST_PRN
#define _SWAD_TST_PRN
2020-04-02 03:28:08 +02:00
/*
SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain),
and used to support university teaching.
This file is part of SWAD core.
Copyright (C) 1999-2020 Antonio Ca<EFBFBD>as Vargas
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*****************************************************************************/
/********************************* Headers ***********************************/
/*****************************************************************************/
2020-05-07 18:33:26 +02:00
#include "swad_test_config.h"
#include "swad_test_type.h"
2020-04-02 03:28:08 +02:00
#include "swad_user.h"
/*****************************************************************************/
/***************************** Public constants ******************************/
/*****************************************************************************/
/*****************************************************************************/
/******************************* Public types ********************************/
/*****************************************************************************/
2020-05-07 18:33:26 +02:00
struct TstPrn_PrintedQuestion
2020-04-02 03:28:08 +02:00
{
2020-05-07 18:33:26 +02:00
long QstCod; // Question code
2020-05-09 21:07:50 +02:00
long SetCod; // Only for exams
2020-05-09 01:37:00 +02:00
char StrIndexes[Tst_MAX_BYTES_INDEXES_ONE_QST + 1]; // 0 1 2 3, 3 0 2 1, etc.
char StrAnswers[Tst_MAX_BYTES_ANSWERS_ONE_QST + 1]; // Answers selected by user
2020-05-07 18:33:26 +02:00
double Score; // Question score
bool AnswerIsNotBlank; // Answer not blank?
};
struct TstPrn_Print
{
long PrnCod; // Test print code
2020-04-02 03:28:08 +02:00
time_t TimeUTC[Dat_NUM_START_END_TIME];
unsigned NumQsts; // Number of questions
unsigned NumQstsNotBlank; // Number of questions not blank
2020-05-07 18:33:26 +02:00
bool Sent; // This test print has been sent or not?
2020-04-16 21:03:22 +02:00
// "Sent" means that user has clicked "Send" button after finishing
2020-04-22 03:15:04 +02:00
bool AllowTeachers; // Are teachers allowed to see this test result?
2020-05-07 18:33:26 +02:00
double Score; // Total score of the test print
struct TstPrn_PrintedQuestion PrintedQuestions[TstCfg_MAX_QUESTIONS_PER_TEST];
2020-04-02 03:28:08 +02:00
};
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
2020-05-11 02:28:38 +02:00
void TstPrn_ResetPrint (struct TstPrn_Print *Print);
2020-05-09 01:37:00 +02:00
void TstPrn_CreatePrintInDB (struct TstPrn_Print *Print);
2020-05-11 02:28:38 +02:00
void TstPrn_UpdatePrintInDB (const struct TstPrn_Print *Print);
2020-04-02 03:28:08 +02:00
2020-05-07 18:33:26 +02:00
void TstPrn_ShowExamAfterAssess (struct TstPrn_Print *Print);
2020-04-02 03:28:08 +02:00
2020-05-09 01:37:00 +02:00
void TstPrn_ComputeScoresAndStoreQuestionsOfPrint (struct TstPrn_Print *Print,
2020-04-02 03:28:08 +02:00
bool UpdateQstScore);
2020-05-09 01:37:00 +02:00
void TstPrn_ComputeAnswerScore (struct TstPrn_PrintedQuestion *PrintedQuestion,
struct Tst_Question *Question);
void TstPrn_ComputeChoiceAnsScore (struct TstPrn_PrintedQuestion *PrintedQuestion,
2020-04-02 03:28:08 +02:00
struct Tst_Question *Question);
2020-05-09 01:37:00 +02:00
void TstPrn_GetIndexesFromStr (const char StrIndexesOneQst[Tst_MAX_BYTES_INDEXES_ONE_QST + 1], // 0 1 2 3, 3 0 2 1, etc.
2020-04-02 03:28:08 +02:00
unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION]);
2020-05-09 01:37:00 +02:00
void TstPrn_GetAnswersFromStr (const char StrAnswersOneQst[Tst_MAX_BYTES_ANSWERS_ONE_QST + 1],
2020-04-02 03:28:08 +02:00
bool UsrAnswers[Tst_MAX_OPTIONS_PER_QUESTION]);
2020-05-07 18:33:26 +02:00
void TstPrn_ComputeAndShowGrade (unsigned NumQsts,double Score,double MaxGrade);
double TstPrn_ComputeGrade (unsigned NumQsts,double Score,double MaxGrade);
void TstPrn_ShowGrade (double Grade,double MaxGrade);
2020-04-02 03:28:08 +02:00
2020-05-07 18:33:26 +02:00
void TstPrn_SelUsrsToViewUsrsExams (void);
void TstPrn_SelDatesToSeeMyExams (void);
void TstPrn_ShowMyExams (void);
void TstPrn_GetUsrsAndShowExams (void);
2020-04-02 03:28:08 +02:00
2020-05-09 21:07:50 +02:00
void TstPrn_PutParamPrnCod (long ExaCod);
long TstPrn_GetParamPrnCod (void);
2020-04-02 03:28:08 +02:00
2020-05-07 18:33:26 +02:00
void TstPrn_ShowOneExam (void);
void TstPrn_ShowExamAnswers (struct UsrData *UsrDat,
struct TstPrn_Print *Print,
2020-04-02 03:28:08 +02:00
unsigned Visibility);
2020-05-10 01:42:30 +02:00
void TstPrn_GetPrintDataByPrnCod (struct TstPrn_Print *Print);
2020-04-02 03:28:08 +02:00
2020-05-10 01:42:30 +02:00
void TstPrn_GetPrintQuestionsFromDB (struct TstPrn_Print *Print);
2020-05-07 18:33:26 +02:00
void TstPrn_RemoveExamsMadeByUsrInAllCrss (long UsrCod);
void TstPrn_RemoveExamsMadeByUsrInCrs (long UsrCod,long CrsCod);
void TstPrn_RemoveCrsExams (long CrsCod);
2020-04-02 03:28:08 +02:00
#endif