app/controllers/manage/dashboard_controller.rb in hackathon_manager-0.10.1 vs app/controllers/manage/dashboard_controller.rb in hackathon_manager-0.10.2

- old
+ new

@@ -69,10 +69,14 @@ "accepted" => {}, "rsvp_confirmed" => {} } # Temporary fix # result = Questionnaire.joins(:school).group(:acc_status, "schools.name").where("schools.questionnaire_count >= 5").order("schools.questionnaire_count DESC").order("schools.name ASC").count - result = Questionnaire.joins(:school).group(:acc_status, "schools.name", "schools.questionnaire_count").order("schools.questionnaire_count DESC").where("schools.questionnaire_count >= 5").count + query = Questionnaire.joins(:school).group(:acc_status, "schools.name", "schools.questionnaire_count").order("schools.questionnaire_count DESC") + if School.where("questionnaire_count >= 5").count > 0 + query = query.where("schools.questionnaire_count >= 5") + end + result = query.count result.each do |group, count| counted_schools[group[0]][group[1]] = count end render json: [ { name: "RSVP Confirmed", data: counted_schools["rsvp_confirmed"] },