Version19.18

This commit is contained in:
Antonio Cañas Vargas 2019-09-28 02:31:42 +02:00
parent 52039c5f94
commit 33b62e9a82
9 changed files with 1182 additions and 1067 deletions

View File

@ -42,8 +42,8 @@ OBJS = swad_account.o swad_action.o swad_agenda.o swad_alert.o \
swad_help.o swad_hierarchy.o swad_holiday.o \
swad_icon.o swad_ID.o swad_indicator.o swad_info.o swad_institution.o \
swad_language.o swad_layout.o swad_link.o swad_logo.o \
swad_mail.o swad_main.o swad_mark.o swad_match.o swad_media.o \
swad_menu.o swad_message.o swad_MFU.o \
swad_mail.o swad_main.o swad_mark.o swad_match.o swad_match_result.o \
swad_media.o swad_menu.o swad_message.o swad_MFU.o \
swad_network.o swad_nickname.o swad_notice.o swad_notification.o \
swad_pagination.o swad_parameter.o swad_password.o swad_photo.o \
swad_place.o swad_plugin.o swad_privacy.o swad_profile.o swad_project.o \

View File

@ -57,6 +57,7 @@
#include "swad_mail.h"
#include "swad_mark.h"
#include "swad_match.h"
#include "swad_match_result.h"
#include "swad_MFU.h"
#include "swad_network.h"
#include "swad_nickname.h"

View File

@ -471,10 +471,11 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 19.17.3 (2019-09-28)"
#define Log_PLATFORM_VERSION "SWAD 19.18 (2019-09-28)"
#define CSS_FILE "swad19.15.css"
#define JS_FILE "swad19.15.js"
/*
Version 19.18: Sep 28, 2019 New module swad_match_result for match results. (246540 lines)
Version 19.17.3: Sep 28, 2019 Code refactoring removing matches and games. (246446 lines)
Version 19.17.2: Sep 27, 2019 Code refactoring removing matches and games. (246448 lines)
Version 19.17.1: Sep 27, 2019 Remove associations between matches and groups when removing groups. (246412 lines)

View File

@ -40,6 +40,7 @@
#include "swad_global.h"
#include "swad_group.h"
#include "swad_match.h"
#include "swad_match_result.h"
#include "swad_pagination.h"
#include "swad_parameter.h"
#include "swad_role.h"
@ -724,7 +725,7 @@ void Gam_GetDataOfGameByCod (struct Game *Game)
Game->NumQsts = Gam_GetNumQstsGame (Game->GamCod);
/* Get number of matches */
Game->NumMchs = Gam_GetNumMchsGame (Game->GamCod);
Game->NumMchs = Mch_GetNumMchsInGame (Game->GamCod);
/* Can I view results of the game?
Can I edit game? */
@ -1770,12 +1771,6 @@ static void Gam_ListOneOrMoreQuestionsForEdition (long GamCod,unsigned NumQsts,
/***** End table *****/
Tbl_EndTable ();
/***** Button to add a new question *****/
// Gam_PutButtonToAddNewQuestions ();
/***** End box *****/
// Box_EndBox ();
}
/*****************************************************************************/
@ -2193,7 +2188,7 @@ static bool Gam_GetNumMchsGameAndCheckIfEditable (struct Game *Game)
extern const char *Txt_You_can_not_edit_a_game_with_matches;
/***** Check if game has matches *****/
if ((Game->NumMchs = Gam_GetNumMchsGame (Game->GamCod)))
if ((Game->NumMchs = Mch_GetNumMchsInGame (Game->GamCod)))
{
Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_edit_a_game_with_matches);
return false; // It has matches ==> it's not editable

View File

@ -38,6 +38,7 @@
#include "swad_game.h"
#include "swad_global.h"
#include "swad_group.h"
#include "swad_match.h"
#include "swad_notification.h"
#include "swad_parameter.h"
#include "swad_project.h"

File diff suppressed because it is too large Load Diff

View File

