Commit bfb68e8dec8fd16d1c757e2288e9e909c6ab6e28
1 parent
6a713a77
Exists in
master
and in
1 other branch
change 0 to nil for response when no sessions
Showing
2 changed files
with
4 additions
and
1 deletions
Show diff stats
app/models/question.rb
| @@ -690,7 +690,7 @@ class Question < ActiveRecord::Base | @@ -690,7 +690,7 @@ class Question < ActiveRecord::Base | ||
| 690 | UNION ALL | 690 | UNION ALL |
| 691 | (SELECT skipper_id vid FROM skips WHERE question_id = #{id}) | 691 | (SELECT skipper_id vid FROM skips WHERE question_id = #{id}) |
| 692 | ) b GROUP BY b.vid ORDER BY total | 692 | ) b GROUP BY b.vid ORDER BY total |
| 693 | - "), true) || 0 | 693 | + "), true) || nil |
| 694 | end | 694 | end |
| 695 | 695 | ||
| 696 | def upload_to_participation_ratio | 696 | def upload_to_participation_ratio |
spec/integration/questions_spec.rb
| @@ -285,6 +285,9 @@ describe "Questions" do | @@ -285,6 +285,9 @@ describe "Questions" do | ||
| 285 | before(:all) { truncate_all } | 285 | before(:all) { truncate_all } |
| 286 | it "should return the median responses per session" do | 286 | it "should return the median responses per session" do |
| 287 | q = Factory.create(:aoi_question, :site => @api_user) | 287 | q = Factory.create(:aoi_question, :site => @api_user) |
| 288 | + get_auth median_responses_per_session_question_path(q, :format => 'xml') | ||
| 289 | + response.should be_success | ||
| 290 | + response.body.should have_tag("median[nil=true]", :text => "") | ||
| 288 | Factory.create(:vote_new_user, :question => q) | 291 | Factory.create(:vote_new_user, :question => q) |
| 289 | v = Factory.create(:vote_new_user, :question => q) | 292 | v = Factory.create(:vote_new_user, :question => q) |
| 290 | Factory.create(:vote, :question => q, :voter => v.voter) | 293 | Factory.create(:vote, :question => q, :voter => v.voter) |