| |
37 |
37 |
template::list::create \ |
| |
38 |
38 |
-name summary \ |
| |
39 |
39 |
-multirow summary \ |
| |
40 |
40 |
-actions { |
| |
41 |
41 |
"Back to Attendance Tasks" "index" "" |
| |
42 |
42 |
} -key user_id \ |
| |
43 |
43 |
-no_data "No summary" \ |
| |
44 |
44 |
-elements { |
| |
45 |
45 |
member_name { label "Student" } |
| |
46 |
46 |
attendance { label "Attendance" } |
| |
47 |
47 |
rate { label "Rate" } |
| |
48 |
48 |
} |
| |
49 |
49 |
|
| |
50 |
50 |
set users [dotlrn_community::list_users $community_id] |
| |
51 |
51 |
|
| |
52 |
52 |
template::multirow create summary member_name attendance rate |
| |
53 |
53 |
|
| |
54 |
54 |
foreach user $users { |
| |
55 |
55 |
set user_id [ns_set get $user user_id] |
| |
56 |
56 |
set attendance [db_string "count" "select count(user_id) from attendance_cal_item_map where user_id = :user_id and cal_item_id in (select cal_item_id from cal_items where on_which_calendar = :calendar_id and item_type_id = :item_type_id )" ] |
| |
57 |
|
if { $attendance == 0 } { set rate "0" } else { set rate [expr $num_sessions/$attendance*100] } |
| |
|
57 |
if { $num_sessions == 0 } { set rate "0" } else { set rate [format "% .2f" [expr (${attendance}.0/$num_sessions)*100]] } |
| |
58 |
58 |
if {$attendance >= $min_days} { template::multirow append summary "[ns_set get $user first_names] [ns_set get $user last_name]" "$attendance of $num_sessions" "$rate %" |
| |
59 |
59 |
} |
| |
60 |
60 |
} |
| |
61 |
61 |
|