Commit a5557a551a16c088962f33e9b7c250aff4fb9938
1 parent
3dd71e9a
Exists in
master
and in
1 other branch
remove unneeded error_message += statements
Showing
1 changed file
with
3 additions
and
7 deletions
Show diff stats
lib/tasks/test_api.rake
... | ... | @@ -255,7 +255,6 @@ namespace :test_api do |
255 | 255 | end |
256 | 256 | |
257 | 257 | def answered_appearances_equals_votes_and_skips(question) |
258 | - error_message = "" | |
259 | 258 | success_message = "All vote and skip objects have an associated appearance object" |
260 | 259 | skip_appearances_count = Appearance.count( |
261 | 260 | :conditions => ["skips.valid_record = 1 and appearances.question_id = ? AND answerable_id IS NOT NULL AND answerable_type = 'Skip'", question.id], |
... | ... | @@ -267,15 +266,13 @@ namespace :test_api do |
267 | 266 | total_votes = question.votes.count |
268 | 267 | total_skips = question.skips.count |
269 | 268 | if (total_answered_appearances != total_votes + total_skips) |
270 | - error_message += "Question #{question.id}: answered_appearances = #{total_answered_appearances}, votes = #{total_votes}, skips = #{total_skips}" | |
269 | + error_message = "Question #{question.id}: answered_appearances = #{total_answered_appearances}, votes = #{total_votes}, skips = #{total_skips}" | |
271 | 270 | end |
272 | 271 | |
273 | - | |
274 | 272 | return error_message.blank? ? [success_message, false] : [error_message, true] |
275 | 273 | end |
276 | 274 | |
277 | 275 | def check_each_choice_appears_within_n_stddevs(question) |
278 | - error_message ="" | |
279 | 276 | success_message = "Each choice has appeared n times, where n falls within 6 stddevs of the mean number of appearances for a question " + |
280 | 277 | "(Note: this applies only to seed choices (not user submitted) and choices currently marked active)" |
281 | 278 | |
... | ... | @@ -304,7 +301,7 @@ namespace :test_api do |
304 | 301 | ignore_choices = [133189] |
305 | 302 | appearances_by_choice_id.each do |choice_id, n_i| |
306 | 303 | if ((n_i < (mean - 6*stddev)) || (n_i > mean + 6 *stddev)) && !ignore_choices.include?(choice_id) && Choice.find(choice_id).active? |
307 | - error_message += "Choice #{choice_id} in Question ##{question.id} has an irregular number of appearances: #{n_i}, as compared to the mean: #{mean} and stddev #{stddev} for this question\n" | |
304 | + error_message = "Choice #{choice_id} in Question ##{question.id} has an irregular number of appearances: #{n_i}, as compared to the mean: #{mean} and stddev #{stddev} for this question\n" | |
308 | 305 | end |
309 | 306 | end |
310 | 307 | end |
... | ... | @@ -313,7 +310,6 @@ namespace :test_api do |
313 | 310 | end |
314 | 311 | |
315 | 312 | def check_each_choice_equally_likely_to_appear_left_or_right(question) |
316 | - error_message = "" | |
317 | 313 | success_message = "All choices have equal probability of appearing on left or right (within error params)" |
318 | 314 | question.choices.each do |c| |
319 | 315 | left_prompts_ids = c.prompts_on_the_left.ids_only |
... | ... | @@ -331,7 +327,7 @@ namespace :test_api do |
331 | 327 | z = (est_p - 0.5).abs / Math.sqrt((0.5 * 0.5) / n.to_f) |
332 | 328 | |
333 | 329 | if z > 6 |
334 | - error_message += "Error: Choice ID #{c.id} seems to favor one side: Left Appearances #{left_appearances}, Right Appearances: #{right_appearances}, z = #{z}\n" | |
330 | + error_message = "Error: Choice ID #{c.id} seems to favor one side: Left Appearances #{left_appearances}, Right Appearances: #{right_appearances}, z = #{z}\n" | |
335 | 331 | end |
336 | 332 | end |
337 | 333 | return error_message.blank? ? [success_message, false] : [error_message, true] | ... | ... |