|
|
|
@ -74,15 +74,15 @@ class Report::SqlStatement |
|
|
|
|
# FIXME I'm ugly |
|
|
|
|
#select("CASE WHEN COUNT(*) >= 10 THEN '10+' ELSE COUNT(*) END as number_of_assessments") |
|
|
|
|
|
|
|
|
|
#select("(CASE WHEN users.number_of_assessments >= 10 THEN 10 ELSE users.number_of_assessments END) as number_of_assessments") |
|
|
|
|
#unselect("users.number_of_assessments") |
|
|
|
|
select("(CASE WHEN users.number_of_assessments >= 10 THEN 10 ELSE users.number_of_assessments END) as number_of_assessments") |
|
|
|
|
unselect("users.number_of_assessments") |
|
|
|
|
|
|
|
|
|
#group_by("number_of_assessments") |
|
|
|
|
|
|
|
|
|
#group_not_by("users.sector_id") |
|
|
|
|
#group_by("number_of_assessments") |
|
|
|
|
#group_not_by("users.number_of_assessments") |
|
|
|
|
#group_by("users.sector_id") |
|
|
|
|
group_not_by("users.sector_id") |
|
|
|
|
group_by("number_of_assessments") |
|
|
|
|
group_not_by("users.number_of_assessments") |
|
|
|
|
group_by("users.sector_id") |
|
|
|
|
|
|
|
|
|
@sql ||= begin |
|
|
|
|
sql = "\n-- BEGIN #{desc}\n" \ |
|
|
|
|