@ -37,11 +37,48 @@
#define Mch_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 match is finished
#define Mch_NUM_SHOWING 4
typedef enum
{
Mch_NOTHING, // Don't show anything
Mch_STEM, // Showing only the question stem
Mch_ANSWERS, // Showing the question stem and the answers
Mch_RESULTS, // Showing the results
} Mch_Showing_t;
#define Mch_SHOWING_DEFAULT Mch_NOTHING
struct Match
{
long MchCod;
long GamCod;
long UsrCod;
time_t TimeUTC[Dat_NUM_START_END_TIME];
char Title[Gam_MAX_BYTES_TITLE + 1];
struct
{
unsigned QstInd; // 0 means that the game has not started. First question has index 1.
long QstCod;
time_t QstStartTimeUTC;
Mch_Showing_t Showing; // What is shown on teacher's screen
bool ShowQstResults; // Show global results of current question while playing
bool ShowUsrResults; // Show exam with results of all questions for the student
bool Playing; // Is being played now?
unsigned NumPlayers;
} Status; // Status related to match playing
};
struct Mch_UsrAnswer
{
int NumOpt; // < 0 ==> no answer selected
int AnsInd; // < 0 ==> no answer selected
};
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void Mch_ListMatches (struct Game *Game,bool PutFormNewMatch);
void Mch_GetDataOfMatchByCod (struct Match *Match);
void Mch_ToggleVisibilResultsMchUsr (void);
@ -51,6 +88,9 @@ void Mch_RemoveMatchTch (void);
void Mch_RemoveMatchesInGameFromAllTables (long GamCod);
void Mch_RemoveMatchInCourseFromAllTables (long CrsCod);
void Mch_PutParamMchCod (long MchCod);
long Mch_GetParamMchCod (void);
void Mch_CreateNewMatchTch (void);
void Mch_RequestStartResumeMatchTch (void);
void Mch_GetIndexes (long MchCod,unsigned QstInd,
@ -65,24 +105,19 @@ void Mch_ToggleVisibilResultsMchQst (void);
void Mch_BackMatchTch (void);
void Mch_ForwardMatchTch (void);
unsigned Gam_GetNumMchsGame (long GamCod);
unsigned Mch_GetNumMchsInGame (long GamCod);
void Mch_GetMatchBeingPlayed (void);
void Mch_ShowMatchToMeAsStd (void);
void Mch_RefreshMatchTch (void);
void Mch_RefreshMatchStd (void);
void Mch_GetQstAnsFromDB (long MchCod,long UsrCod,unsigned QstInd,
struct Mch_UsrAnswer *UsrAnswer);
void Mch_ReceiveQstAnsFromStd (void);
void Mch_GetAndDrawBarNumUsrsWhoHaveChosenAns (long MchCod,unsigned QstInd,unsigned AnsInd,
unsigned NumAnswerersQst,bool Correct);
unsigned Mch_GetNumUsrsWhoHaveAnswerQst (long MchCod,unsigned QstInd);
void Mch_PutFormToViewMchResults (Act_Action_t Action);
void Mch_SelDatesToSeeMyMchResults (void);
void Mch_ShowMyMchResults (void);
void Mch_SelUsrsToViewUsrsMchResults (void);
void Mch_ShowUsrsMchResults (void);
void Mch_ShowOneMchResult (void);
#endif

1076
swad_match_result.c Normal file

File diff suppressed because it is too large Load Diff

47
swad_match_result.h Normal file
View File

@ -0,0 +1,47 @@
// swad_match_result.h: matches results in games using remote control
#ifndef _SWAD_MCR
#define _SWAD_MCR
/*
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-2019 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 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 ***********************************/
/*****************************************************************************/
/*****************************************************************************/
/************************** Public types and constants ***********************/
/*****************************************************************************/
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void Mch_PutFormToViewMchResults (Act_Action_t Action);
void Mch_SelDatesToSeeMyMchResults (void);
void Mch_ShowMyMchResults (void);
void Mch_SelUsrsToViewUsrsMchResults (void);
void Mch_ShowUsrsMchResults (void);
void Mch_ShowOneMchResult (void);
void Mch_GetMatchResultQuestionsFromDB (long MchCod,long UsrCod,
unsigned *NumQsts,unsigned *NumQstsNotBlank);
#endif