mirror of https://github.com/acanas/swad-core.git
Version 21.37.1: Oct 20, 2021 Code refactoring in attendance.
This commit is contained in:
parent
2e7d0b099b
commit
776174d0f1
|
@ -2715,11 +2715,9 @@ int swad__sendAttendanceEvent (struct soap *soap,
|
|||
/* User's code (really not used) */
|
||||
Event.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||
|
||||
/* startTime */
|
||||
Event.TimeUTC[Att_START_TIME] = (time_t) startTime;
|
||||
|
||||
/* endTime */
|
||||
Event.TimeUTC[Att_END_TIME ] = (time_t) endTime;
|
||||
/* startTime and endTime */
|
||||
Event.TimeUTC[Dat_STR_TIME] = (time_t) startTime;
|
||||
Event.TimeUTC[Dat_END_TIME] = (time_t) endTime;
|
||||
|
||||
/* Are teacher's comments visible? */
|
||||
Event.CommentTchVisible = (commentsTeachersVisible ? true :
|
||||
|
|
|
@ -742,8 +742,8 @@ bool Att_GetDataOfAttEventByCod (struct Att_Event *Event)
|
|||
Event->UsrCod = Str_ConvertStrCodToLongCod (row[3]);
|
||||
|
||||
/* Get start date (row[4]) and end date (row[5]) in UTC time */
|
||||
Event->TimeUTC[Att_START_TIME] = Dat_GetUNIXTimeFromStr (row[4]);
|
||||
Event->TimeUTC[Att_END_TIME ] = Dat_GetUNIXTimeFromStr (row[5]);
|
||||
Event->TimeUTC[Dat_STR_TIME] = Dat_GetUNIXTimeFromStr (row[4]);
|
||||
Event->TimeUTC[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[5]);
|
||||
|
||||
/* Get whether the attendance event is open or closed (row(6)) */
|
||||
Event->Open = (row[6][0] == '1');
|
||||
|
@ -778,8 +778,8 @@ static void Att_ResetAttendanceEvent (struct Att_Event *Event)
|
|||
Event->CrsCod = -1L;
|
||||
Event->Hidden = false;
|
||||
Event->UsrCod = -1L;
|
||||
Event->TimeUTC[Att_START_TIME] =
|
||||
Event->TimeUTC[Att_END_TIME ] = (time_t) 0;
|
||||
Event->TimeUTC[Dat_STR_TIME] =
|
||||
Event->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
||||
Event->Open = false;
|
||||
Event->Title[0] = '\0';
|
||||
Event->CommentTchVisible = false;
|
||||
|
@ -1010,8 +1010,8 @@ void Att_RequestCreatOrEditAttEvent (void)
|
|||
/* Initialize some fields */
|
||||
Event.CrsCod = Gbl.Hierarchy.Crs.CrsCod;
|
||||
Event.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||
Event.TimeUTC[Att_START_TIME] = Gbl.StartExecutionTimeUTC;
|
||||
Event.TimeUTC[Att_END_TIME ] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours
|
||||
Event.TimeUTC[Dat_STR_TIME] = Gbl.StartExecutionTimeUTC;
|
||||
Event.TimeUTC[Dat_END_TIME] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours
|
||||
Event.Open = true;
|
||||
}
|
||||
else
|
||||
|
@ -1213,8 +1213,8 @@ void Att_ReceiveFormAttEvent (void)
|
|||
}
|
||||
|
||||
/***** Get start/end date-times *****/
|
||||
ReceivedAtt.TimeUTC[Att_START_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
||||
ReceivedAtt.TimeUTC[Att_END_TIME ] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
||||
ReceivedAtt.TimeUTC[Dat_STR_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
||||
ReceivedAtt.TimeUTC[Dat_END_TIME] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
||||
|
||||
/***** Get boolean parameter that indicates if teacher's comments are visible by students *****/
|
||||
ReceivedAtt.CommentTchVisible = Par_GetParToBool ("ComTchVisible");
|
||||
|
@ -1226,10 +1226,10 @@ void Att_ReceiveFormAttEvent (void)
|
|||
Par_GetParToHTML ("Txt",Description,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
|
||||
|
||||
/***** Adjust dates *****/
|
||||
if (ReceivedAtt.TimeUTC[Att_START_TIME] == 0)
|
||||
ReceivedAtt.TimeUTC[Att_START_TIME] = Gbl.StartExecutionTimeUTC;
|
||||
if (ReceivedAtt.TimeUTC[Att_END_TIME] == 0)
|
||||
ReceivedAtt.TimeUTC[Att_END_TIME] = ReceivedAtt.TimeUTC[Att_START_TIME] + 2 * 60 * 60; // +2 hours // TODO: 2 * 60 * 60 should be in a #define in swad_config.h
|
||||
if (ReceivedAtt.TimeUTC[Dat_STR_TIME] == 0)
|
||||
ReceivedAtt.TimeUTC[Dat_STR_TIME] = Gbl.StartExecutionTimeUTC;
|
||||
if (ReceivedAtt.TimeUTC[Dat_END_TIME] == 0)
|
||||
ReceivedAtt.TimeUTC[Dat_END_TIME] = ReceivedAtt.TimeUTC[Dat_STR_TIME] + 2 * 60 * 60; // +2 hours // TODO: 2 * 60 * 60 should be in a #define in swad_config.h
|
||||
|
||||
/***** Check if title is correct *****/
|
||||
if (ReceivedAtt.Title[0]) // If there's an attendance event title
|
||||
|
@ -2733,7 +2733,7 @@ static void Att_ListEventsToSelect (const struct Att_Events *Events,
|
|||
HTM_SPAN_Begin ("id=\"%s\"",Id);
|
||||
HTM_SPAN_End ();
|
||||
HTM_LABEL_End ();
|
||||
Dat_WriteLocalDateHMSFromUTC (Id,Events->Lst[NumAttEvent].TimeUTC[Att_START_TIME],
|
||||
Dat_WriteLocalDateHMSFromUTC (Id,Events->Lst[NumAttEvent].TimeUTC[Dat_STR_TIME],
|
||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA,
|
||||
true,true,true,0x7);
|
||||
free (Id);
|
||||
|
@ -3180,7 +3180,7 @@ static void Att_ListAttEventsForAStd (const struct Att_Events *Events,
|
|||
HTM_SPAN_End ();
|
||||
HTM_BR ();
|
||||
HTM_Txt (Events->Lst[NumAttEvent].Title);
|
||||
Dat_WriteLocalDateHMSFromUTC (Id,Events->Lst[NumAttEvent].TimeUTC[Att_START_TIME],
|
||||
Dat_WriteLocalDateHMSFromUTC (Id,Events->Lst[NumAttEvent].TimeUTC[Dat_STR_TIME],
|
||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA,
|
||||
true,true,true,0x7);
|
||||
free (Id);
|
||||
|
|
|
@ -37,13 +37,6 @@
|
|||
#define Att_MAX_CHARS_ATTENDANCE_EVENT_TITLE (128 - 1) // 127
|
||||
#define Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE ((Att_MAX_CHARS_ATTENDANCE_EVENT_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
||||
|
||||
#define Att_NUM_DATES 2
|
||||
typedef enum
|
||||
{
|
||||
Att_START_TIME = 0,
|
||||
Att_END_TIME = 1,
|
||||
} Att_StartOrEndTime_t;
|
||||
|
||||
#define Att_NUM_ORDERS_NEWEST_OLDEST 2
|
||||
typedef enum
|
||||
{
|
||||
|
@ -60,7 +53,7 @@ struct Att_Event
|
|||
long CrsCod;
|
||||
bool Hidden;
|
||||
long UsrCod;
|
||||
time_t TimeUTC[Att_NUM_DATES];
|
||||
time_t TimeUTC[Dat_NUM_START_END_TIME];
|
||||
bool Open;
|
||||
char Title[Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE + 1];
|
||||
bool CommentTchVisible;
|
||||
|
|
|
@ -221,8 +221,8 @@ long Att_DB_CreateAttEvent (const struct Att_Event *Event,const char *Descriptio
|
|||
Event->Hidden ? 'Y' :
|
||||
'N',
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Event->TimeUTC[Att_START_TIME],
|
||||
Event->TimeUTC[Att_END_TIME ],
|
||||
Event->TimeUTC[Dat_STR_TIME],
|
||||
Event->TimeUTC[Dat_END_TIME],
|
||||
Event->CommentTchVisible ? 'Y' :
|
||||
'N',
|
||||
Event->Title,
|
||||
|
@ -247,8 +247,8 @@ void Att_DB_UpdateAttEvent (const struct Att_Event *Event,const char *Descriptio
|
|||
" AND CrsCod=%ld", // Extra check
|
||||
Event->Hidden ? 'Y' :
|
||||
'N',
|
||||
Event->TimeUTC[Att_START_TIME],
|
||||
Event->TimeUTC[Att_END_TIME ],
|
||||
Event->TimeUTC[Dat_STR_TIME],
|
||||
Event->TimeUTC[Dat_END_TIME],
|
||||
Event->CommentTchVisible ? 'Y' :
|
||||
'N',
|
||||
Event->Title,
|
||||
|
|
|
@ -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.37 (2021-10-19)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 21.37.1 (2021-10-20)"
|
||||
#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.37.1: Oct 20, 2021 Code refactoring in attendance. (320361 lines)
|
||||
Version 21.37: Oct 19, 2021 New module swad_statistic_database for database queries related to statistics of accesses to platform. (320363 lines)
|
||||
Version 21.36: Oct 18, 2021 New module swad_setting_database for database queries related to user's settings / preferences. (320253 lines)
|
||||
Version 21.35.1: Oct 18, 2021 Queries moved to module swad_file_database. (320175 lines)
|
||||
|
|
|
@ -936,8 +936,12 @@ static void Svy_GetListSurveys (struct Svy_Surveys *Surveys)
|
|||
char *SubQuery[HieLvl_NUM_LEVELS];
|
||||
static const char *OrderBySubQuery[Dat_NUM_START_END_TIME] =
|
||||
{
|
||||
[Dat_STR_TIME] = "StartTime DESC,EndTime DESC,Title DESC",
|
||||
[Dat_END_TIME] = "EndTime DESC,StartTime DESC,Title DESC",
|
||||
[Dat_STR_TIME] = "StartTime DESC,"
|
||||
"EndTime DESC,"
|
||||
"Title DESC",
|
||||
[Dat_END_TIME] = "EndTime DESC,"
|
||||
"StartTime DESC,"
|
||||
"Title DESC",
|
||||
};
|
||||
MYSQL_RES *mysql_res;
|
||||
unsigned long NumRows;
|
||||
|
@ -1300,11 +1304,10 @@ void Svy_GetDataOfSurveyByCod (struct Svy_Survey *Svy)
|
|||
/* Get author of the survey (row[5]) */
|
||||
Svy->UsrCod = Str_ConvertStrCodToLongCod (row[5]);
|
||||
|
||||
/* Get start date (row[6] holds the start UTC time) */
|
||||
Svy->TimeUTC[Att_START_TIME] = Dat_GetUNIXTimeFromStr (row[6]);
|
||||
|
||||
/* Get end date (row[7] holds the end UTC time) */
|
||||
Svy->TimeUTC[Att_END_TIME ] = Dat_GetUNIXTimeFromStr (row[7]);
|
||||
/* Get start date (row[6] holds the start UTC time)
|
||||
and end date (row[7] holds the end UTC time) */
|
||||
Svy->TimeUTC[Dat_STR_TIME] = Dat_GetUNIXTimeFromStr (row[6]);
|
||||
Svy->TimeUTC[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[7]);
|
||||
|
||||
/* Get whether the survey is open or closed (row(8)) */
|
||||
Svy->Status.Open = (row[8][0] == '1');
|
||||
|
|
Loading…
Reference in New Issue