Rcov C0 Coverage Information - RCov

app/helpers/groups_helper.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
app/helpers/groups_helper.rb 70 41
100.00%
100.00%

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 module GroupsHelper
2 
3   # Given a list of groupings and an assignment, constructs an array of table
4   # rows to be insterted into the groupings FilterTable in the groups view.
5   # Called whenever it is necessary to update the groupings table with multiple
6   # changes.
7   def construct_table_rows(groupings, assignment)
8     result = {}
9     groupings.each do |grouping|
10       result[grouping.id] = construct_table_row(grouping, assignment)
11     end
12     return result
13   end
14 
15   # Given a list of students and an assignment, constructs an array of
16   # table rows to be insterted into the students FilterTable in the groups view.
17   # Called whenever it is necessary to update the students table with multiple
18   # changes.
19   def construct_student_table_rows(students, assignment)
20     student_memberships = StudentMembership.all(:conditions => {:grouping_id => assignment.groupings, :user_id => students})
21     students_in_assignment = student_memberships.collect do |membership|
22       membership.user
23     end
24     result = {}
25     students.each do |student|
26       result[student.id] = construct_student_table_row(student, students_in_assignment)
27     end
28     return result
29   end
30 
31   # Given a grouping and an assignment, constructs a table row to be insterted
32   # into the groupings FilterTable in the groups view.  Called whenever it
33   # is necessary to update the groupings table.
34   def construct_table_row(grouping, assignment)
35       table_row = {}
36 
37       table_row[:id] = grouping.id
38       table_row[:filter_table_row_contents] = render_to_string :partial => 'groups/table_row/filter_table_row', :locals => {:grouping => grouping, :assignment => assignment}
39 
40       table_row[:name] = grouping.group.group_name
41 
42       table_row[:members] = grouping.students.collect{ |student| student.user_name}.join(',')
43 
44 #      used for searching
45       table_row[:student_names] = grouping.students.collect{ |student| "#{student.first_name} #{student.last_name}"}.join(',')
46 
47       table_row[:valid] = grouping.is_valid?
48       table_row[:filter_valid] = grouping.is_valid?
49 
50       return table_row
51   end
52 
53   # Given a student and all students belonging to an assignment
54   # (assignment_memberships), constructs a table row to be insterted
55   # into the students FilterTable in the groups view.  Called whenever it
56   # is necessary to update the students table.
57   def construct_student_table_row(student, students_in_assignment)
58     table_row = {}
59 
60     table_row[:id] = student.id
61     table_row[:filter_table_row_contents] = render_to_string :partial => 'groups/table_row/filter_table_student_row', :locals => {:student => student}
62 
63     table_row[:user_name] = student.user_name
64     table_row[:first_name] = student.first_name
65     table_row[:last_name] = student.last_name
66     table_row[:filter_student_assigned] = students_in_assignment.include?(student)
67 
68     return table_row
69 end
70 end

Generated on Sun Feb 05 00:08:07 -0500 2012 with rcov 0.9.10