diff --git a/swad_changelog.h b/swad_changelog.h index c6c081f89..a7fb228ad 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -108,7 +108,7 @@ // 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 | tail -1 /* - Version 14.80.7: Mar 09, 2015 Scope country for statistic of surveys. (178998 lines) + Version 14.80.7: Mar 09, 2015 Scope country for statistic of surveys. (179021 lines) Version 14.80.6: Mar 09, 2015 Scope country for statistic of columns. (178987 lines) Version 14.80.5: Mar 09, 2015 Scope country for statistic of menu. (178974 lines) Version 14.80.4: Mar 09, 2015 Scope country for statistic of icon set. (178961 lines) diff --git a/swad_survey.c b/swad_survey.c index 73a5d4f86..8c0344013 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -3591,6 +3591,16 @@ unsigned Svy_GetNumSurveys (Sco_Scope_t Scope,unsigned *NumNotif) " FROM surveys" " WHERE CrsCod>'0'"); break; + case Sco_SCOPE_CTY: + sprintf (Query,"SELECT COUNT(*),SUM(surveys.NumNotif)" + " FROM institutions,centres,degrees,courses,surveys" + " WHERE institutions.CtyCod='%ld'" + " AND institutions.InsCod=centres.InsCod" + " AND centres.CtrCod=degrees.CtrCod" + " AND degrees.DegCod=courses.DegCod" + " AND courses.CrsCod=surveys.CrsCod", + Gbl.CurrentCty.Cty.CtyCod); + break; case Sco_SCOPE_INS: sprintf (Query,"SELECT COUNT(*),SUM(surveys.NumNotif)" " FROM centres,degrees,courses,surveys" @@ -3669,6 +3679,19 @@ float Svy_GetNumQstsPerSurvey (Sco_Scope_t Scope) " AND surveys.SvyCod=svy_questions.SvyCod" " GROUP BY svy_questions.SvyCod) AS NumQstsTable"); break; + case Sco_SCOPE_CTY: + sprintf (Query,"SELECT AVG(NumQsts) FROM" + " (SELECT COUNT(svy_questions.QstCod) AS NumQsts" + " FROM institutions,centres,degrees,courses,surveys,svy_questions" + " WHERE institutions.CtyCod='%ld'" + " AND institutions.InsCod=centres.InsCod" + " AND centres.CtrCod=degrees.CtrCod" + " AND degrees.DegCod=courses.DegCod" + " AND courses.CrsCod=surveys.CrsCod" + " AND surveys.SvyCod=svy_questions.SvyCod" + " GROUP BY svy_questions.SvyCod) AS NumQstsTable", + Gbl.CurrentCty.Cty.CtyCod); + break; case Sco_SCOPE_INS: sprintf (Query,"SELECT AVG(NumQsts) FROM" " (SELECT COUNT(svy_questions.QstCod) AS NumQsts"