Version 15.21.2

This commit is contained in:
Antonio Cañas Vargas 2015-10-26 13:36:02 +01:00
parent 5dc75275fc
commit 3666deeb3b
2 changed files with 27 additions and 25 deletions

View File

@ -108,11 +108,12 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.21.1 (2015/10/26)" #define Log_PLATFORM_VERSION "SWAD 15.21.2 (2015/10/26)"
// Number of lines (includes comments but not blank lines) has been got with the following command: // Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
/* /*
Version 15.21.2: Oct 26, 2015 Date-times in tests are displayed in client local date-time. (186315 lines)
Version 15.21.1: Oct 26, 2015 New forms to enter range of date-times in statistic and test. (186313 lines) Version 15.21.1: Oct 26, 2015 New forms to enter range of date-times in statistic and test. (186313 lines)
Version 15.21: Oct 25, 2015 New forms to enter range of date-times in statistic and test. Not finished. (186549 lines) Version 15.21: Oct 25, 2015 New forms to enter range of date-times in statistic and test. Not finished. (186549 lines)
Version 15.20.2: Oct 24, 2015 Code refactoring related to date-times forms. (186294 lines) Version 15.20.2: Oct 24, 2015 Code refactoring related to date-times forms. (186294 lines)

View File

@ -2099,16 +2099,16 @@ static unsigned long Tst_GetQuestionsForEdit (MYSQL_RES **mysql_res)
unsigned NumItemInList; unsigned NumItemInList;
const char *Ptr; const char *Ptr;
char TagText[Tst_MAX_BYTES_TAG+1]; char TagText[Tst_MAX_BYTES_TAG+1];
char LongStr[1+10+1];
char UnsignedStr[10+1]; char UnsignedStr[10+1];
Tst_AnswerType_t AnsType; Tst_AnswerType_t AnsType;
char CrsCodStr[1+10+1]; char CrsCodStr[1+10+1];
char StrDate[16+1];
/***** Select questions *****/ /***** Select questions *****/
/* Start query */ /* Start query */
/* /*
row[0] QstCod row[0] QstCod
row[1] DATE_FORMAT(EditTime,'%%Y%%m%%d%%H%%i%%S') row[1] UNIX_TIMESTAMP(EditTime)
row[2] AnsType row[2] AnsType
row[3] Shuffle row[3] Shuffle
row[4] Stem row[4] Stem
@ -2117,7 +2117,7 @@ static unsigned long Tst_GetQuestionsForEdit (MYSQL_RES **mysql_res)
row[7] NumHitsNotBlank row[7] NumHitsNotBlank
row[8] Score row[8] Score
*/ */
sprintf (Query,"SELECT tst_questions.QstCod,DATE_FORMAT(tst_questions.EditTime,'%%Y%%m%%d%%H%%i%%S') AS F," sprintf (Query,"SELECT tst_questions.QstCod,UNIX_TIMESTAMP(tst_questions.EditTime) AS F,"
"tst_questions.AnsType,tst_questions.Shuffle,tst_questions.Stem,tst_questions.Feedback," "tst_questions.AnsType,tst_questions.Shuffle,tst_questions.Stem,tst_questions.Feedback,"
"tst_questions.NumHits,tst_questions.NumHitsNotBlank,tst_questions.Score" "tst_questions.NumHits,tst_questions.NumHitsNotBlank,tst_questions.Score"
" FROM tst_questions"); " FROM tst_questions");
@ -2127,23 +2127,19 @@ static unsigned long Tst_GetQuestionsForEdit (MYSQL_RES **mysql_res)
strcat (Query," WHERE tst_questions.CrsCod='"); strcat (Query," WHERE tst_questions.CrsCod='");
sprintf (CrsCodStr,"%ld",Gbl.CurrentCrs.Crs.CrsCod); sprintf (CrsCodStr,"%ld",Gbl.CurrentCrs.Crs.CrsCod);
strcat (Query,CrsCodStr); strcat (Query,CrsCodStr);
strcat (Query,"' AND tst_questions.EditTime>="); strcat (Query,"' AND tst_questions.EditTime>=FROM_UNIXTIME('");
sprintf (StrDate,"'%04u%02u%02u'", sprintf (LongStr,"%ld",(long) Gbl.DateRange.TimeUTC[0]);
Gbl.DateRange.DateIni.Year, strcat (Query,LongStr);
Gbl.DateRange.DateIni.Month, strcat (Query,"') AND tst_questions.EditTime<=FROM_UNIXTIME('");
Gbl.DateRange.DateIni.Day); sprintf (LongStr,"%ld",(long) Gbl.DateRange.TimeUTC[1]);
strcat (Query,StrDate); strcat (Query,LongStr);
strcat (Query," AND tst_questions.EditTime<="); strcat (Query,"')");
sprintf (StrDate,"'%04u%02u%02u235959'",
Gbl.DateRange.DateEnd.Year,
Gbl.DateRange.DateEnd.Month,
Gbl.DateRange.DateEnd.Day);
strcat (Query,StrDate);
/* Add the tags selected */ /* Add the tags selected */
if (!Gbl.Test.AllTags) if (!Gbl.Test.AllTags)
{ {
strcat (Query," AND tst_questions.QstCod=tst_question_tags.QstCod AND tst_question_tags.TagCod=tst_tags.TagCod" strcat (Query," AND tst_questions.QstCod=tst_question_tags.QstCod"
" AND tst_question_tags.TagCod=tst_tags.TagCod"
" AND tst_tags.CrsCod='"); " AND tst_tags.CrsCod='");
strcat (Query,CrsCodStr); strcat (Query,CrsCodStr);
strcat (Query,"'"); strcat (Query,"'");
@ -2411,6 +2407,8 @@ static void Tst_ListOneOrMoreQuestionsToEdit (unsigned long NumRows,MYSQL_RES *m
unsigned long NumRow; unsigned long NumRow;
MYSQL_ROW row; MYSQL_ROW row;
long QstCod; long QstCod;
unsigned UniqueId;
time_t TimeUTC;
unsigned long NumHitsThisQst; unsigned long NumHitsThisQst;
unsigned long NumHitsNotBlankThisQst; unsigned long NumHitsNotBlankThisQst;
double TotalScoreThisQst; double TotalScoreThisQst;
@ -2479,9 +2477,9 @@ static void Tst_ListOneOrMoreQuestionsToEdit (unsigned long NumRows,MYSQL_RES *m
fprintf (Gbl.F.Out,"</tr>"); fprintf (Gbl.F.Out,"</tr>");
/***** Write rows *****/ /***** Write rows *****/
for (NumRow = 0; for (NumRow = 0, UniqueId = 1;
NumRow < NumRows; NumRow < NumRows;
NumRow++) NumRow++, UniqueId++)
{ {
Gbl.RowEvenOdd = NumRow % 2; Gbl.RowEvenOdd = NumRow % 2;
@ -2530,12 +2528,15 @@ static void Tst_ListOneOrMoreQuestionsToEdit (unsigned long NumRows,MYSQL_RES *m
"</td>", "</td>",
Gbl.RowEvenOdd,QstCod); Gbl.RowEvenOdd,QstCod);
/* Write the date (row[1] has the date in format YYYYMMDDHHMMSS) */ /* Write the date (row[1] has the UTC date-time) */
fprintf (Gbl.F.Out,"<td class=\"DAT_SMALL CENTER_TOP COLOR%u\">", TimeUTC = Dat_GetUNIXTimeFromStr (row[1]);
Gbl.RowEvenOdd); fprintf (Gbl.F.Out,"<td id=\"tst_date_%u\""
Dat_WriteDate (row[1]); " class=\"DAT_SMALL CENTER_TOP COLOR%u\">"
fprintf (Gbl.F.Out,"<br />"); "<script type=\"text/javascript\">"
Dat_WriteHourMinute (&row[1][8]); "writeLocalDateTimeFromUTC('tst_date_%u',%ld,'<br />');"
"</script>",
UniqueId,Gbl.RowEvenOdd,
UniqueId,TimeUTC);
fprintf (Gbl.F.Out,"</td>"); fprintf (Gbl.F.Out,"</td>");
/* Write the question tags */ /* Write the question tags */