Rcov C0 Coverage Information - RCov

app/controllers/annotations_controller.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
app/controllers/annotations_controller.rb 94 84
94.68%
95.24%

Key

Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.

Coverage Details

1 class AnnotationsController < ApplicationController
2 
3   before_filter      :authorize_for_ta_and_admin
4 
5   # Not possible to do with image annotations.
6   def add_existing_annotation
7     return unless request.post?
8     @text = AnnotationText.find(params[:annotation_text_id])
9     @submission_file_id = params[:submission_file_id]
10     @submission_file = SubmissionFile.find(@submission_file_id)
11     submission= @submission_file.submission
12     @annotation = TextAnnotation.new
13     @annotation.update_attributes({
14       :line_start => params[:line_start],
15       :line_end => params[:line_end],
16       :submission_file_id => params[:submission_file_id],
17       :annotation_number => submission.annotations.count + 1
18     })
19     @annotation.annotation_text = @text
20     @annotation.save
21     @submission = @submission_file.submission
22     @annotations = @submission.annotations
23   end
24 
25   def create
26     @text = AnnotationText.create({
27       :content => params[:content],
28       :annotation_category_id => params[:category_id]
29     })
30     @submission_file_id = params[:submission_file_id]
31     @submission_file = SubmissionFile.find(@submission_file_id)
32     submission= @submission_file.submission
33     case params[:annotation_type]
34       when 'text'
35         @annotation = TextAnnotation.create({
36           :line_start => params[:line_start],
37           :line_end => params[:line_end],
38           :annotation_text_id => @text.id,
39           :submission_file_id => params[:submission_file_id],
40           :annotation_number => submission.annotations.count + 1
41         })
42       when 'image'
43         @annotation = ImageAnnotation.create({
44           :annotation_text_id => @text.id,
45           :submission_file_id => params[:submission_file_id],
46           :x1 => Integer(params[:x1]), :x2 => Integer(params[:x2]),
47           :y1 => Integer(params[:y1]), :y2 => Integer(params[:y2]),
48           :annotation_number => submission.annotations.count + 1
49         })
50     end
51     @submission = @submission_file.submission
52     @annotations = @submission.annotations
53   end
54 
55   def destroy
56     @annotation = Annotation.find(params[:id])
57     @old_annotation = @annotation.destroy
58     @submission_file_id = params[:submission_file_id]
59     @submission_file = SubmissionFile.find(@submission_file_id)
60     @submission = @submission_file.submission
61     @annotations = @submission.annotations
62     @annotations.each do |annot|
63       if annot.annotation_number > @old_annotation.annotation_number
64         annot.annotation_number -= 1
65         annot.save
66       end
67     end
68 
69   end
70 
71   def update_annotation
72     return unless request.post?
73     @content = params[:annotation_text][:content]
74     @id = params[:annotation_text][:id]
75     @submission_file_id = params[:annotation_text][:submission_file_id]
76     @annotation_text = AnnotationText.find(@id)
77     @annotation_text.content = @content
78     @annotation_text.save
79     @submission_file = SubmissionFile.find(@submission_file_id)
80     @submission = @submission_file.submission
81     @annotations = @submission.annotations
82   end
83 
84   #Updates the overall comment from the annotations tab
85   def update_comment
86     return unless request.post?
87     result = Result.find(params[:result_id])
88     result.overall_comment = params[:overall_comment]
89     result.save
90     render :update do |page|
91     end
92   end
93 
94 end

Generated on Tue Feb 07 00:07:35 -0500 2012 with rcov 0.9.10