diff --git a/swad_HTML.c b/swad_HTML.c
index b815b998c..02782af4b 100644
--- a/swad_HTML.c
+++ b/swad_HTML.c
@@ -2048,3 +2048,40 @@ void HTM_Percentage (double Percentage)
{
HTM_TxtF ("%5.2lf%%",Percentage);
}
+
+void HTM_TD_Unsigned (unsigned Num)
+ {
+ HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
+ HTM_Unsigned (Num);
+ HTM_TD_End ();
+ }
+
+void HTM_TD_UnsignedLong (unsigned long Num)
+ {
+ HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
+ HTM_UnsignedLong (Num);
+ HTM_TD_End ();
+ }
+
+void HTM_TD_Percentage (unsigned Num,unsigned NumTotal)
+ {
+ HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
+ HTM_Percentage (NumTotal ? (double) Num * 100.0 / (double) NumTotal :
+ 0.0);
+ HTM_TD_End ();
+ }
+
+void HTM_TD_Ratio (unsigned Num,unsigned NumTotal)
+ {
+ HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
+ HTM_Double2Decimals (NumTotal ? (double) Num / (double) NumTotal :
+ 0.0);
+ HTM_TD_End ();
+ }
+
+void HTM_TD_Double2Decimals (double Num)
+ {
+ HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
+ HTM_Double2Decimals (Num);
+ HTM_TD_End ();
+ }
diff --git a/swad_HTML.h b/swad_HTML.h
index 501b213a0..2d803f931 100644
--- a/swad_HTML.h
+++ b/swad_HTML.h
@@ -242,4 +242,10 @@ void HTM_DoubleFewDigits (double Num);
void HTM_Double2Decimals (double Num);
void HTM_Percentage (double Percentage);
+void HTM_TD_Unsigned (unsigned Num);
+void HTM_TD_UnsignedLong (unsigned long Num);
+void HTM_TD_Percentage (unsigned Num,unsigned NumTotal);
+void HTM_TD_Ratio (unsigned Num,unsigned NumTotal);
+void HTM_TD_Double2Decimals (double Num);
+
#endif
diff --git a/swad_account.c b/swad_account.c
index 1b650bfe0..b96120a86 100644
--- a/swad_account.c
+++ b/swad_account.c
@@ -328,13 +328,13 @@ static void Acc_WriteRowEmptyAccount (unsigned NumUsr,const char *ID,struct Usr_
/***** Begin 2nd table row *****/
HTM_TR_Begin (NULL);
- /***** Courses of this user *****/
- HTM_TD_Begin ("colspan=\"2\" class=\"LT %s\"",The_GetColorRows ());
- UsrDat->Sex = Usr_SEX_UNKNOWN;
- Crs_GetAndWriteCrssOfAUsr (UsrDat,Rol_TCH);
- Crs_GetAndWriteCrssOfAUsr (UsrDat,Rol_NET);
- Crs_GetAndWriteCrssOfAUsr (UsrDat,Rol_STD);
- HTM_TD_End ();
+ /***** Courses of this user *****/
+ HTM_TD_Begin ("colspan=\"2\" class=\"LT %s\"",The_GetColorRows ());
+ UsrDat->Sex = Usr_SEX_UNKNOWN;
+ Crs_GetAndWriteCrssOfAUsr (UsrDat,Rol_TCH);
+ Crs_GetAndWriteCrssOfAUsr (UsrDat,Rol_NET);
+ Crs_GetAndWriteCrssOfAUsr (UsrDat,Rol_STD);
+ HTM_TD_End ();
/***** End 2nd table row *****/
HTM_TR_End ();
diff --git a/swad_agenda.c b/swad_agenda.c
index 216bf8dd8..ce78b5eb9 100644
--- a/swad_agenda.c
+++ b/swad_agenda.c
@@ -1601,27 +1601,10 @@ void Agd_GetAndShowAgendasStats (void)
/***** Write number of users who have chosen each language *****/
HTM_TR_Begin (NULL);
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumEvents);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumUsrs);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Percentage (NumUsrsTotal ? (double) NumUsrs * 100.0 /
- (double) NumUsrsTotal :
- 0);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Double2Decimals (NumUsrs ? (double) NumEvents /
- (double) NumUsrs :
- 0);
- HTM_TD_End ();
-
+ HTM_TD_Unsigned (NumEvents);
+ HTM_TD_Unsigned (NumUsrs);
+ HTM_TD_Percentage (NumUsrs,NumUsrsTotal);
+ HTM_TD_Ratio (NumEvents,NumUsrs);
HTM_TR_End ();
/***** End table and box *****/
diff --git a/swad_assignment.c b/swad_assignment.c
index 6f661fbfe..eb82c2e35 100644
--- a/swad_assignment.c
+++ b/swad_assignment.c
@@ -1778,14 +1778,13 @@ void Asg_GetAndShowAssignmentsStats (void)
extern const char *Txt_Number_of_BR_notifications;
unsigned NumAssignments;
unsigned NumNotif;
- unsigned NumCoursesWithAssignments = 0;
- double NumAssignmentsPerCourse = 0.0;
+ unsigned NumCoursesWithAssignments;
/***** Get the number of assignments from this location *****/
if ((NumAssignments = Asg_GetNumAssignments (Gbl.Scope.Current,&NumNotif)))
- if ((NumCoursesWithAssignments = Asg_DB_GetNumCoursesWithAssignments (Gbl.Scope.Current)) != 0)
- NumAssignmentsPerCourse = (double) NumAssignments /
- (double) NumCoursesWithAssignments;
+ NumCoursesWithAssignments = Asg_DB_GetNumCoursesWithAssignments (Gbl.Scope.Current);
+ else
+ NumCoursesWithAssignments = 0;
/***** Begin box and table *****/
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_ASSIGNMENTS],
@@ -1802,23 +1801,10 @@ void Asg_GetAndShowAssignmentsStats (void)
/***** Write number of assignments *****/
HTM_TR_Begin (NULL);
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumAssignments);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumCoursesWithAssignments);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Double2Decimals (NumAssignmentsPerCourse);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumNotif);
- HTM_TD_End ();
-
+ HTM_TD_Unsigned (NumAssignments);
+ HTM_TD_Unsigned (NumCoursesWithAssignments);
+ HTM_TD_Ratio (NumAssignments,NumCoursesWithAssignments);
+ HTM_TD_Unsigned (NumNotif);
HTM_TR_End ();
/***** End table and box *****/
diff --git a/swad_browser.c b/swad_browser.c
index df98a8f0c..9a952f45e 100644
--- a/swad_browser.c
+++ b/swad_browser.c
@@ -10218,13 +10218,8 @@ void Brw_GetAndShowOERsStats (void)
HTM_Txt (Txt_LICENSES[License]);
HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_UnsignedLong (NumFiles[0]);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_UnsignedLong (NumFiles[1]);
- HTM_TD_End ();
+ HTM_TD_UnsignedLong (NumFiles[0]);
+ HTM_TD_UnsignedLong (NumFiles[1]);
HTM_TR_End ();
}
diff --git a/swad_calendar.c b/swad_calendar.c
index 7d2a04504..9ff67d601 100644
--- a/swad_calendar.c
+++ b/swad_calendar.c
@@ -394,15 +394,8 @@ void Cal_GetAndShowNumUsrsPerFirstDayOfWeek (void)
free (Icon);
HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumUsrs[FirstDayOfWeek]);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[FirstDayOfWeek] * 100.0 /
- (double) NumUsrsTotal :
- 0.0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumUsrs[FirstDayOfWeek]);
+ HTM_TD_Percentage (NumUsrs[FirstDayOfWeek],NumUsrsTotal);
HTM_TR_End ();
}
diff --git a/swad_center.c b/swad_center.c
index 632076c71..3f086eaaa 100644
--- a/swad_center.c
+++ b/swad_center.c
@@ -875,19 +875,13 @@ static void Ctr_ListCentersForEdition (const struct Plc_Places *Places)
HTM_TD_End ();
/* Number of users who claim to belong to this center */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumUsrsCtr);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumUsrsCtr);
/* Number of degrees */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumDegs);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumDegs);
/* Number of users in courses of this center */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumUsrsInCrssOfCtr);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumUsrsInCrssOfCtr);
/* Center requester */
UsrDat.UsrCod = Ctr->RequesterUsrCod;
@@ -992,8 +986,7 @@ void Ctr_RemoveCenter (void)
Hie_FlushCacheNumUsrsWhoClaimToBelongTo (Hie_CTR);
/***** Write message to show the change made *****/
- Ale_CreateAlert (Ale_SUCCESS,NULL,
- Txt_Center_X_removed,
+ Ale_CreateAlert (Ale_SUCCESS,NULL,Txt_Center_X_removed,
Ctr_EditingCtr->FullName);
Ctr_EditingCtr->HieCod = -1L; // To not showing button to go to center
@@ -1027,8 +1020,7 @@ void Ctr_ChangeCtrPlc (void)
/***** Create alert to show the change made
and put button to go to center changed *****/
- Ale_CreateAlert (Ale_SUCCESS,NULL,
- Txt_The_place_of_the_center_has_changed);
+ Ale_CreateAlert (Ale_SUCCESS,NULL,Txt_The_place_of_the_center_has_changed);
}
/*****************************************************************************/
@@ -1310,19 +1302,13 @@ static void Ctr_PutFormToCreateCenter (const struct Plc_Places *Places)
HTM_TD_End ();
/***** Number of users who claim to belong to this center *****/
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (0);
/***** Number of degrees *****/
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (0);
/***** Number of users in courses of this center *****/
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (0);
/***** Center requester *****/
HTM_TD_Begin ("class=\"DAT_%s INPUT_REQUESTER LT\"",
diff --git a/swad_changelog.h b/swad_changelog.h
index 777881c0d..f0b234167 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -633,10 +633,11 @@ Me sale este error, no s
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
*/
-#define Log_PLATFORM_VERSION "SWAD 23.35.2 (2023-10-11)"
+#define Log_PLATFORM_VERSION "SWAD 23.36 (2023-10-11)"
#define CSS_FILE "swad23.35.1.css"
#define JS_FILE "swad22.49.js"
/*
+ Version 23.36: Oct 11, 2023 Code refactoring in HTML. (335342 lines)
Version 23.35.2: Oct 11, 2023 Fixed bugs in short/full names. (335550 lines)
Version 23.35.1: Oct 11, 2023 Changes in CSS related to short/full names. (335550 lines)
Version 23.35: Oct 10, 2023 Fixed bugs in short/full names. (335549 lines)
diff --git a/swad_cookie.c b/swad_cookie.c
index 9e49d1926..a4d1d3787 100644
--- a/swad_cookie.c
+++ b/swad_cookie.c
@@ -222,15 +222,8 @@ void Coo_GetAndShowNumUsrsPerCookies (void)
*Accepted[RefAcc].Title,"ICOx16");
HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumUsrs[RefAcc]);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[RefAcc] * 100.0 /
- (double) NumUsrsTotal :
- 0.0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumUsrs[RefAcc]);
+ HTM_TD_Percentage (NumUsrs[RefAcc],NumUsrsTotal);
HTM_TR_End ();
}
diff --git a/swad_country.c b/swad_country.c
index e14668fc6..6a3b3338a 100644
--- a/swad_country.c
+++ b/swad_country.c
@@ -241,94 +241,68 @@ void Cty_ListCountries2 (void)
/***** Write users and institutions in other countries *****/
HTM_TR_Begin (NULL);
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_TD_End ();
+ HTM_TD_Empty (1);
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
HTM_Txt (Txt_Other_countries);
HTM_TD_End ();
/* Number of users who claim to belong to another country */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (Cty_GetCachedNumUsrsWhoClaimToBelongToAnotherCty ());
- HTM_TD_End ();
+ HTM_TD_Unsigned (Cty_GetCachedNumUsrsWhoClaimToBelongToAnotherCty ());
/* Number of institutions in other countries */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (Hie_GetCachedNumNodesInHieLvl (Hie_INS, // Number of institutions...
- Hie_CTY,0)); // ...in other countries
- HTM_TD_End ();
+ HTM_TD_Unsigned (Hie_GetCachedNumNodesInHieLvl (Hie_INS, // Number of institutions...
+ Hie_CTY,0)); // ...in other countries
/* Number of centers in other countries */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (Hie_GetCachedNumNodesInHieLvl (Hie_CTR, // Number of centers...
- Hie_CTY,0)); // ...in other countries
- HTM_TD_End ();
+ HTM_TD_Unsigned (Hie_GetCachedNumNodesInHieLvl (Hie_CTR, // Number of centers...
+ Hie_CTY,0)); // ...in other countries
/* Number of degrees in other countries */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (Hie_GetCachedNumNodesInHieLvl (Hie_DEG, // Number of degrees...
- Hie_CTY,0)); // ...in other countries
- HTM_TD_End ();
+ HTM_TD_Unsigned (Hie_GetCachedNumNodesInHieLvl (Hie_DEG, // Number of degrees...
+ Hie_CTY,0)); // ...in other countries
/* Number of courses in other countries */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (Hie_GetCachedNumNodesInHieLvl (Hie_CRS, // Number of courses...
- Hie_CTY,0)); // ...in other countries
- HTM_TD_End ();
+ HTM_TD_Unsigned (Hie_GetCachedNumNodesInHieLvl (Hie_CRS, // Number of courses...
+ Hie_CTY,0)); // ...in other countries
/* Number of users in courses of other countries */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (Enr_GetCachedNumUsrsInCrss (Hie_CTY,0,
- 1 << Rol_STD |
- 1 << Rol_NET |
- 1 << Rol_TCH)); // Any user
- HTM_TD_End ();
+ HTM_TD_Unsigned (Enr_GetCachedNumUsrsInCrss (Hie_CTY,0,
+ 1 << Rol_STD |
+ 1 << Rol_NET |
+ 1 << Rol_TCH)); // Any user
HTM_TR_End ();
/***** Write users and institutions with unknown country *****/
HTM_TR_Begin (NULL);
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_TD_End ();
+ HTM_TD_Empty (1);
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
HTM_Txt (Txt_Country_unspecified);
HTM_TD_End ();
/* Number of users who do not claim to belong to any country */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (Cty_GetCachedNumUsrsWhoDontClaimToBelongToAnyCty ());
- HTM_TD_End ();
+ HTM_TD_Unsigned (Cty_GetCachedNumUsrsWhoDontClaimToBelongToAnyCty ());
/* Number of institutions with unknown country */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (Hie_GetCachedNumNodesInHieLvl (Hie_INS, // Number of institutions...
+ HTM_TD_Unsigned (Hie_GetCachedNumNodesInHieLvl (Hie_INS, // Number of institutions...
Hie_CTY,-1L)); // ...with unknown country
- HTM_TD_End ();
/* Number of centers with unknown country */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (Hie_GetCachedNumNodesInHieLvl (Hie_CTR, // Number of centers...
+ HTM_TD_Unsigned (Hie_GetCachedNumNodesInHieLvl (Hie_CTR, // Number of centers...
Hie_CTY,-1L)); // ...with unknown country
- HTM_TD_End ();
/* Number of degrees with unknown country */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (Hie_GetCachedNumNodesInHieLvl (Hie_DEG, // Number of degrees...
+ HTM_TD_Unsigned (Hie_GetCachedNumNodesInHieLvl (Hie_DEG, // Number of degrees...
Hie_CTY,-1L)); // ...with unknown country
- HTM_TD_End ();
/* Number of courses with unknown country */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (Hie_GetCachedNumNodesInHieLvl (Hie_CRS, // Number of courses...
+ HTM_TD_Unsigned (Hie_GetCachedNumNodesInHieLvl (Hie_CRS, // Number of courses...
Hie_CTY,-1L)); // ...with unknown country
- HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (0);
HTM_TR_End ();
diff --git a/swad_course.c b/swad_course.c
index 7ec0aa1a5..e690e3d49 100644
--- a/swad_course.c
+++ b/swad_course.c
@@ -1022,15 +1022,11 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
ICanEdit); // Put form?
/* Current number of teachers in this course */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumUsrs[Rol_TCH] +
+ HTM_TD_Unsigned (NumUsrs[Rol_TCH] +
NumUsrs[Rol_NET]);
- HTM_TD_End ();
/* Current number of students in this course */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumUsrs[Rol_STD]);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumUsrs[Rol_STD]);
/* Course requester */
UsrDat.UsrCod = Crs->RequesterUsrCod;
@@ -1133,14 +1129,10 @@ static void Crs_PutFormToCreateCourse (void)
Nam_NewShortAndFullNames (Names);
/***** Current number of teachers in this course *****/
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (0);
/***** Current number of students in this course *****/
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (0);
/***** Course requester *****/
HTM_TD_Begin ("class=\"LT DAT_%s INPUT_REQUESTER\"",The_GetSuffix ());
diff --git a/swad_degree.c b/swad_degree.c
index 699dc08c7..c3952c76d 100644
--- a/swad_degree.c
+++ b/swad_degree.c
@@ -455,14 +455,10 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes)
HTM_TD_End ();
/* Number of courses in this degree */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumCrss);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumCrss);
/* Number of users in courses of this degree */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumUsrsInCrssOfDeg);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumUsrsInCrssOfDeg);
/* Degree requester */
UsrDat.UsrCod = Deg->RequesterUsrCod;
@@ -577,14 +573,10 @@ static void Deg_PutFormToCreateDegree (const struct DegTyp_DegTypes *DegTypes)
HTM_TD_End ();
/***** Number of courses in this degree *****/
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (0);
/***** Number of users in courses of this degree *****/
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (0);
/***** Degree requester *****/
HTM_TD_Begin ("class=\"LT DAT_%s INPUT_REQUESTER\"",
diff --git a/swad_degree_type.c b/swad_degree_type.c
index 042043f3c..8282634ef 100644
--- a/swad_degree_type.c
+++ b/swad_degree_type.c
@@ -432,9 +432,7 @@ static void DegTyp_ListDegreeTypesForEdition (const struct DegTyp_DegTypes *DegT
HTM_TD_End ();
/* Number of degrees of this type */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (DegTypes->Lst[NumDegTyp].NumDegs);
- HTM_TD_End ();
+ HTM_TD_Unsigned (DegTypes->Lst[NumDegTyp].NumDegs);
/* End table row */
HTM_TR_End ();
@@ -486,9 +484,7 @@ static void DegTyp_PutFormToCreateDegreeType (void)
HTM_TD_End ();
/***** Number of degrees of this degree type ****/
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (0);
/***** End table row *****/
HTM_TR_End ();
diff --git a/swad_department.c b/swad_department.c
index 6df956a32..5a6526745 100644
--- a/swad_department.c
+++ b/swad_department.c
@@ -196,9 +196,7 @@ void Dpt_SeeAllDepts (void)
HTM_A_End ();
HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (Departments.Lst[NumDpt].NumTchs);
- HTM_TD_End ();
+ HTM_TD_Unsigned (Departments.Lst[NumDpt].NumTchs);
HTM_TR_End ();
}
@@ -220,9 +218,7 @@ void Dpt_SeeAllDepts (void)
HTM_Txt (Txt_Other_departments);
HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumTchsInsInOtherDpts);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumTchsInsInOtherDpts);
HTM_TR_End ();
@@ -235,9 +231,7 @@ void Dpt_SeeAllDepts (void)
HTM_Txt (Txt_Department_unspecified);
HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumTchsInsWithNoDpt);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumTchsInsWithNoDpt);
HTM_TR_End ();
@@ -553,9 +547,7 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm
HTM_TD_End ();
/* Number of teachers */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (Dpt->NumTchs);
- HTM_TD_End ();
+ HTM_TD_Unsigned (Dpt->NumTchs);
HTM_TR_End ();
}
@@ -852,9 +844,7 @@ static void Dpt_PutFormToCreateDepartment (void)
HTM_TD_End ();
/***** Number of teachers *****/
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (0);
HTM_TR_End ();
diff --git a/swad_exam.c b/swad_exam.c
index e8fa248a3..ff462e2c8 100644
--- a/swad_exam.c
+++ b/swad_exam.c
@@ -1583,13 +1583,13 @@ void Exa_GetAndShowExamsStats (void)
extern const char *Txt_Number_of_BR_courses_with_BR_exams;
extern const char *Txt_Average_number_BR_of_exams_BR_per_course;
unsigned NumExams;
- unsigned NumCoursesWithExams = 0;
- double NumExamsPerCourse = 0.0;
+ unsigned NumCoursesWithExams;
/***** Get the number of exams from this location *****/
if ((NumExams = Exa_DB_GetNumExams (Gbl.Scope.Current)))
- if ((NumCoursesWithExams = Exa_DB_GetNumCoursesWithExams (Gbl.Scope.Current)) != 0)
- NumExamsPerCourse = (double) NumExams / (double) NumCoursesWithExams;
+ NumCoursesWithExams = Exa_DB_GetNumCoursesWithExams (Gbl.Scope.Current);
+ else
+ NumCoursesWithExams = 0;
/***** Begin box and table *****/
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_EXAMS],
@@ -1605,19 +1605,9 @@ void Exa_GetAndShowExamsStats (void)
/***** Write number of exams *****/
HTM_TR_Begin (NULL);
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumExams);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumCoursesWithExams);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Double2Decimals (NumExamsPerCourse);
- HTM_TD_End ();
-
+ HTM_TD_Unsigned (NumExams);
+ HTM_TD_Unsigned (NumCoursesWithExams);
+ HTM_TD_Ratio (NumExams,NumCoursesWithExams);
HTM_TR_End ();
/***** End table and box *****/
diff --git a/swad_follow.c b/swad_follow.c
index c104d3865..0b548952e 100644
--- a/swad_follow.c
+++ b/swad_follow.c
@@ -1217,15 +1217,8 @@ void Fol_GetAndShowFollowStats (void)
Txt_Followers);
HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumUsrs);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Percentage (NumUsrsTotal ? (double) NumUsrs * 100.0 /
- (double) NumUsrsTotal :
- 0.0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumUsrs);
+ HTM_TD_Percentage (NumUsrs,NumUsrsTotal);
HTM_TR_End ();
}
@@ -1244,9 +1237,7 @@ void Fol_GetAndShowFollowStats (void)
HTM_Txt (Txt_FollowPerFollow[Fol]);
HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Double2Decimals (Average);
- HTM_TD_End ();
+ HTM_TD_Double2Decimals (Average);
HTM_TD_Empty (1);
diff --git a/swad_game.c b/swad_game.c
index 5e2c561d6..4f2daad77 100644
--- a/swad_game.c
+++ b/swad_game.c
@@ -2243,13 +2243,13 @@ void Gam_GetAndShowGamesStats (void)
extern const char *Txt_Number_of_BR_courses_with_BR_games;
extern const char *Txt_Average_number_BR_of_games_BR_per_course;
unsigned NumGames;
- unsigned NumCoursesWithGames = 0;
- double NumGamesPerCourse = 0.0;
+ unsigned NumCoursesWithGames;
/***** Get the number of games from this location *****/
if ((NumGames = Gam_DB_GetNumGames (Gbl.Scope.Current)))
- if ((NumCoursesWithGames = Gam_DB_GetNumCoursesWithGames (Gbl.Scope.Current)) != 0)
- NumGamesPerCourse = (double) NumGames / (double) NumCoursesWithGames;
+ NumCoursesWithGames = Gam_DB_GetNumCoursesWithGames (Gbl.Scope.Current);
+ else
+ NumCoursesWithGames = 0;
/***** Begin box and table *****/
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_GAMES],
@@ -2265,19 +2265,9 @@ void Gam_GetAndShowGamesStats (void)
/***** Write number of games *****/
HTM_TR_Begin (NULL);
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumGames);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumCoursesWithGames);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Double2Decimals (NumGamesPerCourse);
- HTM_TD_End ();
-
+ HTM_TD_Unsigned (NumGames);
+ HTM_TD_Unsigned (NumCoursesWithGames);
+ HTM_TD_Ratio (NumGames,NumCoursesWithGames);
HTM_TR_End ();
/***** End table and box *****/
diff --git a/swad_icon.c b/swad_icon.c
index 00949c675..d4d903c44 100644
--- a/swad_icon.c
+++ b/swad_icon.c
@@ -618,15 +618,8 @@ void Ico_GetAndShowNumUsrsPerIconSet (void)
free (URL);
HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumUsrs[IconSet]);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[IconSet] * 100.0 /
- (double) NumUsrsTotal :
- 0.0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumUsrs[IconSet]);
+ HTM_TD_Percentage (NumUsrs[IconSet],NumUsrsTotal);
HTM_TR_End ();
}
diff --git a/swad_institution.c b/swad_institution.c
index f3c41eeaf..d5e5e6143 100644
--- a/swad_institution.c
+++ b/swad_institution.c
@@ -982,19 +982,13 @@ static void Ins_ListInstitutionsForEdition (void)
HTM_TD_End ();
/* Number of users who claim to belong to this institution */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumUsrsIns);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumUsrsIns);
/* Number of centers */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumCtrs);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumCtrs);
/* Number of users in courses of this institution */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumUsrsInCrssOfIns);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumUsrsInCrssOfIns);
/* Institution requester */
HTM_TD_Begin ("class=\"LT DAT_%s INPUT_REQUESTER\"",
@@ -1372,28 +1366,20 @@ static void Ins_PutFormToCreateInstitution (void)
HTM_TD_Begin ("class=\"LM\"");
HTM_INPUT_URL ("WWW",Ins_EditingIns->WWW,HTM_DONT_SUBMIT_ON_CHANGE,
"class=\"INPUT_WWW_NARROW INPUT_%s\""
- " required=\"required\"",
- The_GetSuffix ());
+ " required=\"required\"",The_GetSuffix ());
HTM_TD_End ();
/***** Number of users who claim to belong to this institution ****/
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (0);
/***** Number of centers *****/
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (0);
/***** Number of users in courses of this institution ****/
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (0);
/***** Institution requester *****/
- HTM_TD_Begin ("class=\"LT DAT_%s INPUT_REQUESTER\"",
- The_GetSuffix ());
+ HTM_TD_Begin ("class=\"LT DAT_%s INPUT_REQUESTER\"",The_GetSuffix ());
Usr_WriteAuthor (&Gbl.Usrs.Me.UsrDat,Cns_ENABLED);
HTM_TD_End ();
diff --git a/swad_language.c b/swad_language.c
index 948b01319..c2890ce59 100644
--- a/swad_language.c
+++ b/swad_language.c
@@ -305,15 +305,8 @@ void Lan_GetAndShowNumUsrsPerLanguage (void)
HTM_Txt (Txt_STR_LANG_NAME[Lan]);
HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumUsrs[Lan]);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[Lan] * 100.0 /
- (double) NumUsrsTotal :
- 0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumUsrs[Lan]);
+ HTM_TD_Percentage (NumUsrs[Lan],NumUsrsTotal);
HTM_TR_End ();
}
diff --git a/swad_layout.c b/swad_layout.c
index 542729838..edc16569c 100644
--- a/swad_layout.c
+++ b/swad_layout.c
@@ -1782,15 +1782,8 @@ void Lay_GetAndShowNumUsrsPerSideColumns (void)
free (Icon);
HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumUsrs[SideCols]);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[SideCols] * 100.0 /
- (double) NumUsrsTotal :
- 0.0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumUsrs[SideCols]);
+ HTM_TD_Percentage (NumUsrs[SideCols],NumUsrsTotal);
HTM_TR_End ();
}
diff --git a/swad_mail.c b/swad_mail.c
index 359337b88..94ddc71dd 100644
--- a/swad_mail.c
+++ b/swad_mail.c
@@ -504,9 +504,7 @@ static void Mai_ListMailDomainsForEdition (const struct Mai_Mails *Mails)
HTM_TD_End ();
/* Number of users */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (Mai->NumUsrs);
- HTM_TD_End ();
+ HTM_TD_Unsigned (Mai->NumUsrs);
HTM_TR_End ();
}
@@ -716,9 +714,7 @@ static void Mai_PutFormToCreateMailDomain (void)
HTM_TD_End ();
/* Number of users */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (0);
HTM_TR_End ();
diff --git a/swad_menu.c b/swad_menu.c
index 59c10897b..a7959e1c2 100644
--- a/swad_menu.c
+++ b/swad_menu.c
@@ -458,15 +458,8 @@ void Mnu_GetAndShowNumUsrsPerMenu (void)
Txt_MENU_NAMES[Menu],"ICOx20");
HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumUsrs[Menu]);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[Menu] * 100.0 /
- (double) NumUsrsTotal :
- 0.0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumUsrs[Menu]);
+ HTM_TD_Percentage (NumUsrs[Menu],NumUsrsTotal);
HTM_TR_End ();
}
diff --git a/swad_message.c b/swad_message.c
index 40634fc46..3d577162d 100644
--- a/swad_message.c
+++ b/swad_message.c
@@ -819,7 +819,7 @@ void Msg_RecMsgFromUsr (void)
while (*Ptr)
{
Par_GetNextStrUntilSeparParMult (&Ptr,UsrDstData.EnUsrCod,
- Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
+ Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDstData);
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDstData, // Get recipient's data from database
Usr_DONT_GET_PREFS,
diff --git a/swad_photo_shape.c b/swad_photo_shape.c
index 7219e89b0..caf31210a 100644
--- a/swad_photo_shape.c
+++ b/swad_photo_shape.c
@@ -218,15 +218,8 @@ void PhoSha_GetAndShowNumUsrsPerPhotoShape (void)
Ico_GetPreffix (Ico_BLACK),The_GetSuffix ());
HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumUsrs[Shape]);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[Shape] * 100.0 /
- (double) NumUsrsTotal :
- 0.0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumUsrs[Shape]);
+ HTM_TD_Percentage (NumUsrs[Shape],NumUsrsTotal);
HTM_TR_End ();
}
diff --git a/swad_place.c b/swad_place.c
index ba7e47750..c525d735a 100644
--- a/swad_place.c
+++ b/swad_place.c
@@ -213,12 +213,10 @@ void Plc_SeeAllPlaces (void)
HTM_Txt (Txt_Place_unspecified);
HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (Hie_GetNumNodesInHieLvl (Hie_CTR, // Number of centers...
+ HTM_TD_Unsigned (Hie_GetNumNodesInHieLvl (Hie_CTR, // Number of centers...
Hie_INS, // ...in institution
Gbl.Hierarchy.Node[Hie_INS].HieCod) -
NumCtrsWithPlc);
- HTM_TD_End ();
HTM_TR_End ();
@@ -492,9 +490,7 @@ static void Plc_ListPlacesForEdition (const struct Plc_Places *Places)
true); // Put form
/* Number of centers */
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (Plc->NumCtrs);
- HTM_TD_End ();
+ HTM_TD_Unsigned (Plc->NumCtrs);
HTM_TR_End ();
}
@@ -635,8 +631,7 @@ static void Plc_RenamePlace (Nam_ShrtOrFullName_t ShrtOrFull)
Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
/***** Update place name *****/
- Str_Copy (CurrentName[ShrtOrFull],NewName,
- Nam_MaxBytes[ShrtOrFull]);
+ Str_Copy (CurrentName[ShrtOrFull],NewName,Nam_MaxBytes[ShrtOrFull]);
}
/*****************************************************************************/
@@ -685,9 +680,7 @@ static void Plc_PutFormToCreatePlace (void)
Nam_NewShortAndFullNames (Names);
/***** Number of centers *****/
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (0);
HTM_TR_End ();
diff --git a/swad_privacy.c b/swad_privacy.c
index 70b1de141..a26fa2b04 100644
--- a/swad_privacy.c
+++ b/swad_privacy.c
@@ -372,15 +372,8 @@ static void Pri_GetAndShowNumUsrsPerPrivacyForAnObject (const char *TxtObject,
HTM_Txt (Txt_PRIVACY_OPTIONS[Visibility]);
HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumUsrs[Visibility]);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[Visibility] * 100.0 /
- (double) NumUsrsTotal :
- 0.0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumUsrs[Visibility]);
+ HTM_TD_Percentage (NumUsrs[Visibility],NumUsrsTotal);
HTM_TR_End ();
}
diff --git a/swad_program.c b/swad_program.c
index 07277467d..8daf30d89 100644
--- a/swad_program.c
+++ b/swad_program.c
@@ -2224,14 +2224,13 @@ void Prg_GetAndShowCourseProgramStats (void)
extern const char *Txt_Number_of_BR_courses_with_BR_program_items;
extern const char *Txt_Average_number_BR_of_items_BR_per_course;
unsigned NumItems;
- unsigned NumCoursesWithItems = 0;
- double NumItemsPerCourse = 0.0;
+ unsigned NumCoursesWithItems;
/***** Get the number of program items from this location *****/
if ((NumItems = Prg_DB_GetNumItems (Gbl.Scope.Current)))
- if ((NumCoursesWithItems = Prg_DB_GetNumCoursesWithItems (Gbl.Scope.Current)) != 0)
- NumItemsPerCourse = (double) NumItems /
- (double) NumCoursesWithItems;
+ NumCoursesWithItems = Prg_DB_GetNumCoursesWithItems (Gbl.Scope.Current);
+ else
+ NumCoursesWithItems = 0;
/***** Begin box and table *****/
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_COURSE_PROGRAMS],
@@ -2247,19 +2246,9 @@ void Prg_GetAndShowCourseProgramStats (void)
/***** Write number of assignments *****/
HTM_TR_Begin (NULL);
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumItems);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumCoursesWithItems);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Double2Decimals (NumItemsPerCourse);
- HTM_TD_End ();
-
+ HTM_TD_Unsigned (NumItems);
+ HTM_TD_Unsigned (NumCoursesWithItems);
+ HTM_TD_Ratio (NumItems,NumCoursesWithItems);
HTM_TR_End ();
/***** End table and box *****/
diff --git a/swad_project.c b/swad_project.c
index e1ab7401c..d64b4adfa 100644
--- a/swad_project.c
+++ b/swad_project.c
@@ -4720,14 +4720,13 @@ void Prj_GetAndShowProjectsStats (void)
extern const char *Txt_Number_of_BR_courses_with_BR_projects;
extern const char *Txt_Average_number_BR_of_projects_BR_per_course;
unsigned NumProjects;
- unsigned NumCoursesWithProjects = 0;
- double NumProjectsPerCourse = 0.0;
+ unsigned NumCoursesWithProjects;
/***** Get the number of projects from this location *****/
if ((NumProjects = Prj_DB_GetNumProjects (Gbl.Scope.Current)))
- if ((NumCoursesWithProjects = Prj_DB_GetNumCoursesWithProjects (Gbl.Scope.Current)) != 0)
- NumProjectsPerCourse = (double) NumProjects /
- (double) NumCoursesWithProjects;
+ NumCoursesWithProjects = Prj_DB_GetNumCoursesWithProjects (Gbl.Scope.Current);
+ else
+ NumCoursesWithProjects = 0;
/***** Begin box and table *****/
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_PROJECTS],
@@ -4743,19 +4742,9 @@ void Prj_GetAndShowProjectsStats (void)
/***** Write number of projects *****/
HTM_TR_Begin (NULL);
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumProjects);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumCoursesWithProjects);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Double2Decimals (NumProjectsPerCourse);
- HTM_TD_End ();
-
+ HTM_TD_Unsigned (NumProjects);
+ HTM_TD_Unsigned (NumCoursesWithProjects);
+ HTM_TD_Ratio (NumProjects,NumCoursesWithProjects);
HTM_TR_End ();
/***** End table and box *****/
diff --git a/swad_rubric.c b/swad_rubric.c
index ac2b91a41..d855652df 100644
--- a/swad_rubric.c
+++ b/swad_rubric.c
@@ -1121,18 +1121,20 @@ void Rub_GetAndShowRubricsStats (void)
extern const char *Txt_Average_number_BR_of_rubrics_BR_per_course;
extern const char *Txt_Average_number_BR_of_criteria_BR_per_rubric;
unsigned NumRubrics;
- unsigned NumCoursesWithRubrics = 0;
- double NumRubricsPerCourse = 0.0;
- double NumCriteriaPerRubric = 0.0;
+ unsigned NumCoursesWithRubrics;
+ double NumCriteriaPerRubric;
/***** Get the number of rubrics from this location *****/
if ((NumRubrics = Rub_DB_GetNumRubrics (Gbl.Scope.Current)))
{
- if ((NumCoursesWithRubrics = Rub_DB_GetNumCoursesWithRubrics (Gbl.Scope.Current)) != 0)
- NumRubricsPerCourse = (double) NumRubrics /
- (double) NumCoursesWithRubrics;
+ NumCoursesWithRubrics = Rub_DB_GetNumCoursesWithRubrics (Gbl.Scope.Current);
NumCriteriaPerRubric = Rub_DB_GetNumCriteriaPerRubric (Gbl.Scope.Current);
}
+ else
+ {
+ NumCoursesWithRubrics = 0;
+ NumCriteriaPerRubric = 0.0;
+ }
/***** Begin box and table *****/
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_RUBRICS],
@@ -1149,23 +1151,10 @@ void Rub_GetAndShowRubricsStats (void)
/***** Write number of rubrics *****/
HTM_TR_Begin (NULL);
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumRubrics);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumCoursesWithRubrics);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Double2Decimals (NumRubricsPerCourse);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Double2Decimals (NumCriteriaPerRubric);
- HTM_TD_End ();
-
+ HTM_TD_Unsigned (NumRubrics);
+ HTM_TD_Unsigned (NumCoursesWithRubrics);
+ HTM_TD_Ratio (NumRubrics,NumCoursesWithRubrics);
+ HTM_TD_Double2Decimals (NumCriteriaPerRubric);
HTM_TR_End ();
/***** End table and box *****/
diff --git a/swad_survey.c b/swad_survey.c
index 6a6fa0454..efd18787f 100644
--- a/swad_survey.c
+++ b/swad_survey.c
@@ -3297,18 +3297,20 @@ void Svy_GetAndShowSurveysStats (void)
extern const char *Txt_Number_of_BR_notifications;
unsigned NumSurveys;
unsigned NumNotif;
- unsigned NumCoursesWithSurveys = 0;
- double NumSurveysPerCourse = 0.0;
- double NumQstsPerSurvey = 0.0;
+ unsigned NumCoursesWithSurveys;
+ double NumQstsPerSurvey;
/***** Get the number of surveys and the average number of questions per survey from this location *****/
if ((NumSurveys = Svy_GetNumCrsSurveys (Gbl.Scope.Current,&NumNotif)))
{
- if ((NumCoursesWithSurveys = Svy_DB_GetNumCrssWithCrsSurveys (Gbl.Scope.Current)) != 0)
- NumSurveysPerCourse = (double) NumSurveys /
- (double) NumCoursesWithSurveys;
+ NumCoursesWithSurveys = Svy_DB_GetNumCrssWithCrsSurveys (Gbl.Scope.Current);
NumQstsPerSurvey = Svy_DB_GetNumQstsPerCrsSurvey (Gbl.Scope.Current);
}
+ else
+ {
+ NumCoursesWithSurveys = 0;
+ NumQstsPerSurvey = 0.0;
+ }
/***** Begin box and table *****/
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_SURVEYS],
@@ -3326,27 +3328,11 @@ void Svy_GetAndShowSurveysStats (void)
/***** Write number of surveys *****/
HTM_TR_Begin (NULL);
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumSurveys);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumCoursesWithSurveys);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Double2Decimals (NumSurveysPerCourse);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Double2Decimals (NumQstsPerSurvey);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumNotif);
- HTM_TD_End ();
-
+ HTM_TD_Unsigned (NumSurveys);
+ HTM_TD_Unsigned (NumCoursesWithSurveys);
+ HTM_TD_Ratio (NumSurveys,NumCoursesWithSurveys);
+ HTM_TD_Double2Decimals (NumQstsPerSurvey);
+ HTM_TD_Unsigned (NumNotif);
HTM_TR_End ();
/***** End table and box *****/
diff --git a/swad_test.c b/swad_test.c
index 11d41ceae..3a49fb927 100644
--- a/swad_test.c
+++ b/swad_test.c
@@ -786,9 +786,7 @@ void Tst_GetAndShowTestsStats (void)
HTM_Txt (Txt_TST_STR_ANSWER_TYPES[AnsType]);
HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (Stats.NumCoursesWithQuestions);
- HTM_TD_End ();
+ HTM_TD_Unsigned (Stats.NumCoursesWithQuestions);
HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
HTM_TxtF ("%u (%.1lf%%)",
@@ -798,29 +796,12 @@ void Tst_GetAndShowTestsStats (void)
0.0);
HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (Stats.NumQsts);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Double2Decimals (Stats.AvgQstsPerCourse);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_UnsignedLong (Stats.NumHits);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Double2Decimals (Stats.AvgHitsPerCourse);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Double2Decimals (Stats.AvgHitsPerQuestion);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Double2Decimals (Stats.AvgScorePerQuestion);
- HTM_TD_End ();
+ HTM_TD_Unsigned (Stats.NumQsts);
+ HTM_TD_Double2Decimals (Stats.AvgQstsPerCourse);
+ HTM_TD_UnsignedLong (Stats.NumHits);
+ HTM_TD_Double2Decimals (Stats.AvgHitsPerCourse);
+ HTM_TD_Double2Decimals (Stats.AvgHitsPerQuestion);
+ HTM_TD_Double2Decimals (Stats.AvgScorePerQuestion);
HTM_TR_End ();
}
diff --git a/swad_theme.c b/swad_theme.c
index 5e4c3017e..7923ba098 100644
--- a/swad_theme.c
+++ b/swad_theme.c
@@ -326,15 +326,8 @@ void The_GetAndShowNumUsrsPerTheme (void)
free (URL);
HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumUsrs[Theme]);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[Theme] * 100.0 /
- (double) NumUsrsTotal :
- 0.0);
- HTM_TD_End ();
+ HTM_TD_Unsigned (NumUsrs[Theme]);
+ HTM_TD_Percentage (NumUsrs[Theme],NumUsrsTotal);
HTM_TR_End ();
}
diff --git a/swad_timeline.c b/swad_timeline.c
index f6f3fbf1e..5af28d059 100644
--- a/swad_timeline.c
+++ b/swad_timeline.c
@@ -605,26 +605,10 @@ void Tml_GetAndShowTimelineActivityStats (void)
HTM_Txt (Txt_TIMELINE_NOTE[NoteType]);
HTM_TD_End ();
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumNotes);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Unsigned (NumUsrs);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Percentage (NumUsrsTotal ? (double) NumUsrs * 100.0 /
- (double) NumUsrsTotal :
- 0.0);
- HTM_TD_End ();
-
- HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
- HTM_Double2Decimals (NumUsrs ? (double) NumNotes /
- (double) NumUsrs :
- 0.0);
- HTM_TD_End ();
-
+ HTM_TD_Unsigned (NumNotes);
+ HTM_TD_Unsigned (NumUsrs);
+ HTM_TD_Percentage (NumUsrs,NumUsrsTotal);
+ HTM_TD_Ratio (NumNotes,NumUsrs);
HTM_TR_End ();
}
diff --git a/swad_user.c b/swad_user.c
index 70f99a08a..489c363c6 100644
--- a/swad_user.c
+++ b/swad_user.c
@@ -3118,7 +3118,7 @@ void Usr_GetListsSelectedEncryptedUsrsCods (struct Usr_SelectedUsrs *SelectedUsr
if (Gbl.Session.IsOpen) // If the session is open, get parameter from DB
{
Ses_DB_GetPar (ParName,SelectedUsrs->List[Rol_UNK],
- Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS);
+ Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS);
Str_ChangeFormat (Str_FROM_FORM,Str_TO_TEXT,SelectedUsrs->List[Rol_UNK],
Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS,
Str_REMOVE_SPACES);