swad-core/swad_rubric_type.h

99 lines
3.2 KiB
C

// swad_rubric_type.h: definition of types for rubrics
#ifndef _SWAD_RUB_TYP
#define _SWAD_RUB_TYP
/*
SWAD (Shared Workspace At a Distance),
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-2023 Antonio Cañas Vargas
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General 3 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 ***********************************/
/*****************************************************************************/
#include <stdbool.h> // For boolean type
#include "swad_date.h"
#include "swad_hierarchy_level.h"
#include "swad_string.h"
/*****************************************************************************/
/************************** Public types and constants ***********************/
/*****************************************************************************/
#define Rub_MAX_CHARS_TITLE (128 - 1) // 127
#define Rub_MAX_BYTES_TITLE ((Rub_MAX_CHARS_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
#define RubCri_MAX_CHARS_TITLE (128 - 1) // 127
#define RubCri_MAX_BYTES_TITLE ((RubCri_MAX_CHARS_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
struct Rub_Rubric
{
long RubCod; // Rubric code
long CrsCod; // Course code
long UsrCod; // Author code
char Title[Rub_MAX_BYTES_TITLE + 1];
unsigned NumCriteria; // Number of criteria in the rubric
};
struct Rub_Rubrics
{
bool LstIsRead; // Is the list already read from database...
// ...or it needs to be read?
unsigned Num; // Total number of rubrics
long *Lst; // List of rubric codes
unsigned CurrentPage;
struct Rub_Rubric Rubric; // Selected/current rubric
long CriCod; // Selected/current criterion code
unsigned CriInd; // Current citerion index
long QstCod; // Current question code
};
#define RubCri_NUM_VALUES 2
typedef enum
{
RubCri_MIN = 0,
RubCri_MAX = 1,
} RubCri_ValueRange_t;
#define RubCri_NUM_SOURCES 4
typedef enum
{
RubCri_FROM_TEACHER,
RubCri_FROM_ANOTHER_RUBRIC,
RubCri_FROM_EXAM_PRINT,
RubCri_FROM_GAME_MATCH,
} RubCri_Source_t;
#define RubCri_SOURCE_DEFAULT RubCri_FROM_TEACHER
struct RubCri_Criterion
{
long RubCod; // Rubric code
long CriCod; // Criterion code
unsigned CriInd; // Criterion index (position in the rubric)
RubCri_Source_t Source;
long Cod;
double Values[RubCri_NUM_VALUES];
double Weight; // Relative weight (from 0.0 to 1.0)
char Title[RubCri_MAX_BYTES_TITLE + 1]; // Title of the criterion
};
#endif